Rahul Anand

Rahul Anand

  • NA
  • 316
  • 3.1k

Find slot no.'s of the connected usb's in USB Hub(10 slots)

May 29 2017 7:40 AM
C# I have a USB Hub of 10 USB slots connected to my USB Port. I want to get the USB device connected to the specific port.
Example: Two USB's are connected at Slot 3 and Slot 7. So, I want a list which will show Slot 3 and Slot 7 have USB and rest slot are empty. I have tried using WMI Query Win32_USBHub. But here I am only getting 6 device id's and not 10. I am differentiating the ports using common VID for the Device ID. But still even after getting the USB's connected to the specific port. I want to get their corresponding slot in which they are connected to USBHub. I am not able to identify the slot in which the USB is connected and where the slot is empty.
 
ManagementObjectCollection collection; 
var searcher = new ManagementObjectSearcher(@"Select * From Win32_USBHub"); 
collection = searcher.Get();
 

Answers (1)