I Have to set a non standard baudrate on my buffalo wzr-hpg300nh (openwrt linux backfire 10.03) with an usb to serial converter.
The converter has a FT232R chip inside.
My problem is that I can only set standard baudrates like 115200 or 9600. When I set the baudrate I need (105263 baud) the value is not stored and the baudrate I measure with my oszilloskop is the last set standard rate.
Generally it is possible to set such baudrates because with WindowsXP (Realterm) I have no problems.
I tried the stty command:
stty raw ispeed 105263 ospeed 105263 -F /dev/ttyUSB0
stty -F /dev/ttyUSB0 105263
My first attemp was to set baudrate with an c++ programm shown following. But there it is generally not possible to set baudrates not defined with b...
memset ( & ( this_->o_portOptions ), 0, sizeof ( this_->o_portOptions ) );
cfsetispeed ( & ( this_->o_portOptions ), B9600 );
cfsetospeed ( & ( this_->o_portOptions ), B9600 );
this_->o_portOptions.c_cflag|=PARENB; // disable parity bit
this_->o_portOptions.c_cflag&=~CSTOPB; // one stop bit
this_->o_portOptions.c_cflag&=~CSIZE; // clear bit mask
this_->o_portOptions.c_cflag|=CS8; // set bit mask to 8 data bits
this_->o_portOptions.c_cc[VMIN]=0; // VMIN is the minimum amount of characters to read.
this_->o_portOptions.c_cc[VTIME]=0; // The amount of time in tenth of a second to wait for the amount of data specified by VMIN in tenths of a second.
this_->o_portOptions.c_cflag |= ( CLOCAL|CREAD ); // CLOCAL means donâ??t allow control of the port to be changed CREAD says to enable the receiver
if ( tcsetattr ( this_->i_portHandle, TCSANOW, & ( this_->o_portOptions ) ) != 0 )
LogC(logERROR, "Error setting serial port attributes\n");
this_->i_portHandle = 0;
On my router I found some packages installed like "kmod-usb-serial-ftdi" and "libftdi" but I do not know how I can excess them from console or from c++. Do someone have an code example for c++ or console?