I need to know what kind of USB devices currently used in system. There is a USB specification about class codes of USB devices. But I cant get device type, WMI request WQL: select * from Win32_UsbHub
give null values on Class code, Subclass code, Protocol type fields. Any ideas how to detect USB device type currently in use?
My current code:
ManagementObjectCollection collection;
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_USBHub"))
{
collection = searcher.Get();
foreach (var device in collection)
{
var deviceId = (string)GetPropertyValue("DeviceID");
var pnpDeviceId = (string)GetPropertyValue("PNPDeviceID");
var descr = (string)device.GetPropertyValue("Description");
var classCode = device.GetPropertyValue("ClassCode"); //null here
}
}