Skip to content
systemcoding.dev
Kernels

See Which Driver Is Bound to a USB Device With lsusb -t

Use lsusb -t on Linux 6.12 to see the USB topology, the speed of each port and the kernel driver bound to every interface, plus the sysfs files behind it.

6 min read
Summarize in AI
Flat illustration of user space above the system call boundary, the kernel and the hardware, with the Linux, GNU and C logos.

"Which driver has my device?" is the first question in almost every USB bug. A device that shows up in lsusb but does nothing usually has no driver bound, or the wrong one. The -t flag of lsusb answers the question in one screen: it prints the bus as a tree with the driver name on every interface. This post uses usbutils 018 on Linux 6.12, explains each column, and shows the sysfs files that the tool reads, so you can answer the same question in a script or on a minimal system without usbutils.

The reason the driver appears per interface and not per device is covered in the post on how USB works. In short, the kernel binds drivers to interfaces.

Read the tree

Run it without arguments:

Shell
lsusb -t
Text
/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/8p, 480M
    |__ Port 002: Dev 004, If 0, Class=Mass Storage, Driver=usb-storage, 480M
    |__ Port 005: Dev 006, If 0, Class=Video, Driver=uvcvideo, 480M
    |__ Port 005: Dev 006, If 1, Class=Video, Driver=uvcvideo, 480M
    |__ Port 005: Dev 006, If 2, Class=Audio, Driver=snd-usb-audio, 480M
    |__ Port 005: Dev 006, If 3, Class=Audio, Driver=snd-usb-audio, 480M
/:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 10000M

Each line starting with /: is a root hub, which is the host controller itself. Its driver is xhci_hcd, and the /8p suffix says the controller exposes eight ports. Bus 2 is the SuperSpeed side of the same controller, which is why it reports 10000M and bus 1 reports 480M. A modern xHCI controller presents one bus per speed class.

Below the root hub, every row is one interface of one device. The columns are, in order:

ColumnMeaning
Port 005The port on the parent hub where the device sits
Dev 006The device address on this bus, which changes on every plug
If 2The interface number inside the active configuration
Class=AudioThe interface class, not the device class
Driver=snd-usb-audioThe kernel driver bound to that interface
480MThe negotiated speed in megabits per second

The camera on port 5 makes the point. It has four interfaces, and two different drivers share them: uvcvideo owns the two video interfaces, and snd-usb-audio owns the two audio ones. One address, two drivers.

What an unbound interface looks like

When no driver claims an interface, the driver column reads [none]:

Text
/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/8p, 480M
    |__ Port 003: Dev 007, If 0, Class=Vendor Specific Class, Driver=[none], 12M

This is the signal you are looking for. Three causes account for nearly all of it:

  1. The driver module is not installed or not built for this kernel. Class Vendor Specific Class with no driver usually means the vendor driver is missing.

  2. The module exists but does not list this vendor and product ID, for example a newer revision of the chip.

  3. Something unbound it on purpose, such as a udev rule, usbip, vfio, or a manual write to the unbind file.

To tell the first two apart, read the device ID with lsusb, then ask the module database whether any module claims that ID. The modalias of the interface is exactly the string that modprobe uses to choose:

Shell
cat /sys/bus/usb/devices/1-3:1.0/modalias
modprobe --resolve-alias "$(cat /sys/bus/usb/devices/1-3:1.0/modalias)"
Text
usb:v1A86p7523d0264dcFFdscFFdpFFicFFisc01ip02in00
ch341

If the second command prints a module name, a driver exists and you need to load it (sudo modprobe ch341), or find out why udev did not. If it prints nothing, no installed module claims that ID.

The same answer from sysfs

lsusb -t is a view over sysfs, and the files are easy to read directly. For any interface, the driver entry is a symbolic link to the bound driver:

Shell
readlink /sys/bus/usb/devices/1-2:1.0/driver
Text
../../../../../../../bus/usb/drivers/usb-storage

The last path component is the driver name. When the link does not exist, no driver is bound. In a script, test for the link rather than parsing the tool output:

Shell
for intf in /sys/bus/usb/devices/*:*; do
    if [ -e "$intf/driver" ]; then
        printf '%s %s\n' "$(basename "$intf")" "$(basename "$(readlink "$intf/driver")")"
    else
        printf '%s none\n' "$(basename "$intf")"
    fi
done
Text
1-0:1.0 hub
1-2:1.0 usb-storage
1-3:1.0 none
2-0:1.0 hub

The format of the entries is described in the kernel's sysfs ABI for USB and in the USB core documentation. The loop works on a stripped-down embedded system with only BusyBox, where lsusb often prints only a short form without the -t option.

Change the binding by hand

The same directory lets you move an interface from one driver to another without unplugging. Every USB driver has bind and unbind files under /sys/bus/usb/drivers/<name>/. The identifier you write is the interface name:

Shell
echo -n "1-2:1.0" | sudo tee /sys/bus/usb/drivers/usb-storage/unbind
echo -n "1-2:1.0" | sudo tee /sys/bus/usb/drivers/usb-storage/bind
Text
1-2:1.01-2:1.0

Because of -n, tee echoes each name without a newline, so the two echoes run together on one line. The first command detaches the interface: the drive disappears from /dev immediately, and lsusb -t shows Driver=[none] for it. The second line asks the same driver to bind it again, which calls its probe and brings the drive back. To hand an interface to a different driver, write its name to that driver's bind file instead, and list /sys/bus/usb/drivers on your system for the names that exist. A driver accepts the request only if its id_table matches the interface, or if you taught it the ID through new_id first.

A permanent rule belongs in udev or in a driver's new_id file, not in a boot script. new_id lets you teach an existing driver a vendor and product pair it does not list:

Shell
echo "1a86 7523" | sudo tee /sys/bus/usb/drivers/ch341/new_id

The entry lasts until reboot. If the driver then binds, add the ID to a modprobe or udev rule so it survives, and consider sending a patch upstream, since an ID missing from a driver is a common and welcome patch.

When the tree misleads

The tree shows the state at this moment, and three situations make it look wrong.

A device with several configurations shows only the active one. If the interface you expect is in another configuration, it will not appear at all, and the fix is to select the configuration with bConfigurationValue.

A hub that failed to power a port shows nothing for the device, because enumeration never finished. The kernel log has the story, with lines such as device descriptor read/64, error -71. The tree cannot show a device that never got an address.

A driver that binds, then fails in probe, leaves the interface unbound and logs the reason. The tree reads [none], so a [none] result always deserves a look at dmesg before you decide the driver is missing.

A habit worth building

When a USB device is reported as "not working", run lsusb -t before anything else and look at three things in this order: whether the device appears at all, whether its speed matches what the cable and port should give, and whether every interface has a driver. Each check removes a whole class of causes. A missing device points at power, cable or hub trouble. A wrong speed points at the cable or port. A missing driver points at software. Only after those three do the kernel log and a packet capture become the useful tools, and by then you know which of them to open.

Also inHardware
Share

Keep reading

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.