English 中文(简体)
USB Port Speed Linux [closed]
原标题:

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

Closed 9 years ago.

The community reviewed whether to reopen this question 7 months ago and left it closed:

Original close reason(s) were not resolved

How to programatically determine the usb port speed in embedded devices running the Linux kernel?

最佳回答

You can read /sys/bus/usb/devices/usb?/speed - it ll give you the bus speed of the root hub(s) in Mbps: either 1.5, 12, 480, 5000 or 10000. The first two indicate USB1 (low speed or full speed), the third USB2 and the fourth and fifth USB3.

问题回答

This rather depends on were the code that needs the information is running. If you want to modify a kernel USB device drivers behavior based on connection speed then the usb_device struct that passed to the driver by the USB subsystem contains a speed enumeration. If you want an application in user space to detect the devices connection speed then try walking the /sys/bus/usb tree you should be able to identify your USB device by checking the idProduct and idVendor entries. Once you have a match then the speed entry will give you what you need. If you have multiple devices connected then you might need to figure a way to match USB id to specific device. Generally USB to device mappings vary on any hot plug support present whether the device supplies a serial number and the sub system that abstracts the functionality provided by the USB device.





相关问题
Question about Process communication over USB cable

I have some questions regarding communication over USB cable in Linux, in a Host-Target Device environment.(USB2.0) Please help as we are stuck for the below imiplementation. We have a host PC ...

Turn on PC with USB-device

I want to be able to turn my PC on and off using an IR-remote sensor that is connected via USB to the PC. The sensor is a custom PCB implemented with an AVR microprocessor and V-USB software USB-...

Is there software or code to alter USB power output

I had a look at this and this but no one sounded particularly sure of their ideas and I m kind of after a different thing anyway. I want to hook my usb power cables (red and black) up to my phone so I ...

Monitor USB traffic

I want to view all traffic going out the USB, with the potential to block data transactions to/from the USB based on content policy. How would this be done? Any way to achieve this in C#, or is it ...

热门标签