FTDI Serial Device Disconnects All Serials when Plugged In on Ubuntu due to Udev Rule

252 Views Asked by At

I am working with a device that communicates using FTDI serial over USB. The SDK provided for this device instructs me to add a Udev rule to 99-libftdi.rules as follows:

ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0666", RUN+="/bin/sh -c 'rmmod ftdi_sio && rmmod usbserial'"

The problem I encounter is that whenever I plug in the device, the above command gets executed, and all serial devices get disconnected, including the FTDI device itself. Interestingly, even when the FTDI device isn't listed in /dev/tty, the SDK software still manages to communicate with it.

Here is the dmesg output

[694508.974929] usb 1-5: new high-speed USB device number 97 using xhci_hcd
[694509.128851] usb 1-5: New USB device found, idVendor=0403, idProduct=6010, bcdDevice= 7.00
[694509.128862] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[694509.128866] usb 1-5: Product: PDM-IR InfraredSinglePhotonDetector
[694509.128870] usb 1-5: Manufacturer: MPD
[694509.128872] usb 1-5: SerialNumber: SN00197
[694509.135195] ftdi_sio 1-5:1.0: FTDI USB Serial Device converter detected
[694509.135244] usb 1-5: Detected FT2232H
[694509.135582] usb 1-5: FTDI USB Serial Device converter now attached to ttyUSB1
[694509.139100] ftdi_sio 1-5:1.1: FTDI USB Serial Device converter detected
[694509.139146] usb 1-5: Detected FT2232H
[694509.139468] usb 1-5: FTDI USB Serial Device converter now attached to ttyUSB2
[694509.149211] usbserial: USB Serial deregistering driver FTDI USB Serial Device
[694509.149508] ftdi_sio ttyUSB2: FTDI USB Serial Device converter now disconnected from ttyUSB2
[694509.149792] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
[694509.150298] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[694509.150328] usbcore: deregistering interface driver ftdi_sio
[694509.150370] ftdi_sio 1-5:1.1: device disconnected
[694509.150413] ftdi_sio 1-5:1.0: device disconnected
[694509.150448] ftdi_sio 1-4:1.0: device disconnected
[694509.182286] usbserial: USB Serial deregistering driver generic
[694509.182335] usbcore: deregistering interface driver usbserial_generic
[694509.209473] usbcore: registered new interface driver usbserial_generic
[694509.209495] usbserial: USB Serial support registered for generic
[694509.213800] usbcore: registered new interface driver ftdi_sio
[694509.213820] usbserial: USB Serial support registered for FTDI USB Serial Device
[694509.213887] ftdi_sio 1-4:1.0: FTDI USB Serial Device converter detected
[694509.213945] usb 1-4: Detected FT232R
[694509.215091] usb 1-4: FTDI USB Serial Device converter now attached to ttyUSB0
[694509.215173] ftdi_sio 1-5:1.0: FTDI USB Serial Device converter detected
[694509.215218] usb 1-5: Detected FT2232H
[694509.216348] usb 1-5: FTDI USB Serial Device converter now attached to ttyUSB1
[694509.216488] ftdi_sio 1-5:1.1: FTDI USB Serial Device converter detected
[694509.216601] usb 1-5: Detected FT2232H
[694509.216770] usb 1-5: FTDI USB Serial Device converter now attached to ttyUSB2
[694509.221685] usbserial: USB Serial deregistering driver FTDI USB Serial Device
[694509.221912] ftdi_sio ttyUSB2: FTDI USB Serial Device converter now disconnected from ttyUSB2
[694509.222064] ftdi_sio ttyUSB1: FTDI USB Serial Device converter now disconnected from ttyUSB1
[694509.222336] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[694509.222358] usbcore: deregistering interface driver ftdi_sio
[694509.222489] ftdi_sio 1-5:1.1: device disconnected
[694509.222741] ftdi_sio 1-5:1.0: device disconnected
[694509.222920] ftdi_sio 1-4:1.0: device disconnected
[694509.267652] usbserial: USB Serial deregistering driver generic
[694509.267670] usbcore: deregistering interface driver usbserial_generic

Here's what I've tried so far:

  1. Creating symlinks for other serial devices - didn't solve the issue.
  2. Removing the RUN+ command from the Udev rule. While this prevented the disconnection of other devices, the SDK software then failed to recognize and communicate with the FTDI device.
  3. After the removal of both modules (ftdi_sio and usbserial) by the Udev rule, I attempted to manually load them back. This did not work as other serial devices couldn't reconnect.

I'm at a bit of a loss. Is there a way to maintain this Udev rule (or a variation of it) that both allows the SDK to communicate with the FTDI device and doesn't interfere with other serial devices on the system?

0

There are 0 best solutions below