shell

usb 2.0 and usb 3.0: how to determine the version of a usb port and match it to a usb drive


I need to match the version of a usb port to a usb drive.

For example, I want to ensure that a usb drive, whose version is 3.0 for example, is connected to a computer via a usb 3.0 port for example.

I have an idea but I do not know how to implement it.

so, when I connect a USB drive to a computer, I can get information about the drive using lsusb, but what command can I use to find out whether the USB drive is connected to USB port 2.0 or USB port 3.0?

Can anyone please help me with this problem?

shell programming


Solution

  • I was able to find the answer after several days. for those interested: first of all, you need to execute the lsusb command, from there you write down the bus number of the device, as well as the number of the device. then you run "lsusb -t", from this command you can determine if you device is connected to a usb 3.0 or a usb 2.0 port. in the output of this command, look for the host controller interface (hci) of the bus where your device is connected. if it is xhci (extensible) then the device is connected to a usb 3.0 port, and if it is ehci (enhanced) then the device is connected to a usb 2.0 port. Cheers!