解决方法
你应该看看微软的
USBView.
它使用Windows API获取有关每个USB端口和每个设备的信息并显示它.此信息包括USB端口支持的速度和设备使用的速度.
您可以将其作为GUI运行,也可以使用这样的参数运行它,以使其将数据保存到文本文件中:
usbview /saveall:usb.txt
Is Port User Connectable: yes Is Port Debug Capable: no Companion Port Number: 1 Companion Hub Symbolic Link Name: USB#VID_0451&PID_8046#5&16bdd27b&0&22#{f18a0e88-c30c-11d0-8815-00a0c906bed8} Protocols Supported: USB 1.1: yes USB 2.0: yes USB 3.0: no Device Power State: PowerDeviceD0 ---===>Device Information<===--- English product name: "Logitech G930 Headset" ConnectionStatus: Current Config Value: 0x01 -> Device Bus Speed: Full (is not SuperSpeed or higher capable) Device Address: 0x09 Open Pipes: 1
USBView是开源的,甚至还有一个MSYS2软件包,所以你可以试用它而不需要编译任何东西.您也许可以从Microsoft找到预编译的二进制文件.
最简单的路径可能是从Python程序运行USBView并解析其文本输出.另一个选择是查看source code for USBView并以某种方式将其转换为Python或从中创建Python C扩展.