Seeing the speed of your USB devices under Linux the easy way
As we all sadly know, USB comes in a bewildering variety of connectors, standards, and especially speeds that range from very nice to sadly pathetic. USB 1.0 and 1.1 are 12 Mbps, USB 2.0 is 480 Mbps, USB 3.0 (aka 'USB 3.1 gen 1') is 5 Gbps, USB 3.1 (aka 'USB 3.1 gen 2') is 10 Gbps, USB 3.2 is 20 Gbps, and 'USB4' is 40 Gbps. Or at least those are the specification rates; my cynical side suspects that, say, not all devices labeled as 'USB 3.0' actually do 5 Gbps. In addition, in order to get that speed you need to plug your high speed device into a USB port and chain (if you're using a hub) that supports the speed end to end.
All of this makes it rather interesting to know what actual data
rates you're getting (or at least that have been negotiated) with
your USB devices. It turns out that there is an easy way to do this
under Linux, in the form of '
lsusb -tv'. Normally, lsusb is either
not informative enough or too informative, but -tv (tree view
with one level of verbosity) tells you just enough to decode
; lsusb -tv /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 5000M ID 1d6b:0003 Linux Foundation 3.0 root hub |__ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=ax88179_178a, 5000M ID 0b95:1790 ASIX Electronics Corp. AX88179 Gigabit Ethernet [...]
(usb-devices may in some cases give you additional useful information, since it seems to give slightly different identification for devices.)
That output is from my work laptop with a USB Gigabit Ethernet adapter plugged in. As we would hope, this is at USB 3.0 data rates, although that might be because of the hub or the device itself.
Looking at actual reported USB speeds on my home desktop and my work desktop leave me somewhat puzzled. Both of them theoretically have a number of USB 3.0 ports and certainly they have blue USB-A ports, which normally indicates USB 3.0, and I have most things plugged into them. However, 'lsusb -tv' says that everything I have connected is on hubs at 480M. This is where my lack of knowledge of how USB behaves in practice is showing, because I'm not sure I have anything connected that would ask for more than USB 2.0 speeds.
Some experimentation with my laptop's Ethernet adapter and some reading has given me the answer, which is that USB 3.0 hosts (including hubs, I think) have both a USB 3.0 controller and a separate USB 2.0 controller (see the end of the System Design section of the Wikipedia USB article, via). Since I don't have any USB 3.0 devices connected, all of my USB 3.0 ports (and the USB 3.0 hub) are all only using their USB 2.0 side.
(I don't know if there's any way in Linux to figure out which USB devices are the paired 3.0 and 2.0 sides of one actual thing.)
PS: As part of looking into this I discovered (and verified) that my webcams are USB 2.0. I guess it's fast enough for 1080p.
PPS: Another source of speed information is in sysfs, as /sys/bus/usb/devices/usb*/speed, but I don;t know how you match up what device is what. I'm flailing around in the dark, which is why I was happy to stumble over 'lsusb -tv'.
Sidebar: An example of a 480M hub and a lower speed connection
Taken from my work machine, this is the keyboard (directly connected to a back panel USB port).
; lsusb -tv [...] /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M ID 1d6b:0002 Linux Foundation 2.0 root hub |__ Port 3: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M ID 04d9:0169 Holtek Semiconductor, Inc. |__ Port 3: Dev 2, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M ID 04d9:0169 Holtek Semiconductor, Inc. [...]
I don't know why the keyboard has two interfaces, but presumably there is a USB reason. I have a Bluetooth dongle with four, although only three of them list 'Driver=btusb' and the fourth has a blank driver.
Comments on this page:Written on 10 May 2022.