Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Thursday, August 26, 2010

USB serial number

Source
Note:  
change in the text for your convenience the character Ampersand instead of &
USB devices should have a hardware serial number which is unique for each exemplar. But there are lots of devices which have no serial or where all exemplars have identical serials.
This results in different behaviour when a different USB port or another exemplar of the same USB device is used.
USB Port is changed USB device is changed
no serial detected as new detected as the same
unique serial detected as the same detected as new
all indentical serials detected as the same detected as the same
The only way to change the behaviour is to make Windows to ignore the serial. This can be done for all USB devices or for a certain device. See below.
Two identical drives
Two identical drives doesn't work if they have identical USB hardware serial numbers. This is a violation of the USB mass storage specs but such drives exist. As far as I've seen such drives can be used alone only.
Some say that the sentence 'If provided, the serial number must be unique to each USB Vendor ID and Product ID pair.' can be interpreted as allowing the same devices from the same manufacturer to have the same serial number, albeit unique to that product line from that manufacturer, but I think the term 'serial number' alone makes absolutely clear how to read that.
You get what you pay for. Giving each device a unique serial costs some cents, while omitting the serial make the users complain about the device being detected as new one when it's attached to a different USB port...
Update: I've tested two USB single slot card readers with identical USB serials: XP-SP2 fully patched and Vista where able to handle this at least on first view. They handle the second drive similar to drives without a serial. But I've also seen an XP which generates a blue screen when the second device is attached...
You can check the USB serial by means of my commandline tool ListUsbDrives.
Windows 2000 and higher can be forced to ignore all USB serials or the serial of devices specified by vendor and product ID:
Under
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags]
there is the value GlobalDisableSerNumGen:
0 disable all USB serials
1 enables USB serials
On first view the name seems to implicate the opposite. Probably DisableSerNumGen stands for Disable Serial Number Generation, so when 'Generation' is disabled then the real serials are used.
The better solution is an individual setting for the device in question.
Create an entry under the above key. The name starts with "IgnoreHWSerNum" followed by the vendor and product ID of the device. The value for ignoring the serial is 1 as the name implies.
Example for vendor=1111 and product=9999:
IgnoreHWSerNum11119999=1
The value should be a binary and have exactly 1 byte. You can get the IDs by means of my ListUsbDrives started with parameter -a (all drives and informations):
You find them in a line like this
Ctrl ID = USB\VID_1111&PID_9999\USB_serial_number
No restart required to take effect.
Ignoring the serial can be used to prevent the plug and play is triggered when a USB device is exchanged by another expemplar of the same model. This is great for instance when a USB printer is defective and replaced. When the serial is ignored (or not present) the new printer just works as long as it's connected to the same USB port.

No comments: