How to determine USB port version on Windows?

大城市里の小女人 提交于 2019-12-05 17:52:21

You should look at USBView by Microsoft.

It uses Windows APIs to get information about each USB port and each device and display it. This information includes what speeds the USB port supports and speed the device is using.

You can run it as a GUI or you can run it with an argument like this to make it save its data to text file:

usbview /saveall:usb.txt

Here is a snippet of the text output showing the information you are interested in for my USB headset:

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 is open source and there is even an MSYS2 package for it so you can try it out without compiling anything. You might be able to find a precompiled binary from Microsoft too.

The easiest path might be to run USBView from your Python program and parse its text output. Another option would be to look at the source code for USBView and somehow convert that to Python or make a Python C extension out of it.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!