Query A Device Attached to USB - Windows
Well, I've looked all over the internet, and it appears that what I want to do is near impossible without writing my own driver.
I have a device attached to a USB por开发者_如何学JAVAt, and - unfortunately for this situation - it uses a USB to UART driver to emulate a serial port which streams the device output.
However, in order to validate a license for the software, I want to ensure that I know which device is attached to the USB port - not just the make and model, but (hopefully) the actual serial number. If not the serial number, at least some unique identifier.
But I'm not sure where or how to get that.
The UART Bridge has a PNPDeviceID, but that doesn't seem to change, regardless of which device is plugged into the port.
I'm working in C#, which, from what I've read, is also a limitation.
So my question is this: How can I get a unique identifier from a USB-attached device while using a UART Bridge driver in C#?
Thanks in advance.
You might try this library. There's some sample code in this MSDN question as well.
The PnpDeviceID actually is what I was looking for. It's just that the EEPROM has to be updated, which is demonstrated in one of the sample applications from Silicon Labs. The PnpDeviceID consists of the Vendor ID, Product ID, and Serial Number, all of which are customizable via the method demonstrated. The Serial Number on my particular set of devices defaults to 0001, which makes it appear that the PnpDeviceID doesn't change.
Reference here.
精彩评论