Home > Net >  How do I get the position of the usb device information?
How do I get the position of the usb device information?

Time:11-07

I want to determine the position in the U disk is inserted in the HUB,

In "USB mass storage device" a "position" in the details if can be the difference in the position of the HUB, but looking for a long time but could not find how to read the attributes,
Search on the Internet for a long time, most of them are using WMI, but also does not have this property in the WMI,

Please have someone can guide,

CodePudding user response:

That is the way I used to query the NumberOfPorts are NULL NULL
 ManagementObjectSearcher searcher=new ManagementObjectSearcher (textBox1. Text); 
//ManagementObjectSearcher searcher=new ManagementObjectSearcher (" Select * From Win32_Processor ");

Foreach (ManagementObject dm in a searcher. The Get ())
{
ListBox1. Items. The Add (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ");
ListBox1. Items. The Add (dm) [r]. "the Name" the ToString ());
Foreach (var property in dm. The Properties)
{

ListBox1. Items. The Add (num. ToString () + ", "+ property. The Name +" : "+ property. The Value).
Num++;
//the Console. WriteLine (property. The Name + ":" + property. The Value).
}
}

CodePudding user response:


WMI: Win32_DiskDrive

CodePudding user response:

refer to the second floor sprc_lcl response:

WMI: Win32_DiskDrive

Thank you for your reply, I've tried U disk, there is no value under
  •  Tags:  
  • C#
  • Related