Universal Serial Bus (USB) is designed as a standard for connecting computer peripherals, such as keyboards, mice, printers, digital cameras, portable media players, disks and network adapters-Source: Wikipedia
It has become an industrial standard, and it is hard to see a computer without USB ports. The use of USB flash memory makes it more popular. In Linux, lsusb can be used to list USB devices and their properties.
What is lsusb
In its manual, lsusb is defined:
A tool that displays information about the USB bus in the system and connected to the system.
How to run lsusb? To run lsusb, you can enter lsusb directly on the console.
$ lsusbBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 002 Device 003: ID 17ef:4811 Lenovo Integrated Webcam [R5U877]Bus 008 Device 002: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Lsusb will display the driver and the device that is internally connected to your system.
The following describes how to understand the output. I captured the last line output above:
Bus 008 Device 002 : ID 0a5c:217f Broadcom Corp. Bluetooth Controller
- Bus 008: Specify which Bus the device is connected)
- Device 002: indicates that this is the second Device connected to the bus.
- ID: the ID of the device.
- Broadcom Corp. Bluetooth Controller: manufacturer name and device name
We can also see that both the USB 1.1 root hub driver and USB root hub driver are used in our system.
You can also see the dmesg command. The following is an example.
$ dmesg |grep -i usb[ 0.353138] usbcore: registered new interface driver usbfs[ 0.353150] usbcore: registered new interface driver hub[ 0.353182] usbcore: registered new device driver usb[ 0.730026] ehci_hcd: USB 2.0 ‘Enhanced’ Host Controller (EHCI) Driver[ 0.730116] ehci_hcd 0000:00:1a.7: new USB bus registered, assigned bus number 1[ 0.748019] ehci_hcd 0000:00:1a.7: USB 2.0 started, EHCI 1.00[ 0.748169] hub 1-0:1.0: USB hub found[ 0.748336] ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 2[ 0.768019] ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00[ 0.768147] hub 2-0:1.0: USB hub found[ 0.768236] ohci_hcd: USB 1.1 ‘Open’ Host Controller (OHCI) Driver[ 0.768251] uhci_hcd: USB Universal Host Controller Interface driver
How to list USB details
Enable it with the-v option. The following is an example.
$ lsusb -vInterface Descriptor:bLength 9bDescriptorType 4bInterfaceNumber 1bAlternateSetting 5bNumEndpoints 2bInterfaceClass 224 WirelessbInterfaceSubClass 1 Radio FrequencybInterfaceProtocol 1 BluetoothiInterface 0Endpoint Descriptor:bLength 7bDescriptorType 5bEndpointAddress 0×83 EP 3 INbmAttributes 1Transfer Type IsochronousSynch Type NoneUsage Type DatawMaxPacketSize 0×0040 1x 64 bytesbInterval 1Endpoint Descriptor:bLength 7bDescriptorType 5bEndpointAddress 0×03 EP 3 OUTbmAttributes 1Transfer Type IsochronousSynch Type NoneUsage Type DatawMaxPacketSize 0×0040 1x 64 bytesbInterval 1
Find out how many USB devices are connected
Use the following command
$ find /dev/bus
Then you will see the following output:
/dev/bus/dev/bus/usb/dev/bus/usb/008/dev/bus/usb/008/002/dev/bus/usb/008/001/dev/bus/usb/007/dev/bus/usb/007/001/dev/bus/usb/006/dev/bus/usb/006/001/dev/bus/usb/005/dev/bus/usb/005/001/dev/bus/usb/004/dev/bus/usb/004/001/dev/bus/usb/003/dev/bus/usb/003/001/dev/bus/usb/002/dev/bus/usb/002/004/dev/bus/usb/002/003/dev/bus/usb/002/001/dev/bus/usb/001/dev/bus/usb/001/001
You can use the-D option of the lsusb command to print the details of a specific device. The following is an example of a bluetooth device.
$ lsusb -D /dev/bus/usb/008/002Device: ID 0a5c:217f Broadcom Corp. Bluetooth ControllerCouldn’t open device, some information will be missingDevice Descriptor:bLength 18bDescriptorType 1bcdUSB 2.00bDeviceClass 224 WirelessbDeviceSubClass 1 Radio FrequencybDeviceProtocol 1 BluetoothbMaxPacketSize0 64idVendor 0x0a5c Broadcom Corp.idProduct 0x217f Bluetooth ControllerbcdDevice 3.60iManufacturer 1iProduct 2iSerial 3bNumConfigurations 1Configuration Descriptor:bLength 9bDescriptorType 2wTotalLength 216bNumInterfaces 4bConfigurationValue 1iConfiguration 0bmAttributes 0xe0Self PoweredRemote WakeupMaxPower 0mAInterface Descriptor:bLength 9bDescriptorType 4bInterfaceNumber 0bAlternateSetting 0bNumEndpoints 3bInterfaceClass 224 WirelessbInterfaceSubClass 1 Radio FrequencybInterfaceProtocol 1 BluetoothiInterface 0Endpoint Descriptor:bLength 7bDescriptorType 5bEndpointAddress 0×81 EP 1 INbmAttributes 3Transfer Type InterruptSynch Type NoneUsage Type DatawMaxPacketSize 0×0010 1x 16 bytesbInterval 1Endpoint Descriptor:bLength 7bDescriptorType 5bEndpointAddress 0×82 EP 2 INbmAttributes 2Transfer Type BulkSynch Type NoneUsage Type DatawMaxPacketSize 0×0040 1x 64 bytesbInterval 1Endpoint Descriptor:bLength 7bDescriptorType 5bEndpointAddress 0×02 EP 2 OUTbmAttributes 2Transfer Type BulkSynch Type NoneUsage Type DatawMaxPacketSize 0×0040 1x 64 bytesbInterval 1
Identify large-capacity storage devices
Since lsusb-v gives us detailed information, you may miss some information. We can use the grep command to specify specific information.
A large-capacity storage device has a supplier name and ID. We can use it as a starting point.
$ lsusb -v |grep -Ei ‘(idVendor|Mass\ Storage)’idVendor 0×1005 Apacer Technology, Inc.bInterfaceClass 8 Mass Storage
As you can see, our system has a USB large capacity storage device from Apacer Technology, Inc.
Output USB device in tree hierarchy
Use the-t option to meet this requirement.
$ lsusb -t/: Bus 08.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M/: Bus 07.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M/: Bus 06.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M/: Bus 05.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M/: Bus 04.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M/: Bus 03.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M/: Bus 02.Port 1: Dev 1, Class=root\_hub, Driver=ehci_hcd/6p, 480M|__ Port 1: Dev 4, If 0, Class=stor., Driver=usb-storage, 480M|__ Port 6: Dev 3, If 0, Class=’bInterfaceClass 0x0e not yet handled’, Driver=uvcvideo, 480M|__ Port 6: Dev 3, If 1, Class=’bInterfaceClass 0x0e not yet handled’, Driver=uvcvideo, 480M/: Bus 01.Port 1: Dev 1, Class=root\_hub, Driver=ehci_hcd/6p, 480M
The numbers 12 M and 480 M indicate the transmission rate of the USB type.
- 12 M means that the speed of USB 1.0/1.1 is 12 Mbit/s.
- 480 M means that the speed of USB 2.0 is 480 Mbit/s.
If you find 5.0 GB, it means you have a USB 3.0 interface. It has a transmission rate of 5.0 Gbit/s. Linux/var/lib/usbutils/usb. ids identifies detailed information about USB devices. Or you can access the Linux-USB.org to get the latest list of USB IDs.
These are the basis of lsusb commands. You can use the lsusb command to diagnose a USB device on your system. Generally, you can use the lsusb manual to explore more details about commands. Enter man lsab to open its manual.
Recommended reading:
Ln command notes in Linux
Linux ln command details
Linux ln command instructions
Linux ln command parameters and usage --- Linux connection file or directory command
Precautions for Linux ln commands