Sample Header Ad - 728x90

Can I relate a USB device from /sys to a particular USB connector from Dmidecode?

3 votes
1 answer
552 views
Having had a bit of an internet-scour, I think the answer may be "No", but: Can I find the USB port description (as per dmidecode) corresponding to the USB device from sysfs? We can enumerate all USB hubs and devices by listing /sys/bus/usb/devices. For example:
1 root root 0 May 18 09:36 1-0:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-0:1.0
lrwxrwxrwx 1 root root 0 May 18 09:40 1-2 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-2
lrwxrwxrwx 1 root root 0 May 18 09:40 1-2:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0
lrwxrwxrwx 1 root root 0 May 18 09:36 2-0:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb2/2-0:1.0
lrwxrwxrwx 1 root root 0 May 18 09:36 2-3 -> ../../../devices/pci0000:00/0000:00:14.0/usb2/2-3
lrwxrwxrwx 1 root root 0 May 18 09:36 2-3:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.0
lrwxrwxrwx 1 root root 0 May 18 09:36 usb1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1
lrwxrwxrwx 1 root root 0 May 18 09:36 usb2 -> ../../../devices/pci0000:00/0000:00:14.0/usb2
…And we can list all built-in USB ports on the machine by doing dmidecode -t connector. For example it shows (among many other connectors):
Handle 0x000D, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: USB REAR
	Internal Connector Type: Proprietary
	External Reference Designator: Rear: USB-1
	External Connector Type: Access Bus (USB)
	Port Type: USB

[...]

Handle 0x0014, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: USB 3.0 REAR
	Internal Connector Type: Proprietary
	External Reference Designator: Rear: USB 1
	External Connector Type: Access Bus (USB)
	Port Type: USB
(On my machine, it looks like each USB port appears twice, in the guise of "USB" and "USB 3.0".) I’d love to be able show the connector description ("Rear: USB 1") corresponding to a particular USB device— but there does not seem to be a reliable way to relate /sys/bus/USB devices to dmidecode connectors— Is there? (In my particular case, it would be tempting to relate "usb1" from the bus to "USB 1" from Dmidecode… but I’m willing to bet that that’s a coincidence.) Edit: Or if not dmidecode, some other tool which could provide an external description of the port.
Asked by andrewf (132 rep)
Jun 5, 2021, 04:14 PM
Last activity: Jun 5, 2021, 07:04 PM