17

I have a nearly common Linux machine here. So, it has a PCI (*-X, etc) bus, on that some USB controllers, and I have USB devices on these USB controllers. Similar to this:

$ lspci|grep USB
00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
00:16.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:16.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
02:00.0 USB controller: VIA Technologies, Inc. VL805 USB 3.0 Host Controller (rev 01)

And, there is also an usb device tree, as this:

$ lsusb -t
/:  Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/4p, 12M
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/2p, 12M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/5p, 12M
    |__ Port 5: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/5p, 12M
    |__ Port 2: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 2: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 3: Dev 12, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 4: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 4: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/4p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/5p, 480M
    |__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
        |__ Port 1: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
        |__ Port 4: Dev 11, If 0, Class=Vendor Specific Class, Driver=r8712u, 480M
    |__ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=MOSCHIP usb-ethernet driver, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/5p, 480M
    |__ Port 1: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M
    |__ Port 1: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M
    |__ Port 1: Dev 6, If 2, Class=Audio, Driver=snd-usb-audio, 480M
    |__ Port 1: Dev 6, If 3, Class=Audio, Driver=snd-usb-audio, 480M

So, I see my USB controllers on the PCI bus, and also my USB devices on the USB controllers.

But I don't know, which USB controller number (on the USB bus) belongs to which PCI bus number!

How to find that?

0

3 Answers 3

13

This information can be retrieved from the iSerial entry of the verbose output of the lsusb. Easiest is to pass the output to the the less viewer and search manually with /, or for example with grep:

$ lsusb -v 2>/dev/null | grep '^Bus\|iSerial'

Bus 001 Device 029: ID 12d1:1506 Huawei Technologies Co., Ltd. Modem/Networkcard
  iSerial                 0 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  iSerial                 1 0000:00:1d.7
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  iSerial                 1 0000:00:1d.3
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
  iSerial                 1 0000:00:1d.2
...
3
  • 1
    less -piSerial ;-) May 15, 2016 at 18:04
  • Apparently lsusb when used in lsusb -v | grep iSerial dislikes to see anything else on the command line, resulting in: Couldn't open device, some information will be missing followed by the iSerial .... The remedy is to use the 2>/dev/null garbage can.
    – not2qubit
    Mar 1, 2017 at 16:36
  • 2
    How do you interpret a value of iSerial 0 or iSerial 3 NA7DE4PN? (these don't appear to be PCI slot identifiers)
    – Alexander
    Jun 25, 2021 at 23:10
3

There is a tool lsusb.py in usbutils (since version 002) which shows this information right away:

strohel@mat480s ~ $ lsusb.py -ciu
usb1              1d6b:0002 09 1IF  [USB 2.00,   480 Mbps,   0mA] (xhci-hcd 0000:00:14.0) hub
  1-2               046d:c069 00 1IF  [USB 2.00,   1.5 Mbps,  98mA] (Logitech USB Laser Mouse)

Here the 0000:00:14.0 is the PCI bus ID of the controller:

strohel@mat480s ~ $ lspci | grep 00:14.0
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
1

Another more GUI friendly option for those with a more visual learning style:

sudo lshw -html > /tmp/lshw.html

Then open this in a browser:

xdg-open /tmp/lshw.html  # Opens in default browser

# OR your favorite browser:
google-chrome /tmp/lshw.html

firefox /tmp/lshw.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.