简体   繁体   English

识别相关的USB设备

[英]Identifying related USB devices

Is there a way using C# to identifying a device and associated child USB device(s)? 有没有一种使用C#识别设备和关联的子USB设备的方法? For example I have a USB Zebra printer with a card reader mounted on it, and wish to know the card reader's name and identifying details ie build up a tree of associated devices. 例如,我有一台安装有读卡器的USB Zebra打印机,并希望知道读卡器的名称和标识详细信息,即建立一棵关联设备的树。

USB Zebra Printer
---> USB Card Reader Name

Using a Powershell script I can see the devices I'm interested in; 使用Powershell脚本,我可以看到我感兴趣的设备。

gwmi Win32_USBControllerDevice |%{[wmi]($_.Dependent)} |
Sort Manufacturer,Description,DeviceID |
Ft -GroupBy Manufacturer Description,Service,DeviceID

Here's the output; 这是输出;

Powershell输出

Windows shows this information in the printer properties; Windows在打印机属性中显示此信息。

Windows USB设备树

这可能很有用,与这个家伙做的一样,并通过将它们与字符串/其他进行比较来分离设备: https : //stackoverflow.com/a/3331509/4424210

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

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