A lot can be read and a whole lot more can be interpreted when reading those specifications 😉 , that is the problem with all those abstract documentations. I have observed during my testing at SCM Microsystems that when devices with same serial numbers are connected it may crash the system, which i have always seen on Win9x systems and think on WinXp as well.
Windows uses serial numbers in devices to uniquely identify one device from another when plugged in to the system, say for example to identify one USB cam to another cam. But USB specification says that they devices “can” have serial numbers and hence it is not a requirement that all devices must have serial number. So how does windows identify devices that does not have serial number ? simple it generates a number based on the hub & port combination on which it is connected. Though this does not guarantee uniqueness this is how windows works and you have to deal with it ;). Lets see an example for both of these scenarios
here is a scenario where there is a unique serial number, the huge number after the last “\” is the serial number in this case
here is a scenario where the system generated a number when the device does not have a serial number
How to identify if a device has serial number or not ? simple, only windows generated numbers will have “&” in them. so if the number has “&” it was generated by windows else it is the number from the device.
Now that you know that a device “can” have a serial number, lets move to the next problem, which is much more subtle. What are the restrictions or rules about serial number if the device has a serial number ? hmm… interesting :). Windows places a clear requirement that if the devices have serial number they must be unique. there is also a test case that performs this check in Microsoft’s Driver Test Manager that is used to certify devices and drivers.
So if you have an USB device that has a serial number it must be unique for it to work in Windows based systems properly.Connecting multiple devices with same serial number is known to crash the system.
All these are common knowledge to lots of device driver developers, so what’s the point of this blog ? 🙂 well the point was to notify a subtle information that was missed by many including myself till yesterday. That is the USB specification does not place any restriction on the serial numbers. here is a passage from “USB in nutshell” when explaining device descriptors
Three string descriptors exist to provide details of the manufacturer, product and serial number.
There is no requirement to have string descriptors. If no string descriptor is present, a index of zero
should be used.
So, All the USB spec says is that the device can have serial number and it must be set zero if it does not want to have serial number. It is Windows that enforces the restriction that the serial numbers, if in case your device happens to support one, must be unique between two devices.
PS: An interesting article by Raymond Chen on why windows needs unique serial number for devices can be found here 🙂