If you want to find out the actual speed of the connection (as opposed to the capacities reported by lsusb), you can read the "speed" files from /sys/devices. Assuming you can connect and disconnect the device freely, you can use the following script to make the process semi-automatic. Another script to get a full list is described below.
- Unplug the device
- Start the script. It will ask to connect the device and press ENTER
- Connect the device
- Press ENTER
- The script reports the corresponding connection speed:
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-2/speed 480
Or:
/sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.3/2-3.3.1/speed 5000
Here are the possible speeds, in Mbit/s:
- 1.5 = USB 1.0/Low-Speed
- 12 = USB 1.1/Full-Speed
- 480 = USB 2.0/Hi-Speed
- 5000 = USB 3.0/SuperSpeed
- 10000 = USB 3.1/SuperSpeed
And here is the script. I call it usbspeed-get
:
#!/bin/bash
set -e
LIST1=`mktemp`
LIST2=`mktemp`
echo "Getting list of current devices..."
find /sys/devices -name speed | sort > "$LIST1"
echo -n "Now plug the relevant USB device and press ENTER..."
read dummy
find /sys/devices -name speed | sort > "$LIST2"
comm -3 "$LIST1" "$LIST2" | while read f ; do
echo -n "$f" " "
cat "$f"
done | column -t -s' '
rm "$LIST1" "$LIST2"
If you prefer to have an overview of all devices and according speeds, you can use the following script. I call it usbspeed-list
.
#!/bin/bash
sep="|"
find /sys/devices -name speed | grep usb | while read f ; do
dir=`dirname "$f"`
for name in speed manufacturer product ; do
cat "$dir/$name" 2>/dev/null | tr '\n' ' '
echo -n "$sep"
done
echo -n "$dir$sep"
echo
done | column -t --separator "$sep"
By default it will output the devices in the order they are found in /sys/devices. If you want to sort them by speed, you can combine it with sort -n
:
usbspeed-list | sort -n
1.5 Keyboard /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4.4/1-3.4.4.2
1.5 Texas Instruments TPS65983B /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.3/1-3.3.2
12 Silicon Laboratories EFM8 HID ISP /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.3/1-3.3.3
12 /sys/devices/pci0000:00/0000:00:14.0/usb1/1-14
480 GenesysLogic USB2.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4.4
480 GenesysLogic USB2.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4.4/1-3.4.4.4
480 Linux 5.19.0-38-generic xhci-hcd xHCI Host Controller /sys/devices/pci0000:00/0000:00:14.0/usb1
480 Sonix Technology Co., Ltd. USB2.0 Camera /sys/devices/pci0000:00/0000:00:14.0/usb1/1-8
480 USB2.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4/1-3.4.4/1-3.4.4.1
480 VIA Labs, Inc. USB2.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3
480 VIA Labs, Inc. USB2.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.3
480 VIA Labs, Inc. USB2.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.4
1000 /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.1/2-3.1:1.5/net/enx806d9711f2b1
5000 DisplayLink USB-C Triple-4K Dock /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.1
5000 Generic USB Storage /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.4/2-3.4.4/2-3.4.4.4/2-3.4.4.4.4
5000 GenesysLogic USB3.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.4/2-3.4.4
5000 GenesysLogic USB3.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.4/2-3.4.4/2-3.4.4.4
5000 Prolific Technology Inc. ATAPI-6 Bridge Controller /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2
5000 Seagate BUP Portable /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.2
5000 Space keys USB3.1 Storage Device /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.3/2-3.3.1
5000 VIA Labs, Inc. USB3.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3
5000 VIA Labs, Inc. USB3.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.3
5000 VIA Labs, Inc. USB3.0 Hub /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3.4
10000 Linux 5.19.0-38-generic xhci-hcd xHCI Host Controller /sys/devices/pci0000:00/0000:00:14.0/usb2
Here the keyboard is connected at a very low speed (1.5), which is normal, and the USB hard disk dock (ATAPI-6 Bridge Controller) is connected at 5000MBit/s.
Another way to list the devices and their speed is the "usb-devices" script provided by usbutils and installed by default by some distributions. It is more generic but also very verbose. It reports the speed on the first line of the device description:
T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 44 Spd=5000 MxCh= 0
D: Ver= 3.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1
P: Vendor=067b ProdID=2773 Rev=01.00
S: Manufacturer=Prolific Technology Inc.
S: Product=ATAPI-6 Bridge Controller
S: SerialNumber=0123456789000000005
C: #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=96mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
Make sure that you use a recent version. The version provided with Ubuntu 22.04 does not list all devices.