It rather depends on the code that needs the information. If you want to change the behavior of USB device drivers based on the connection speed, then the usb_device structure passed to the driver by the USB subsystem contains an enumeration of the speed. If you want the application in user space to detect the connection speed of devices, try going through the / sys / bus / usb tree, you can identify your USB device by checking the idProduct and idVendor entries. Once you have a match, recording the speed will give you what you need. If you have multiple devices connected, you may need to specify how to map the USB ID on a specific device. Usually, USB device mappings vary depending on the support for any hot-plugging, regardless of whether the device contains a serial number and an auxiliary system that abstracts the functionality provided by the USB device.
Andrew Roca
source share