USB Unique ID

Hi,

I have two devices both of which have same Vendor and Product ID. Also, the serial number is same. How do I identify the USB device uniquely.

I know the hub port information.

Basically, I want the user to connect to the usb device in more user friendly way.

Is there any USB device unique ID

Thanks & Regards.

That is what the USB serial number if for.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@prescott-instruments.com
Sent: Monday, May 19, 2014 10:33 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB Unique ID

Hi,

I have two devices both of which have same Vendor and Product ID. Also, the
serial number is same. How do I identify the USB device uniquely.

I know the hub port information.

Basically, I want the user to connect to the usb device in more user
friendly way.

Is there any USB device unique ID

Thanks & Regards.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Basically, the firmware is same on both devices.

The serial number IS the unique identifier (in conjuction with the Vid/Pid).

xxxxx@prescott-instruments.com wrote:

From: xxxxx@prescott-instruments.com
To: “Windows System Software Devs Interest List”
Subject: [ntdev] USB Unique ID
Date: Mon, 19 May 2014 10:33:22 -0400 (EDT)

Hi,

I have two devices both of which have same Vendor and Product ID. Also, the serial number is same. How do I identify the USB device uniquely.

I know the hub port information.

Basically, I want the user to connect to the usb device in more user friendly way.

Is there any USB device unique ID

Thanks & Regards.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

The serial number should not be embedded in the firmware. It could possibly be stored on the same storage device, but it should be set to a unique value in each unit.

xxxxx@prescott-instruments.com wrote:

From: xxxxx@prescott-instruments.com
To: “Windows System Software Devs Interest List”
Subject: RE:[ntdev] USB Unique ID
Date: Mon, 19 May 2014 10:47:22 -0400 (EDT)

Basically, the firmware is same on both devices.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Where should I store the serial number if not in the firmware.

My device is a coldfire MCF52259 and it uses to control some other components using output pins. Also, it reads analog data through its A/D interface.

My understanding is that it is a requirement of Windows for devices with the same VID/PID that if there is a serial number it must be unique. If you must have identical devices they must not have a serial number. You have to change the device firmware to correct this otherwise they won’t work with Windows. Even with identical VID/PID and no serial number, you can have your own private ways of distinguishing them in your device and application software, but Windows won’t be able to. M.
----- Original Message -----
From: xxxxx@prescott-instruments.com
To: Windows System Software Devs Interest List
Sent: Monday, May 19, 2014 3:33 PM
Subject: [ntdev] USB Unique ID

Hi,

I have two devices both of which have same Vendor and Product ID. Also, the serial number is same. How do I identify the USB device uniquely.

I know the hub port information.

Basically, I want the user to connect to the usb device in more user friendly way.

Is there any USB device unique ID

Thanks & Regards.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I just checked my two seagate external hard disks. They have identical serial numbers. I checked with usb view. I am dumping the usb view data. Both hard disks have identical data.

Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x0BC2 (Seagate RSS LLC)
idProduct: 0x3300
bcdDevice: 0x0130
iManufacturer: 0x01
iProduct: 0x02
iSerialNumber: 0x03
bNumConfigurations: 0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: High
Device Address: 0x01
Open Pipes: 2

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

iSerialNumber it’s not a s/n, but an index in string descriptor table.
Enable in UsbView menu Options/ Show Config Descriptors to see s/n (and
other string indexed properties).

Best regards,
Krystian Bigaj

On 19 May 2014 17:37, wrote:

> I just checked my two seagate external hard disks. They have identical
> serial numbers. I checked with usb view. I am dumping the usb view data.
> Both hard disks have identical data.
>
> iManufacturer: 0x01
> iProduct: 0x02
> iSerialNumber: 0x03
>

iSerialNumber: 0x03 <---- this is a string descriptor index, not the serial number itself. You need to look at the string descriptor to find the serial number value

d

Bent from my phone


From: xxxxx@prescott-instruments.commailto:xxxxx
Sent: ?5/?19/?2014 8:37 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: RE:[ntdev] USB Unique ID

I just checked my two seagate external hard disks. They have identical serial numbers. I checked with usb view. I am dumping the usb view data. Both hard disks have identical data.

Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x0BC2 (Seagate RSS LLC)
idProduct: 0x3300
bcdDevice: 0x0130
iManufacturer: 0x01
iProduct: 0x02
iSerialNumber: 0x03
bNumConfigurations: 0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: High
Device Address: 0x01
Open Pipes: 2

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>

I’m a bit rusty, but aren’t those iManufacturer, iSerialNumber etc just specifying the index to the string containing the data? So string 1 will probably say “Seagate”, string 3 should contain the unique serial number… M

----- Original Message -----
From: xxxxx@prescott-instruments.com
To: Windows System Software Devs Interest List
Sent: Monday, May 19, 2014 4:37 PM
Subject: RE:[ntdev] USB Unique ID

