如何查询未在 USB Root Hub 中列出的 USB 设备

编程入门 行业动态 更新时间:2024-10-24 16:28:14
本文介绍了如何查询未在 USB Root Hub 中列出的 USB 设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

查询适用于 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/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/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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-25 07:43:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1080294.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设备   USB   Root   Hub

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!