Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

342
Views
How to find a device node in /dev from physical USB port?

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

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!