How to match a ttyUSBX device to a USB Serial device

If you have FTDI based adapters you can often edit the device id’s and utilize that in the udev rules too, so for example if you have multiple devices the same (FTDI based) they are given both a recognizable prefix and a unique ref that doesn’t change regardless of connection order etc.

See Does the emonTx Shield need an actual Arduino? - #21 by pb66 for example and context.

Here’s the udev rule I use with all my USB connected emonTx’s (usually 3+ per install)

pi@emonBase24(ro):~$ cat /etc/udev/rules.d/09-pb66.rules
SUBSYSTEMS=="usb", ATTRS{product}=="emonTx*",   ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403", SYMLINK+="emonTX-$attr{serial}"

and 3 connected emonTx USB devices listed by ls

pi@emonBase24(ro):~$ ls -la /dev/emonTX*
lrwxrwxrwx 1 root root 7 Dec  5  2017 /dev/emonTX-N1110RBF -> ttyUSB2
lrwxrwxrwx 1 root root 7 Dec  5  2017 /dev/emonTX-N212X7O2 -> ttyUSB1
lrwxrwxrwx 1 root root 7 Dec  5  2017 /dev/emonTX-N3Z3VPD -> ttyUSB0

there is a free windows “FT_PROG” utility available from FTDI to edit the ID (and other stuff) (https://www.ftdichip.com/Support/Utilities.htm#FT_PROG)

[EDIT]

Interesting choice to name your FTDI device “CH340” and the other one “FTDI”, that might prove confusing at some point down the line. :grin:

Here’s the vendor:product id’s of the above mentioned 3 FTDI emonTx’s

pi@emonBase24(ro):~$ lsusb
Bus 001 Device 006: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 005: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

notice the vendor:product id’s are the same for the your FTDI usb~rs485 and my FTDI usb~serial programmer.

and here’s one of those cheap rs485 usb adapters on a local Pi (top of the list)

pi@raspberrypi:~ $ lsusb
Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

the second one down is an old style (full USBA) OEM shop bought programmer.