I have a number of USB ports on my computer, some USB 2 and some USB 3. I want to plug a device into a USB 3 port. Unfortunately, they're all black so I can't use the usual "USB 3.0 ports are blue" rule of thumb.
This is a Linux box, so is there any way to know if I've plugged the device into a USB 3 port, maybe using some command line utility or by inspecting some kernel messages?
13 Answers
You can determine the USB version by running lsusb
- 12M = 12MBit/s = USB1
- 480M = 480MBit/s = USB2
- 5000M = 5000MBit/s = USB3.0 aka USB3.1 gen. 1
- 10000M = 10000MBit/s = USB3.1 gen. 2
Try using something like:
lsusb -D /dev/bus/usb/002/005 The USB 2.00/3.00 corresponds to USB 2.0 / 3.0
Perhaps even try using lsusb -t
The first conversion chart will help you determine the USB version.
Take a look at THIS link for more examples.
3As @MarkHu and @Matthew noted, the currently accepted answer (lsusb -D) has the potential to be misleading, since it lists the speed(s) which are supported by the device, not the actual speed. Or, at least I couldn't use its output to find current device speed.
Does it matter whether it's a USB 3 port if it doesn't negotiate USB 3 speeds?
Looking at the actual speed on a Linux box is a bit of an hassle; lsusb doesn't seem to offer, right now, a solution out of the box. That's what I found to be working. First, list all your connected devices and hubs to identify your device:
> lsusb Bus 002 Device 003: ID 0424:2660 Microchip Technology, Inc. (formerly SMSC) Hub Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 004: ID 1058:25ee Western Digital Technologies, Inc. Bus 001 Device 003: ID 051d:0002 American Power Conversion Uninterruptible Power Supply Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub In my case, I'm looking at the speed for my external WD MyBook disk. Hence the interesting line is:
Bus 001 Device 004: ID 1058:25ee Western Digital Technologies, Inc. But, it seems that the "Bus 001 Device 004" part isn't useful to us in order to find the current device speed. Instead, we need the two colon-separated numbers 1058:25ee, the vendor id and product id for such device.
You should now check the /sys/devices directory for the contents of the idVendor file, looking for the vendor id from above (replace 1058 with your own vendor id)
> find /sys/devices/ -name idVendor -print -exec cat {} \; | grep -B 1 1058 ./pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/idVendor 1058 Now take the output path above here and replace idVendor with speed and look at its contents:
> cat ./pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/speed 480 This way you're discovering a 480Mbps USB 2.0 connection.
If you've got multiple connected devices, you may check idProduct contents as well. If you've got multiple identical devices, look for the contents of serial as well.
My experience is that the lsusb -D command can be a misleading if it reports "capabilities" not currently enabled by the type of jack into which your device is plugged. See below example of filtered output (the entire output of sudo lsusb -D ${USB_DEVICE_PATH} was 80+ lines). In the this example, I deduce bcdUSB 3.00 should imply Device can operate at SuperSpeed (5Gbps) --though that line was still present when I plugged in my drive to a USB 2 jack for comparison.
$ lsusb -D /dev/bus/usb/007/003 | egrep -i 'usb|speed|version|Mbps|gbps|id|speed' Device: ID 174c:1153 ASMedia Technology Inc. ASM2115 SATA 6Gb/s bridge bcdUSB 3.00 idVendor 0x174c ASMedia Technology Inc. idProduct 0x1153 ASM2115 SATA 6Gb/s bridge SuperSpeed USB Device Capability: wSpeedsSupported 0x000e Device can operate at Full Speed (12Mbps) Device can operate at High Speed (480Mbps) Device can operate at SuperSpeed (5Gbps) Lowest fully-functional device speed is Full Speed (12Mbps) Note also that the idProduct line contained some advisory/marketing text about 6Gb/s which should not be interpreted as an attainable speed.
Alternate short command that might be more useful:
$ sudo lsusb -t | egrep -i "storage" -B1 /: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M |__ Port 1: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M 1