I just checked my two seagate external hard disks. They have identical serial numbers. I checked with usb view. I am dumping the usb view data. Both hard disks have identical data.

Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x0BC2 (Seagate RSS LLC)
idProduct: 0x3300
bcdDevice: 0x0130
iManufacturer: 0x01
iProduct: 0x02
iSerialNumber: 0x03
bNumConfigurations: 0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: High
Device Address: 0x01
Open Pipes: 2

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x02 OUT
Transfer Type: Bulk
wMaxPacketSize: 0x0200 (512)
bInterval: 0x00


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

xxxxx@prescott-instruments.com wrote:

Basically, the firmware is same on both devices.

You can’t do that. Windows cannot handle it. You have three choices.

  1. You can modify the firmware on the fly to embed a unique serial
    number before you burn it. Firmware is typically loaded from an IIC
    file, and the format of those files is not rocket science. One of my
    clients has 30 different camera models, all sharing the same firmware.
    I compile the firmware once, then I have tools that will patch in the
    VID, PID, and all of the string descriptors on the fly. It’s a much
    less error-prone process than what they had before.

  2. You can write a little tool to rewrite just the serial number after
    it has been burned. This assumes that your EEPROM can be reprogrammed
    on a byte-by-byte basis. Some can, some cannot.

  3. You can change the firmware so that you don’t have a serial number,
    by setting iSerialNumber to 0 in the device descriptor.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Some people use an external (to the processor) I2C eeprom or other storage device. You could also put it in a reserved area of your flash that is individually-programmed. Another option would be to use the Ethernet MAC address (if you have Ethernet). There are a number of ways to do it.

Greg

xxxxx@prescott-instruments.com wrote:

From: xxxxx@prescott-instruments.com
To: “Windows System Software Devs Interest List”
Subject: RE:[ntdev] USB Unique ID
Date: Mon, 19 May 2014 11:04:53 -0400 (EDT)

Where should I store the serial number if not in the firmware.

My device is a coldfire MCF52259 and it uses to control some other components using output pins. Also, it reads analog data through its A/D interface.


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

> Basically, the firmware is same on both devices.

Serial number must be unique for each device.

If it is not so - you can just omit the serial number from the descriptor, this is OK.

Having the same serial numbers is NOT OK, a gross violation of the USB spec, and some Windows versions will just crash if 2 such devices are inserted.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

Maxim S. Shatskih wrote:

> Basically, the firmware is same on both devices.
Serial number must be unique for each device.

If it is not so - you can just omit the serial number from the descriptor, this is OK.

Having the same serial numbers is NOT OK, a gross violation of the USB spec, and some Windows versions will just crash if 2 such devices are inserted.

Alas, although your latter statement is true, the former is not. The
general USB spec says practically nothing about serial numbers. There
is no requirement that they be unique, although intuitively we all
believe that should be the case.

Some of the class specifications do have additional requirements. If a
USB Mass Storage device has a serial number, for example, it is required
to be 12 uppercase hexadecimal digits.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> Serial number must be unique for each device.

If it is not so - you can just omit the serial number from the descriptor, this is OK.

Having the same serial numbers is NOT OK, a gross violation of the USB spec, and some Windows versions will just crash if 2 such devices are inserted.

I looked into this for similar ‘How can I identify this device’ reasons a year ago or so and I could not locate a way to uniquely identify flash drives that either don’t have or present the same serial number. I didn’t encounter any crashes testing on XP+, but definitely ran into quirks. For example, each time such a flash drive was connected to a new port Windows installs the device anew. Swap one flash drive without the unique id with another and Windows would think they’re the same device, regardless of data, formatting, etc.
This MSDN article talks about querying for this info and some such fail cases - http://msdn.microsoft.com/en-us/library/windows/hardware/ff551679(v=vs.85).aspx

–Ian

Ian Bannerman wrote:

I looked into this for similar ‘How can I identify this device’
reasons a year ago or so and I could not locate a way to uniquely
identify flash drives that either don’t have or present the same
serial number. I didn’t encounter any crashes testing on XP+, but
definitely ran into quirks. For example, each time such a flash drive
was connected to a new port Windows installs the device anew. Swap one
flash drive without the unique id with another and Windows would think
they’re the same device, regardless of data, formatting, etc.

What you’re describing is the behavior if the devices lack a serial
number. That’s a perfectly acceptable situation. Windows, in that
case, uniquely identifies the device by VID, PID, hub, and port. Two
devices with the same VID and PID in the same port will always be seen
as the same device.

But when you plug in two devices have the same serial number, the
situation is not so happy. Windows cannot have two devices sharing a
single devnode, so it either rejects the second one or gets confused and
dies.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

There is also a registry setting to ignore the serial number for the specific PID/VID.

Tim Roberts wrote:

What you’re describing is the behavior if the devices lack a serial
number. That’s a perfectly acceptable situation. Windows, in that
case, uniquely identifies the device by VID, PID, hub, and port.
Two devices with the same VID and PID in the same port will always
be seen as the same device.

But when you plug in two devices have the same serial number, the
situation is not so happy. Windows cannot have two devices sharing
a single devnode, so it either rejects the second one or gets
confused and dies.

I follow, that makes sense. Thank you for clarifying!
–Ian

>For example, each time such a flash drive was connected to a new port Windows installs the device

anew.

This is true for all USB devices without serial numbers, not only flash drives.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com