I'm working with a Linux distribution (Raspbian) and I have two USB-Serial adapters which I'm connecting to the microcontroller. Whenever I connect both adapters, the serial ports "/dev/ttyUSB0" and "/dev/ttyUSB1" appear; here "/dev/ttyUSB0" is the adapter that was physically connected first (identified first by the system).
Now, I'm looking for a way to figure out which adapter is which in the event of a microcontroller restart. I.e., both adapters remained plugged into their USB ports and I can't physically unplug/replug to force which adapter is "USB0".
Basic research led me to these commands (pictures for reference):
ls /dev/ttyUSB* To list out the USB-serial ports that are active.
lsusb To get more information about the USB buses and connected devices.
Is there a way to relate these two results (or an alternative) to figure out what I need? For instance, in the pictures above "/dev/ttyUSB0" is "Bus 001 Device 008: ID 1a86:...", but how can I find that out through software (preferably using Python, but a shell script could work too)?


udevinfo -a -n /dev/ttyUSB0orudevadm info --a --name /dev/ttyUSB0- Ben Voigtudevinfocommand was updated toudevadm info. This looks promising; do you know if there's something equivalent in python. If not, I think I'll try python's subprocess module to run that bash command from within my application. - DanMicroS