Getting VID and PID from device using UsbSer
-
I'm struggling with some USB devices that work like a serial devices. The driver used is UsbSer.sys. So I register for device notifications and in
OnDeviceChange()
I get the "filename" for the device so I can open it with::CreateFile()
. I now need a way to get the vendor and product ids from the device, preferably by using::DeviceIoControl()
or the Setup API. Actually it's a composite device so it registers as a few different devices. This means I can access it using different drivers, using different "filenames", but it should be used as a serial device. Even if I got the vendor id by using another device class I haven't found a way to map that device to the serial driver for the same device. Is there some I/O control code or a neat method using the setup API I've overlooked, I would be most grateful to be pointed in the right direction. Previously the "filename" has been parsed since it seemed to be built using the vendor and product ids, but this method breaks when the device presents itself as a composite device. So I assume using the registry is not the way to do it. Ideas anyone?"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown