According to hints in Documentation/ABI/stable/sysfs-bus-usb
, the general format is:
<bus>-<port[.port[.port]]>:<config>.<interface>
Each <busnum>
corresponds to a root hub.
It is followed by a series of hub port numbers separated by dots. Even if you don't have any external hubs, often there will be internal hubs. Use the lsusb.py
tool to see the topology in better detail (the script comes from the same "usbutils" as lsusb itself does).
The number following the :
shows the active configuration of that device. Some devices can be switched between multiple configurations (only one active at a time), with each providing different interfaces – e.g. 4G/LTE modems could be set to "AT mode" or "MBIM mode" or "QMI mode". (On Windows this is handed by the driver, on Linux it could be done manually via /sys.)
Finally, the number following .
shows the interface number. A USB device can provide multiple interfaces, e.g. a 4G modem would have a serial port + a virtual Ethernet interface, and a YubiKey NEO will have a HID device for U2F + a fake keyboard for legacy Yubikey OTP. Run lsusb.py -i
to see their names.
Example from a desktop, where you can see a keyboard having two HID interfaces for some reason (it would be more common for fancy 'gaming' keyboards):
# lsusb.py -I
usb1 1d6b:0002 09 1IF [USB 2.00, 480 Mbps, 0mA] (ehci_hcd 0000:00:1a.0) hub
1-0:1.0 (IF) 09:00:00 1EP (Hub::Full speed (or root) hub) hub
1-1 8087:0024 09 1IF [USB 2.00, 480 Mbps, 0mA] (Intel Corp. Integrated Rate Matching Hub) hub
1-1.1 1ea7:0064 00 1IF [USB 1.10, 12 Mbps, 100mA] (Wireless rechargeable vertical mouse)
1-1.1:1.0 (IF) 03:01:02 1EP (Mouse) usbhid hidraw1 (hid-generic) input7 input6 (hid-generic)
1-1.3 0951:1643 00 1IF [USB 2.00, 480 Mbps, 100mA] (Kingston DataTraveler G3)
1-1.3:1.0 (IF) 08:06:50 2EPs (Bulk-Only) usb-storage host6 (sdd)
1-1.6 413c:2113 00 2IFs [USB 1.10, 1.5 Mbps, 100mA] (Dell Computer Corp. KB216 Wired Keyboard)
1-1.6:1.0 (IF) 03:01:01 1EP (Keyboard) usbhid hidraw2 (hid-generic) input8 (hid-generic)
1-1.6:1.1 (IF) 03:00:00 1EP (None) usbhid hidraw3 (hid-generic) input9 input10 (hid-generic)
usb2 1d6b:0002 09 1IF [USB 2.00, 480 Mbps, 0mA] (ehci_hcd 0000:00:1d.0) hub
2-0:1.0 (IF) 09:00:00 1EP (Hub::Full speed (or root) hub) hub
2-1 8087:0024 09 1IF [USB 2.00, 480 Mbps, 0mA] (Intel Corp. Integrated Rate Matching Hub) hub
Example of a laptop's internal 4G modem, first in its startup default configuration 2 (Ethernet-emulation), then the exact same device after switching it to configuration 3 (MBIM):
# cat /sys/bus/usb/devices/1-3/configuration
2
# lsusb.py
usb1
1-3 03f0:a31d 00 7IFs [USB 2.00, 480 Mbps, 2mA] (HP Inc. HP lt4132 LTE/HSPA+ 4G Module)
1-3:2.0 (IF) 02:06:00 1EP (Communications) cdc_ether net/usb0
1-3:2.1 (IF) 0a:06:00 2EPs (CDC Data) cdc_ether
1-3:2.2 (IF) ff:06:10 3EPs (Vendor Specific) option ttyUSB0
1-3:2.3 (IF) ff:06:13 2EPs (Vendor Specific) option ttyUSB1
1-3:2.4 (IF) ff:06:12 2EPs (Vendor Specific) option ttyUSB2
1-3:2.5 (IF) ff:06:14 2EPs (Vendor Specific) option ttyUSB3
1-3:2.6 (IF) ff:06:1b 2EPs (Vendor Specific) option ttyUSB4
# echo 3 > /sys/bus/usb/devices/1-3/configuration
# lsusb.py
usb1
1-3 03f0:a31d 00 3IFs [USB 2.00, 480 Mbps, 2mA] (HP Inc. HP lt4132 LTE/HSPA+ 4G Module)
1-3:3.0 (IF) 02:0e:00 1EP (Communications) cdc_mbim net/wwan0
1-3:3.1 (IF) 0a:00:02 2EPs (CDC Data) cdc_mbim
1-3:3.2 (IF) ff:06:14 2EPs (Vendor Specific) option ttyUSB0