简体   繁体   English

如何获取USB设备是连接到USB3.0还是USB2.0端口

[英]How to fetch whether a USB device is connected to USB3.0 or USB2.0 port

I just want to know how to find a usb device is connected to USB3.0 or USB2.0 port in windows as well as linux. 我只想知道如何在Windows和Linux中找到连接到USB3.0或USB2.0端口的USB设备。 FYI, I am using libusbK in WINDOWS and in libusb in LINUX is used to access usb device. 仅供参考,我在WINDOWS中使用libusbK,在LINUX中的libusb中用于访问USB设备。 Is there any api's or any techniques available to fetch the said information? 是否有任何api或任何可用技术来获取所述信息?

Eg: If a usb device is connected to USB3.0, i should be able to tell the user that usb device is connected to USB3.0 port. 例如:如果将USB设备连接到USB3.0,我应该能够告诉用户USB设备已连接到USB3.0端口。

Is it not possible to fetch the USB details as mentioned above? 如上所述,无法获取USB详细信息吗?

Thanks in Advance. 提前致谢。

The USB Specification Number which device complies is encoded in the field bcdUSB of the device descriptor. 设备遵循的USB规范编号编码在设备描述符的字段bcdUSB中。

In libusb you got that information on the struct libusb_device_descriptor libusb您在struct libusb_device_descriptor结构上获得了该信息

In libUSBK you gat that in the struct USB_DEVICE_DESCRIPTOR libUSBK您可以在结构USB_DEVICE_DESCRIPTOR中进行设置

It should be easy to access them :) 访问它们应该很容易:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM