3

Given two identical USB devices with the exact same USB descriptors and thus with absolutely no way to differentiate them only using the leaf information of the device information view (the USB device descriptor) as usually done (yes, this device is badly designed).

But since I am talking about a closed system, I thought I could solve the problem using the physical USB ports used to connect the devices. I can tell that one is plugged on the physical port #1 and the other is plugged on the physical port #2 of my motherboard's root usb hub. And lsusb gives me this information.

So now I need to be able to find the device node in /dev according to these two physical coordinates only. But when looking at sysfs, I can't find any link to this physical topology. Like if the sysfs usb tree was only a logical view of the physical's. And it seems sysfs usb devices names like /sys/bus/usb/devices/2-2.1 or /sys/bus/usb/devices/2-2.1/2-2.2 are dynamic and unpredictable.

I found this:

$ ls /dev/serial/by-path/ pci-0000:02:00.0-usb-0:2.1:1.0-port0@ 
pci-0000:02:00.0-usb-0:2.2:1.0-port0@

Should I write udev rules to freeze the pci and usb port names? Are they already predictable?

My final goal is to be able to write a udev rule to obtain predictable and frozen device's names according to the physical usb port used.

The solution could also apply to a PCI device.

Thanks

Julio Guerra
  • 5,523
  • 9
  • 51
  • 75

0 Answers0