如何在 Windows 上确定 USB 端口版本? [英] How to determine USB port version on Windows?

查看:58
本文介绍了如何在 Windows 上确定 USB 端口版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行的是 Windows 7 和 Python 3.5.连接 USB 记忆棒后,我的目标是确定它连接的端口版本(2.0、3.0、3.1)以及 USB 记忆棒支持的 USB 版本.任何想法表示赞赏.

I'm running Windows 7 and Python 3.5. Once USB stick is connected, my goal is to identify what port version (2.0, 3.0, 3.1) is it connected to and what version of USB is supported by USB stick. Any thoughts are appreciated.

推荐答案

你应该看看 USBView 微软.

它使用 Windows API 来获取有关每个 USB 端口和每个设备的信息并显示它.此信息包括 USB 端口支持的速度和设备使用的速度.

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.

您可以将它作为 GUI 运行,也可以使用这样的参数运行它,使其将数据保存到文本文件:

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

以下是文本输出的片段,显示了您对我的 USB 耳机感兴趣的信息:

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 是开源的,甚至还有一个 MSYS2 软件包,因此您无需编译任何东西.您也可以从 Microsoft 找到预编译的二进制文件.

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.

最简单的方法可能是从 Python 程序运行 USBView 并解析其文本输出.另一种选择是查看 USBView 的源代码 并以某种方式将其转换为 Python 或从中制作 Python C 扩展.

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.

这篇关于如何在 Windows 上确定 USB 端口版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