Excluding FT-232 from ftdi_sio Driver

For the upcoming AMBEd daemon needed by XLX reflector software there is a need to connect an FTDI USB-serial adapter without using the default ftdi_sio kernel module. Instead the software makes use of the D2XX drivers by FTDI. This driver is available as binary only from FTDI’s website.

The problem with Linux operating systems is that it loads the ftdi_sio driver by default. One option is to blacklist that module. The drawback is that also all other FT232 based USB-serial adapters will also not work anymore. In my case I had some other devices that had to use the ftdi_sio driver while the AMBE device should not. So blacklisting the whole driver is not an option.

Next try was to use FT_prog utility by FTDI. There is an option called “Load D2XX driver” that can be set and programmed into the FT232’s EEPROM. With that bit programmed Windows did not load the VCP drivers and did not create a USB-serial COM port. Plugging that adapter into the Linux machine did not yield any difference to if that bit was not set. It still loads the ftdi_sio driver.

Then I found a way to unbind specific devices from the ftdi_sio driver by manipulating sysfs (See [1]) which I modified a little. The udev rule basically unbinds a single device from beeing claimed by the ftdi_sio kernel module. For an unknown reason the rule was executed four times on my test machines. So I set the filter to be a bit more specific. Here is the code for the udev rule:

SUBSYSTEM=="usb", DRIVER=="ftdi_sio", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{product}=="USB-3003", RUN+="/bin/sh -c 'echo $kernel > /sys/bus/usb/drivers/ftdi_sio/unbind'"

In this case the rule only applies to an USB device with 0x0403 as vendor ID and 0x6001 as prodcut ID as well as “USB-3003” as the product name string. Another option would be to bind the rule to specific serial numbers preseted by the FT232s.

References

[1] https://www.ikalogic.com/ftdi-d2xx-linux-overcoming-big-problem/