24

Is it possible to identify a USB device by a unique identifier like an Operating system has Mac-ID, Harddisk ID, Ethernet card ID has unique identifiers? I know one can easily change the volume serial number of USB partition or it could be changed when user Formats it.

But is there an ID some kind of 'USB Harddisk ID or USB Hardware ID' which could be retrieved via MFC's (Visual C++ or C#) using the WMI Service? Will such an identifier be unique to the physical device? Kindly clarify...

Richard Chambers
  • 16,643
  • 4
  • 81
  • 106
highlander141
  • 1,683
  • 3
  • 23
  • 48
  • Sometimes there are cheap network adapters with equal or zero MAC addresses. – Vi. Dec 27 '12 at 11:40
  • @Vi.Can you explain your comment? – highlander141 Dec 27 '12 at 12:03
  • Means sometimes there are a-bit-wrong devices that are really "identical" from computer's point of view and have no or equal serial numbers even if standards do require unique. Why do you need to discriminate arbitrary USB devices? Or you need this only for specific ones like mass storage or network adapters? – Vi. Dec 27 '12 at 12:21
  • 3
    What is your [actual, bigger problem](http://mywiki.wooledge.org/XyProblem)? – Vi. Dec 27 '12 at 12:24
  • 1
    What I need, I am on a project which required USB to be plugged in to any computer (on internet), there will be an autorun.xxx (exe or some script) which will detect this USB and opens an web portal which could be accessed only by that USB's id which will be a combination of SESSION_ID generated at the time of web portal loading... – highlander141 Dec 27 '12 at 13:13

1 Answers1

28

The closest equivalent of a "unique number" available in any USB device is the VID and PID, the vendor and product IDs. It is used to identify the device and install the proper driver for it. However, it is the same set of numbers for the same product, it is not good enough to identify the particular device you have in your hand. And thus useless to implement a license verification procedure, presumably what you are after.

Only certain kind of USB devices implement a serial number. You get it by accident from a flash drive due to the drive formatter generating a volume serial number. Useless as well, it can easily be changed. A USB wifi adapter could work, the manufacturer must generate a unique MAC address.

There's one class of USB devices that are perfect for this goal. The generic name is "dongle", they are made for this. When you buy one you also get software that you can link into your program that provides a tamper-proof way to verify the license number, another important part of a license verification procedure and usually the weak link. More about dongles in this Wikipedia article.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • 2
    Concerning the VID and PID. It appears from what I have been able to find that the Vendor Id and Product Id are those of the USB component in a device rather than that of the device itself. In other words different USB physical devices from different vendors which offer similar functionality may source the same USB component from a specific vendor. The VID and PID you get is for the USB component and does not identify the device the USB component is part of. To determine the characteristics of the actual device that the USB component has been used to build you must do additional queries. – Richard Chambers Nov 30 '16 at 20:43
  • CP2102 USB to UART has full support about serial number and you can use their official program named CP210xSetIDs.exe to change the serial number easily. – SuB Sep 13 '22 at 08:34