I have a Linux machine with a connected USB hub (5 ports), and I also have a serial hub (8 serial ports) connected to this USB hub. It looks as follows:
Linux -> usb hub -> usb-serial hub -> serial device
If I now run
ls -la /sys/bus/usb-serial/devices, I see the following output:
ttyUSB0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb8/8-3/8-3.1/8-3.1.1/8-3.1.1:1.0/ttyUSB0 ttyUSB1 -> ../../../devices/pci0000:00/0000:00:1d.0/usb8/8-3/8-3.1/8-3.1.1/8-3.1.1:1.0/ttyUSB1 ttyUSB2 -> ../../../devices/pci0000:00/0000:00:1d.0/usb8/8-3/8-3.1/8-3.1.1/8-3.1.1:1.0/ttyUSB2 ttyUSB3 -> ../../../devices/pci0000:00/0000:00:1d.0/usb8/8-3/8-3.1/8-3.1.1/8-3.1.1:1.0/ttyUSB3 ttyUSB4 -> ../../../devices/pci0000:00/0000:00:1d.0/usb8/8-3/8-3.1/8-3.1.2/8-3.1.2:1.0/ttyUSB4 ttyUSB5 -> ../../../devices/pci0000:00/0000:00:1d.0/usb8/8-3/8-3.1/8-3.1.2/8-3.1.2:1.0/ttyUSB5 ttyUSB6 -> ../../../devices/pci0000:00/0000:00:1d.0/usb8/8-3/8-3.1/8-3.1.2/8-3.1.2:1.0/ttyUSB6 ttyUSB7 -> ../../../devices/pci0000:00/0000:00:1d.0/usb8/8-3/8-3.1/8-3.1.2/8-3.1.2:1.0/ttyUSB7
I can "decrypt" this path as follows: in bus number 8, 3rd USB port I connect my USB hub and in first USB port on this hub I connect my serial hub. This is OK.
But how can I identify the specific serial port in this USB serial hub? For example, if I unplug the device from serial port 1 (ttyUSB0) and plug it in again, it will have a ttyUSB8, or next free number, 9,10,11... But how I can get the specific serial port number which my new ttyUSB device is plugged into ?