Linux lsusb Command

Linux 命令大全Linux Command Reference


What is the lsusb command?

lsusbIt is a useful command in the Linux system used to list all USB devices connected to the computer. It is the abbreviation of "list USB" and can display the USB bus and detailed information about its connected devices.

Command Purpose

  1. View the list of USB devices connected to the current system
  2. Get detailed information about USB devices (vendor ID, product ID, etc.)
  3. Diagnose USB connection issues
  4. Verify whether USB devices are correctly recognized by the system

Basic Syntax

lsusb [选项]

Common option parameter descriptions

Option Description
-v Display verbose output, including device descriptor information
-t Display the USB device hierarchy in a tree structure
-s [[bus]:][devnum] Only display devices with the specified bus and device number
-d [vendor]:[product] Only display devices with the specified vendor ID and product ID
-D 设备文件 Display detailed information of the specified device file
--help Display help information
--version Display version information

Basic Usage Examples

1. List all USB devices (basic usage)

Example

lsusb

Typical output example:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 8087:0a2b Intel Corp. 
Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Output explanation:

  • Bus XXX: USB bus number
  • Device XXX: Device number on that bus
  • ID XXXX:XXXX: Vendor ID:Product ID
  • Device description information

2. Display detailed information (-v option)

Example

lsusb -v

This command outputs very detailed USB device information, including:

  • Device descriptors
  • Configuration descriptors
  • Interface descriptors
  • Endpoint descriptors
  • USB protocol versions supported by the device
  • Device class, subclass, and protocol

Advanced Usage

1. Display USB device connection relationships in a tree structure

Example

lsusb -t

Example output:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 480M
    |__ Port 3: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 4: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M

2. Filter specific devices

Example

# Only display devices on bus 1
lsusb -s 1:

# Only display bus 1 device 3
lsusb -s 1:3

# Only display Logitech devices (via vendor ID:product ID)
lsusb -d 046d:

3. View specific device file information

Example

lsusb -D /dev/bus/usb/001/003

Practical Application Scenarios

1. Check whether the USB device is recognized

When a USB device is plugged in but cannot be used, first uselsusbto check whether the system recognizes the device.

2. Get the device ID for driver installation

Many Linux drivers need to know the device's vendor ID and product ID. This information can belsusbobtained.

3. Debug USB connection issues

By comparing thelsusboutput before and after plugging in the device, you can determine whether the device is correctly recognized.

4. View detailed USB device information

Use the-voption to get the device's detailed technical specifications, which is helpful for developing USB-related applications.


FAQ

Q1: Why doesn't my USB device appear in the lsusb output?

Possible reasons:

  1. The device has a physical connection problem
  2. USB port or hub failure
  3. Insufficient device power
  4. Kernel driver issues

Q2: How can I determine device speed from the lsusb output?

In the verbose output (lsusb -v), look for thebcdUSBfield:

  • 2.00: USB 2.0
  • 3.00: USB 3.0
  • 3.10: USB 3.1

Q3: How can I permanently save the lsusb output?

Example

lsusb > usb_devices.txt

Practical Exercises

  1. Plug in a USB device and observe thelsusboutput changes.
  2. Use the-doption to find devices from a specific vendor.
  3. Compare thelsusbandlsusb -voutput differences.
  4. Try using the-toption to understand the connection topology of USB devices.

Summary

lsusbIt is a simple but powerful tool that can help users and system administrators:

  • Quickly view connected USB devices
  • Get detailed device information
  • Diagnose USB-related issues
  • Provide necessary information for driver installation

Master thelsusbcommand, and you can manage and debug USB devices more efficiently in the Linux environment.

Linux 命令大全Linux Command Reference

Other Extensions