如何查询未在 USB Root Hub 中列出的 USB 设备 [英] How do I query for USB devices not listed in USB Root Hub

查看:24
本文介绍了如何查询未在 USB Root Hub 中列出的 USB 设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查询适用于 Win32_USBHub

SELECT * FROM Win32_USBHub WHERE DeviceID = '{0}'

这是代码上下文,

// Check if USB device is plugged in
string deviceQuery = String.Format("SELECT * FROM Win32_USBHub WHERE DeviceID = '{0}'", deviceID);
using (var searcher = new System.Management.ManagementObjectSearcher(deviceQuery))
    if (searcher.Get().Count == 0)
        MessageBox.Show(@"Device not detected");

但是,当设备未在通用串行总线控制器"中列出时,从 Win32_USBHub 查询不会返回我正在寻找的连接设备.

However when a device is not listed inside 'Universal Serial Bus controllers', querying from Win32_USBHub does not return the connected device I'm looking for.

是否有另一个表"可以从 Win32_USBHub 外部查询,其中包含我正在寻找的Cardio Perfect PRO-Link USB"设备?或者这会是一个自定义表"?

Is there another 'table' to query outside from Win32_USBHub which would contain device I'm looking for 'Cardio Perfect PRO-Link USB'? Or would this be a 'custom table'?

推荐答案

SELECT * FROM Win32_PnPEntity WHERE DeviceID = '{0}'

我想我搜索的时间不够长,这里有一个链接,其中包含很多非常好的示例...http://msdn.microsoft.com/en-us/library/aa394587%28v=vs.85%29.aspx

I guess I didn't search long enough, here's a link which contains a lot of really good examples... http://msdn.microsoft.com/en-us/library/aa394587%28v=vs.85%29.aspx

我正在寻找的表格"是 Win32_PnPEntity 它列出了我连接的所有 155 台设备.

The 'table' I was looking for is Win32_PnPEntity it listed all 155 devices I'm connected to.

这篇关于如何查询未在 USB Root Hub 中列出的 USB 设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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