Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

355
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda