[Ftdi-usb-sio-devel] Setting non-standard baud rates
Brought to you by:
bryder
From: Derek S. <ds...@cs...> - 2007-05-08 19:54:47
|
Hi, I have a device with a FT232 USB-serial converter that requires a non-standard baud rate of 250kbaud. I am able to open the device and configure it using standard baud rates, but have not been successful in configuring it for the required 250kbaud. The project webpage (http://ftdi-usb-sio.sourceforge.net/) indicates there are ways to set non-standard baudrates, but none of them have worked for me. The approaches listed and the problems I have encountered are as follows: The first suggestion is to "set tty->termios->c_cflag speed to B38400 and then set your real speed in tty->alt_speed". I have not been able find a way to access to the tty structure (tty_struct) to set the "alt_speed" member variable. I found references to a TIOCTTYGSTRUCT ioctl to retrieve a pointer to the tty_struct, but the #define for this is now commented out in /usr/include/asm/ioctls.h and a comment indicates it is for debugging only. I found a reference in the Linux kernel archives suggesting that this ioctl was to be removed. Also, I have not been able to find the header file for "tty_struct" in /usr/include/linux (the kernel source has it in a file called "tty.h"). Is there another way to set "alt_speed"? The second suggestion is to set a custom divisor in the termios structure. However, there is no integer divisor that gives me the required baud rate (even with the various different baud_base settings of HI, VHI, SHI, or WARP). The only other solutions seem cheesy: recompile the driver with the custom buad rate coded in, or perhaps change the crystal frequency in the attached device so that it scales to a standard baud rate... Any suggestions would be appreciated. If there is no elegant way to set non-standard baud rates, could one be added? thanks, Derek |