1

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 ?

  • Can you not extract the required information with "udevadm info" ? – Raman Sailopal Nov 30 '17 at 13:23
  • no, I do not see any usefull information after giving "udevadm info" command. I have a big output after that command, what kind of information (field e.t.c.) I need to search for ? I was thinking it will be something like: ttyUSB0 is mapped on ttyS3, or something like this. – treon Nov 30 '17 at 13:34
  • Try udevadm info -q path -n /dev/ttyXYZ. No, there's no fixed mapping. – dirkt Nov 30 '17 at 13:56
  • @dirkt I've tried your command for ttyUSB64 in our prod pc, I've got the following: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.1/2-1.6.1.3/2-1.6.1.3.1/2-1.6.1.3.1:1.0/ttyUSB64/tty/ttyUSB64 anyway, nothing useful. – treon Nov 30 '17 at 14:33
  • How is it not useful? You said you can decode the path, didn't you? Compare with lsusb -t. And no, I don't know why in the question it was on bus 8, and now it's on bus 2 - I don't know enough about your setup. – dirkt Nov 30 '17 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.