Wednesday, May 2, 2012

FTDI USB driver woes on Debian LiveCD

Just a quick info that might be useful for some of you Xbee users. I wrote this little software to visualize and plot Xbee accelerometer data a while back.

Now, my brother tried to use it, and since he is not into Linux at the moment, I prepared a LiveCD for him using the Debian Live project. The reason why I did that is because the python program needs wxpython which is not included in the default Debian LiveCD.

The problem is that the kernel currently used (at the time of build: started Mon, 05 Mar 2012 20:21:01 -0600 and ended Mon, 05 Mar 2012 20:52:50 -0600) includes a buggy driver for the FTDI USB kernel driver. Details about the bug can be found here :
http://comments.gmane.org/gmane.linux.usb.general/44150

and changes needed to any python software (including my own xviz) that wants to work around this bug, so that you don't need to replace the kernel or rebuild the liveCD, are to look for a line like this:
 self._port = serial.Serial(self._comport, 9600)
and add a rtscts= parameter like this:
 self._port = serial.Serial(self._comport, 9600, rtscts=1)

This tells the driver to open the serial port using RTS/CTS flow control, which actually disables it, because the driver inverts both states, duh.