I am Developing an application where I need to fetch VID and PID of all the Current USB Devices Connected to the Computer.

But I am just getting VID and PID number of my Headphone that is attached to my Computer. and not getting for Mouse and Keyboard.

My Code works like this:-

static List<USBDeviceInfo> GetUSBDevices()
        List<USBDeviceInfo> devices = new List<USBDeviceInfo>();

        ManagementObjectCollection collection;
        using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_USBHub"))
            collection = searcher.Get();

        foreach (var device in collection)
            devices.Add(new USBDeviceInfo(

        return devices;

Main Class

static void Main(string[] args)
       var usbDevices = GetUSBDevices();
       foreach (var usbDevice in usbDevices)
        Console.WriteLine("Device ID: {0}, PNP Device ID: {1}, Description: {2}",
         usbDevice.DeviceID, usbDevice.PnpDeviceID, usbDevice.Description);

Now in case of Headphone I am getting Description as USB Composite Device while in Case of other Devices connected to Computer I am getting Description as USB Root Hub

I don't know why I am getting only VID and PID of only Headphone

Please suggest

Thanks in advance.!!

closed as off topic by Canadian Luke, BBlake, Kez, Indrek, Gaff Sep 18 '12 at 15:53

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

  • There is no need to show your code (this site is not a programming site) as it's relevant to your question per se. – Dave Sep 18 '12 at 11:56

A hub is a device that other devices are connected to. Root hubs represent the USB controllers on your motherboard.

A composite device is a device that has multiple interfaces; your headphones has two interfaces, for mixer controls and for audio capture.

Normal USB devices are not listed as Win32_USBHub, you have too look into the Dependent entries. See Getting the USB Devices Information using WMI for an example.

  • The link is broken – miniBill Aug 10 '15 at 13:10

I'm not covering the coding part of this question - its OT for SU. I can't code anyway

The real issue is, you might be looking at the wrong place

First, go look at device manager.

Here's mine. I've darkened out the less interesting bits and pointed out the useful stuff enter image description here

My gaming mouse is a USB composite device - it consists of two virtual devices (which in this case of what I am assuming is a USB headset. Else it wouldn't appear at all). Hence it appears in 3 places - under HID, under Keyboards and under Mice and other pointing devices amd as a USB controller.

My keyboard ONLY appears under HID and Keyboards since its a boring, non sexy piece of logitech gear. It SHOULD NOT turn up under USB controllers.

In short? You may relook your code, and learn a little about how windows classifies hardware.

Not the answer you're looking for? Browse other questions tagged or ask your own question.