How to check what speed a USB device is trained to?

What command or where in Ubuntu can you check the speed that USB devices are trained? Not the capability of the USB device but the actual trained speed of the current link.

For example we I plug in a USB3.1 Gen2 (10Gbps) hub to my desktop but the signal integrity is bad (to much insertion loss from a long cable) the hub trains at USB3.1 Gen (5Gbps) instead of Gen2


Solution 1:

You have to run lsusb -t to get full tree of USB hubs.
Below is the example from my USB 3.0 capable laptop:

$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
   |__ Port 2: Dev 6, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
   |__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
   |__ Port 1: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
   |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
       |__ Port 5: Dev 126, If 0, Class=Video, Driver=, 12M
       |__ Port 5: Dev 126, If 1, Class=Video, Driver=, 12M
       |__ Port 6: Dev 5, If 0, Class=Wireless, Driver=btusb, 12M
       |__ Port 6: Dev 5, If 1, Class=Wireless, Driver=btusb, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
   |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
       |__ Port 4: Dev 3, If 0, Class=Vendor Specific Class, Driver=rtsx_usb, 480M

Above you can see 5000M hub port with USB 3.0 device - USB 3.0 flash.
Also there are slower devices with 480M and 12M speeds.

Solution 2:

The command sudo lsusb -v lists significant information about connected devices including speed capability. (Although I'm not sure if it lists actual speed.)

The sudo usbview command is a graphical browser, and one of the top items in its list seems to be the current speed of a device.