Description:
On most distributions, the linux kernel will have either a built-in or optional module called "ftdi_sio". This will detect an FTDI device and automatically invoke the "usbserial" module and create devices such as "/dev/ttyUSB0".
When the ftdi_sio module is controlling an FTDI device, it is not available to libftd2xx. Thus, if the library attempts to access the device it will receive a message "FT_Open failed".
Solution:
There are several methods of preventing ftdi_sio from controlling FTDI devices.
1) Remove the ftdi_sio module from the running kernel:
sudo lsmod | grep ftdi_sio
If "ftdi_sio" is listed unload it (and its helper module, usbserial):
sudo rmmod ftdi_sio
sudo rmmod usbserial
To reverse the operation the kernel modules can be reloaded using modprobe instead of rmmod.
2) Build a new kernel without the ftdi_sio module.
Refer to your distributions instructions for building a custom kernel.
3) Use a udev unbind sysfs interface to disable devices as they are connected.
First identify the device identifier to remove.
ls /sys/bus/usb/drivers/ftdi_sio
This will show a list of ports on USB devices that are linked to the ftdi_sio driver.
These are in the form 1-2:1.0 (bus number 1 - port number 2 : device 1 . interface 0) for Port A, and 1-2:1.1 would be Port B on the same device.
The /dev/ttyUSBx node can be mapped to the device identifier using:
lsusb -t
The devices will be listed in a tree format which can be mapped to the device identifiers.
Identify the device which you wish to use and then send the identifier of the device to the "unbind" interface in the driver. (The tee function just echos stdin to stdout with privilege escalation through sudo).
echo -n 1-2:1.1 | sudo tee /sys/bus/usb/drivers/ftdi_sio/unbind
To reverse the process the same device number can be sent to the "bind" interface to re-enable the USB serial device.
This can be scripted through udev rules to happen when a device connection change is detected.