USB Serial Numers

hi

In searching postings in varoius driver newsgroups, I see that the USB Serial number (in the device’s configuration descriptor) has to be set in order to avoid having to re-install the drivers if the USB device is plugged into another port.

What is not clear (I see conflicting postings) is what happens if two of the same devices (same USB board, exact same hardware) are both plugged in, but (obviously) into separate USB ports. I saw one posting about the system crashing, another about needing a reboot after a re-install of the driver for the 2nd plugged in device, etc.

Also, from what I read, for a signed driver with a usb device that doesn’t have a serial number set (it’s at the default value of 0x00), the silent install will take place but it will be significantly slower and some sort or context info will be lost. Is this true? What type of context info is this? Is this info stored in the registry or somewhere else? Is this only specific to BT devices?

Also, one other unrelated USB question. Under the registry entries for USB device (e.g. HKLM\System\CurrentControlSet\Enum\USB\Vid_ABCD&Pid_WXYZ\5&c465f0c&0&6) does the 5&c465f0c&0&6 provide any meaningful information? Just curious (though we know what that did to the cat).

thanks

Sharon,

The string 5&c465f0c&0&6 is the InstanceID for the device.

If a device has a serial number, the USB bus driver will use it as the
InstanceID for the device. However, in the case of the string 5&c465f0c&0&6,
the bus driver did not find a serial number on the device and had to
generate a unique instance id himself.

There is nothing wrong with two identical hardware devices connected to the
USB bus since their InstanceID’s will be different (if they have a serial
number - it’s the manufacturer’s reponsibility, and if they don’t - it’s the
bus driver implementor responsibility). If the manufacturer or implementor
messed up and the instance id is not unique, then we have a problem, and I’m
not sure what would happen.

I never heard or observed any “slowness” of driver installation when devices
do not have serial numbers.

Regards,

Shahar


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Saturday, January 21, 2006 2:49 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB Serial Numers

hi

In searching postings in varoius driver newsgroups, I see that the USB
Serial number (in the device’s configuration descriptor) has to be set in
order to avoid having to re-install the drivers if the USB device is plugged
into another port.

What is not clear (I see conflicting postings) is what happens if two of
the same devices (same USB board, exact same hardware) are both plugged in,
but (obviously) into separate USB ports. I saw one posting about the system
crashing, another about needing a reboot after a re-install of the driver
for the 2nd plugged in device, etc.

Also, from what I read, for a signed driver with a usb device that doesn’t
have a serial number set (it’s at the default value of 0x00), the silent
install will take place but it will be significantly slower and some sort or
context info will be lost. Is this true? What type of context info is this?
Is this info stored in the registry or somewhere else? Is this only specific
to BT devices?

Also, one other unrelated USB question. Under the registry entries for USB
device (e.g.
HKLM\System\CurrentControlSet\Enum\USB\Vid_ABCD&Pid_WXYZ\5&c465f0c&0&6) does
the 5&c465f0c&0&6 provide any meaningful information? Just curious (though
we know what that did to the cat).

thanks


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

> two of the same device
If they both have the same serial number, bad things can happen from a bugcheck to non enumeration. If they have different serial numbers, the new device is treated as a new instance

context info
All information stored in the devnode itself is lost b/c a new devnode is created. For the MSFT BT stack, it stores association info in a service specific key (b/c both the local radio MAC and the remote radio MAC are unique) so it can get at the data when it is newly installed under a different devnode. The type of context info is driver specific. For instance, of a serial port it would be the assigned COM number.

5&c465f0c&0&6
This is opaque. This is the cooked up instance ID that the OS created for the device when the bus that enumerated the device does not have a unique instance ID for the device. For a usb device, the serial number serves as the unique ID, so instead of an OS cooked value, you will get something close to the serial number reported (but it’s still opaque).

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of S. Drasnin
Sent: Friday, January 20, 2006 4:49 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] USB Serial Numers

hi
?
In searching postings in varoius driver newsgroups, I see that the USB Serial number (in the device’s configuration descriptor) has to be set in order to avoid having to re-install the drivers if the USB device is plugged into another port.?
?
What is not clear (I see conflicting postings) is what happens if??two of the same devices (same USB board, exact same hardware) are both plugged in, but (obviously) into separate USB ports.?I saw one posting about the system crashing, another about needing a reboot after a re-install of the driver for the 2nd plugged in device, etc.
?
Also, from what I read, for a signed driver with a usb device that doesn’t have a serial number set (it’s at the default value of 0x00), the silent install will take place but it will be significantly slower and some sort or context info will be lost. Is this true? What type of context info is this? Is this info stored in the registry or somewhere else? Is this only specific to BT devices?
?
Also, one other unrelated USB question. Under the registry entries for USB device (e.g.?HKLM\System\CurrentControlSet\Enum\USB\Vid_ABCD&Pid_WXYZ\5&c465f0c&0&6) does the 5&c465f0c&0&6 provide any meaningful information? Just curious (though we know what that did to the cat).
?
thanks
?
?
?
?
??


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Things are work as the following (more or less, MS’s guys will correct me
if I’m wrong):

  • PnP always maintains the registry key for a device (“device registry key”).
    It is under Enum, and its name is BusName\DeviceHardwareId\DeviceInstanceId.

  • one of the first queries PnP sends to enumerator (USBHUB for USB) - is about
    the DeviceHardwareId. USBHUB assembles this fancy VID_xxx&PID_xxx string and
    returns to PnP.

  • also, one of the first queries PnP sends to enumerator - is about the
    DEVICE_CAPABILITIES. The DEVICE_CAPABILITIES have a bit of UniqueId - USBHUB
    sets it to 1 if the device’s config descriptor has the unique ID, or to 0 if
    not so.

  • if PnP sees the UniqueId reset in DEVICE_CAPABILITIES (“hardware cannot
    provide us with the unique ID”) - then it invents the DeviceInstanceId on its
    own, just to not clash with anything, and creates the brand new device registry
    key. The new registry key is - surely - empty.

  • on the contrary, if PnP sees the UniqueId set in DEVICE_CAPABILITIES - then
    it queries the DeviceInstanceId from the enumerator, and USBHUB returns the
    real hardware unique ID. Then PnP opens the device registry key using the
    aforementioned pathname - yes, it can create the new key if it does not exist
    (the device was never inserted before), but it can also open the existing key
    if the device was sometimes inserted before!

  • the existing registry key was already correctly set up by PnP, and PnP can
    continue loading the drivers and starting the devnode.

  • but, if the device registry key is brand new and empty, then PnP must at
    least install a driver for a device (by writing the “Driver” and some other
    values to this new key - device class GUID, human-readable-description and
    such)! In this case, kernel-mode PnP cannot manage all of this itself and asks
    the user-mode PnP service to help. The user-mode PnP service starts its slow
    and bothering work of enumerating the known INF files and such. If the driver
    is unsigned - then the warning is shown. And so on.

So, inserting the USB device which has no unique ID leads to all of this slow
bothering each time, and surely all per-device context info is lost (re-created
as for a brand new device). For network adapter, you will lose its IP
addresses and such.

What is not clear (I see conflicting postings) is what happens if two of the
same
devices (same USB board, exact same hardware) are both plugged in,

All is fine if both have the different unique ID.

If both have the same unique ID (i.e. the ID is not unique, the device is not
spec conforming) - then any result can be, up to BSOD.

but it will be significantly slower and some sort or context info will be
lost. Is this
true? What type of context info is this?

All content of device registry key. The new one will be created.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com