LinuxCommandLibrary

lsusb

List USB devices and their information

TLDR

List all the USB devices available

$ lsusb
copy

List the USB hierarchy as a tree
$ lsusb [[-t|--tree]]
copy

List verbose information about USB devices
$ lsusb [[-v|--verbose]]
copy

List detailed information about a USB device
$ lsusb [[-v|--verbose]] -s [bus]:[device number]
copy

List devices with a specified vendor and product ID only
$ lsusb -d [vendor]:[product]
copy

SYNOPSIS

lsusb [options]

PARAMETERS

-v, --verbose
    Show verbose details for all devices. This includes configuration descriptors, interfaces, endpoints, and class information. Useful for in-depth analysis.

-s [[bus]:[devnum]], --sysfs [[bus]:[devnum]]
    Show only devices for a specific bus and/or device number. For example, -s 001:003 lists device 3 on bus 1. -s 002: lists all devices on bus 2.

-t, --tree
    Show USB devices in a hierarchical tree-like format, reflecting their connection topology. This helps visualize the USB hub and device relationships.

-d vendor:product, --device vendor:product
    List only devices with the specified vendor and product IDs. These IDs are usually in hexadecimal format (e.g., 1234:5678).

-D device, --dump device
    Dump the contents of the device descriptor for the specified device file (e.g., /dev/bus/usb/001/003). This requires root privileges and provides raw descriptor data.

-V, --version
    Show version information for the lsusb utility.

-h, --help
    Display a help message and exit.

DESCRIPTION

The lsusb command is a utility in Linux used to display information about the USB (Universal Serial Bus) controllers and attached devices. It queries the kernel's USB device tree, typically by reading the `/sys/bus/usb/devices` directory, to provide a comprehensive list of all detected USB devices.

For each device, lsusb provides details such as the bus number, device number, unique ID (combining vendor and product IDs), and a descriptive name. This information is invaluable for system administrators and users alike when troubleshooting hardware issues, verifying device recognition, identifying specific USB peripherals, or diagnosing driver problems. It helps in understanding which devices are connected, their capabilities, and how the system perceives them, without needing to physically inspect each port.

CAVEATS

While lsusb generally provides accurate information, some detailed operations, like dumping raw device descriptors (using -D), may require root privileges. The human-readable names for vendor and product IDs are resolved using the /usr/share/hwdata/usb.ids or similar files; if this file is missing or outdated, only hexadecimal IDs will be shown.

INTERPRETING OUTPUT

The default output of lsusb typically presents each device on a new line with the format: Bus NNN Device NNN: ID VVVV:PPPP Device Name.

  • Bus NNN: Refers to the USB bus number.
  • Device NNN: Represents the device number on that specific bus.
  • ID VVVV:PPPP: Is the unique Vendor ID (VVVV) and Product ID (PPPP) assigned by the USB Implementers Forum (USB-IF). These hexadecimal IDs are used to identify the device and its manufacturer.
  • Device Name: A human-readable description of the device, resolved from the usb.ids file.

THE USB.IDS FILE

lsusb relies on the /usr/share/hwdata/usb.ids file (or a similar path depending on the distribution) to translate numerical Vendor and Product IDs into human-readable names. This file is a comprehensive list of known USB vendor and device IDs. It's periodically updated, and keeping it current ensures that lsusb can display meaningful names for newly released hardware.

HISTORY

The lsusb command is part of the usbutils package, which provides various utilities for managing USB devices on Linux. Its development has closely tracked the evolution of the Linux kernel's USB subsystem. Initially, it might have relied on parsing the /proc/bus/usb filesystem, but modern versions primarily query the /sys filesystem, which is the standard interface for kernel objects. This shift improved robustness and provided more consistent access to device information.

SEE ALSO

lspci(8), lshw(1), dmesg(1), udevadm(8)

Copied to clipboard