Udev rules for Quad Serial Adapter FT-4232H

After running out of available serial ports for sniffing purposes I ordered a 4-port serial adapter with FTDI FT-4232H chip. That is basically an USB-RS232 adapter with four ports built into one device. That should be sufficient to run slsnif or jpnevulator in order to debug or reverse engineer serial protocols. After plugging the device there is the usual gambling about which device has what device name. For standard FT-232 chips I have some custom udev rules that create symlinks for various purposes. That should also happen to this quad port adapter.

So after plugging and fiddling around I found out that each of the four serial ports has an attribute called “bInterfaceNumber”. That should generally be usable to distinguish is identify each of the ports. However udev rules are somewhat difficult to create for me. Several tries failed. But after some research I found a solution that works. It is based on information from [1] on stackexchange. In the end it worked with:

# FT4232H
SUBSYSTEMS=="usb", ENV{.LOCAL_ifNum}="$attr{bInterfaceNumber}"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="FTZ0BJFH", ENV{.LOCAL_ifNum}=="00",  SYMLINK+="QuadSerialA", GROUP="dialout", MODE="0660"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="FTZ0BJFH", ENV{.LOCAL_ifNum}=="01",  SYMLINK+="QuadSerialB", GROUP="dialout", MODE="0660"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="FTZ0BJFH", ENV{.LOCAL_ifNum}=="02",  SYMLINK+="QuadSerialC", GROUP="dialout", MODE="0660"
SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ATTRS{serial}=="FTZ0BJFH", ENV{.LOCAL_ifNum}=="03",  SYMLINK+="QuadSerialD", GROUP="dialout", MODE="0660"

That leaves us with four symlinks pointing to the actual devices and names as /dev/QuadSerialA through /dev/QuadSerialD.

References

[1] http://unix.stackexchange.com/questions/60154/udev-rule-file-for-modem-not-working