Instance ID for USB device

Hi all.

Just a few minutes ago my picture of the world broke :wink:

From everything I’ve read (including this newsgroup) I got the
understanding, that when a USB device has a serial number (iSerialNumber
descriptor != 0), it would get a unique instance ID that is not
dependent on the port to which the device is connected.
However, this seems to be wrong.

I have a memory stick (from Lexar; the present from last year’s WinHEC
:wink: ) that according to DDK’s usbview has a serial number descriptor.
According to what I believed to be true, it should always get the same
instance ID, no matter in which port of my USB hub I put it. But that’s
not what happens. After removing all traces of the device from the
system (with ‘devcon remove @instanceid’), I’ve plugged it into two of
the ports of my hub. Now devcon reports two instance IDs:

devcon findall @*lexar*:
USBSTOR\DISK&VEN_LEXAR&PROD_DIGITAL_FILM&REV_/W1.\7&12A5B146&0&K105572224030314AA__0000000000000000000000000&0:
LEXAR DIGITAL FILM USB Device
USBSTOR\DISK&VEN_LEXAR&PROD_DIGITAL_FILM&REV_/W1.\7&258760A9&0&K105572224030314AA__0000000000000000000000000&0:
LEXAR DIGITAL FILM USB Device
2 matching device(s) found.

Here’s the data displayed by usbview:

For one port:

Device Descriptor:
bcdUSB: 0x0110
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x08 (8)
idVendor: 0x05DC (Lexar Media, Inc.)
idProduct: 0x0080
bcdDevice: 0x0001
iManufacturer: 0x01
iProduct: 0x01
iSerialNumber: 0x02
bNumConfigurations: 0x01

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

Endpoint Descriptor:
bEndpointAddress: 0x82
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x03
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00

For the other port:

Device Descriptor:
bcdUSB: 0x0110
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x08 (8)
idVendor: 0x05DC (Lexar Media, Inc.)
idProduct: 0x0080
bcdDevice: 0x0001
iManufacturer: 0x01
iProduct: 0x01
iSerialNumber: 0x02
bNumConfigurations: 0x01

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

Endpoint Descriptor:
bEndpointAddress: 0x82
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00

Endpoint Descriptor:
bEndpointAddress: 0x03
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00

Here’s some additional info that I extracted under Linux (btw., is there
an easy way to get the same info on Windows?):
Host scsi1: usb-storage
Vendor: LEXR PLUG DRIVE?K10557222403031
Product: LEXR PLUG DRIVE?K10557222403031
Serial Number: K105572224030314AA 00000000000
Protocol: Transparent SCSI
Transport: Bulk
GUID: 05dc0080ffff900000000000
Attached: Yes

If anyone could put some light on this and explain why this device
doesn’t get a location-independent instance ID, I would appreciate that
very much.

Best regards

Rolf Schaeuble

> Hi all.

Just a few minutes ago my picture of the world broke :wink:

From everything I’ve read (including this newsgroup) I got the
understanding, that when a USB device has a serial number (iSerialNumber
descriptor != 0), it would get a unique instance ID that is not
dependent on the port to which the device is connected.
However, this seems to be wrong.

I have a memory stick (from Lexar; the present from last year’s WinHEC
:wink: ) that according to DDK’s usbview has a serial number descriptor.
According to what I believed to be true, it should always get the same
instance ID, no matter in which port of my USB hub I put it. But that’s
not what happens. After removing all traces of the device from the
system (with ‘devcon remove @instanceid’), I’ve plugged it into two of
the ports of my hub. Now devcon reports two instance IDs:

As far as I know there is no reason that the instance IDs should be
the same. Actually, I don’t recall reading any guarantees about the
form of the IDs at all. However, the driver will have access to the
unique serial number of the device and so will know exactly which
device is plugged in.

Rob
xxxxx@telusplanet.net

Robert Newton wrote:

>Hi all.
>
>Just a few minutes ago my picture of the world broke :wink:
>
> From everything I’ve read (including this newsgroup) I got the
>understanding, that when a USB device has a serial number (iSerialNumber
>descriptor != 0), it would get a unique instance ID that is not
>dependent on the port to which the device is connected.
>However, this seems to be wrong.
>
>I have a memory stick (from Lexar; the present from last year’s WinHEC
>;-) ) that according to DDK’s usbview has a serial number descriptor.
>According to what I believed to be true, it should always get the same
>instance ID, no matter in which port of my USB hub I put it. But that’s
>not what happens. After removing all traces of the device from the
>system (with ‘devcon remove @instanceid’), I’ve plugged it into two of
>the ports of my hub. Now devcon reports two instance IDs:

As far as I know there is no reason that the instance IDs should be
the same. Actually, I don’t recall reading any guarantees about the
form of the IDs at all. However, the driver will have access to the
unique serial number of the device and so will know exactly which
device is plugged in.

If the device doesn’t get the same ID, then it looks like an entirely
different device to the system and the driver. In case the driver
(and/or a usermode application) safes some configuration data in the
registry key of the device instance, then you get different
configurations depending on the port you connect the device to, even if
*physically* it’s the same device. For me this is a very good reason to
give it the same ID each time.
This is not just a theoretical problem:
I own a USB<->COM adapter. When I connected it to my PC the first time,
it showed up as COM4. Later for some reason I’ve put it into another USB
port, and it showed up as COM5. I found this *very* inconvenient.
It gets even worse if you have a device for which you only have unsigned
drivers, since Windows then will start the interactive setup, including
the dialog that warns about unsigned drivers. If the device would always
get the same ID, this inconvenience would only happen only the very
first time you connect the device to the PC.

Concerning the form of the ID: I don’t care how the ID looks like, as
long as it’s always the same one for the same physical device.

Additionally, I’ve seen ‘each time the same ID’ being used as an
argument to convince people to put a serial number into a USB device,
instead of just setting the serial number descriptor to zero.

I just remembered that I actually have one device that always gets the
same ID: A USB harddrive. On my PC, it has the following instance ID:

USBSTOR\DISK&VEN_MAXTOR&PROD_ONETOUCH&REV_0200\Y60YX3AE____&0

Compare this to the ID of the memory stick:
USBSTOR\DISK&VEN_LEXAR&PROD_DIGITAL_FILM&REV_/W1.\7&12A5B146&0&K105572224030314AA__0000000000000000000000000&0

The start similarly (USBSTOR\TYPE&PRODUCT%REVISION), but the rest is
quite different. I wonder if this is meaningful…

Best regards

Rolf Schaeuble

No, these differences are not meaningful. There must be something about
the serial number descriptor on the device that the usb core stack is
rejecting and not using.

D

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rolf Schaeuble
Sent: Wednesday, February 11, 2004 2:33 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Instance ID for USB device

Robert Newton wrote:

>Hi all.
>
>Just a few minutes ago my picture of the world broke :wink:
>
> From everything I’ve read (including this newsgroup) I got the
>understanding, that when a USB device has a serial number
(iSerialNumber
>descriptor != 0), it would get a unique instance ID that is not
>dependent on the port to which the device is connected.
>However, this seems to be wrong.
>
>I have a memory stick (from Lexar; the present from last year’s WinHEC

>;-) ) that according to DDK’s usbview has a serial number descriptor.
>According to what I believed to be true, it should always get the same

>instance ID, no matter in which port of my USB hub I put it. But
that’s
>not what happens. After removing all traces of the device from the
>system (with ‘devcon remove @instanceid’), I’ve plugged it into two of

>the ports of my hub. Now devcon reports two instance IDs:

As far as I know there is no reason that the instance IDs should be
the same. Actually, I don’t recall reading any guarantees about the
form of the IDs at all. However, the driver will have access to the
unique serial number of the device and so will know exactly which
device is plugged in.

If the device doesn’t get the same ID, then it looks like an entirely
different device to the system and the driver. In case the driver
(and/or a usermode application) safes some configuration data in the
registry key of the device instance, then you get different
configurations depending on the port you connect the device to, even if
*physically* it’s the same device. For me this is a very good reason to
give it the same ID each time.
This is not just a theoretical problem:
I own a USB<->COM adapter. When I connected it to my PC the first time,
it showed up as COM4. Later for some reason I’ve put it into another USB

port, and it showed up as COM5. I found this *very* inconvenient.
It gets even worse if you have a device for which you only have unsigned

drivers, since Windows then will start the interactive setup, including
the dialog that warns about unsigned drivers. If the device would always

get the same ID, this inconvenience would only happen only the very
first time you connect the device to the PC.

Concerning the form of the ID: I don’t care how the ID looks like, as
long as it’s always the same one for the same physical device.

Additionally, I’ve seen ‘each time the same ID’ being used as an
argument to convince people to put a serial number into a USB device,
instead of just setting the serial number descriptor to zero.

I just remembered that I actually have one device that always gets the
same ID: A USB harddrive. On my PC, it has the following instance ID:

USBSTOR\DISK&VEN_MAXTOR&PROD_ONETOUCH&REV_0200\Y60YX3AE____&0

Compare this to the ID of the memory stick:
USBSTOR\DISK&VEN_LEXAR&PROD_DIGITAL_FILM&REV_/W1.\7&12A5B146&0&K10557222
4030314AA__0000000000000000000000000&0

The start similarly (USBSTOR\TYPE&PRODUCT%REVISION), but the rest is
quite different. I wonder if this is meaningful…

Best regards

Rolf Schaeuble


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

It might be interesting to find out the exact reason.
If it’s just a serial number that is violating the spec, then it’s just
a broken device. That’s bad, but not changeable.
If it should turn out to be a bug in the usb stack, it might be useful
to point out what exactly it doesn’t like about that serial number, so
that it can be worked around by device manufacturers.

Thanks and best regards

Rolf Schaeuble

Doron Holan wrote:

No, these differences are not meaningful. There must be something about
the serial number descriptor on the device that the usb core stack is
rejecting and not using.

D

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rolf Schaeuble
Sent: Wednesday, February 11, 2004 2:33 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Instance ID for USB device

Robert Newton wrote:

>>Hi all.
>>
>>Just a few minutes ago my picture of the world broke :wink:
>>
>>From everything I’ve read (including this newsgroup) I got the
>>understanding, that when a USB device has a serial number

(iSerialNumber

>>descriptor != 0), it would get a unique instance ID that is not
>>dependent on the port to which the device is connected.
>>However, this seems to be wrong.
>>
>>I have a memory stick (from Lexar; the present from last year’s WinHEC

>>;-) ) that according to DDK’s usbview has a serial number descriptor.
>>According to what I believed to be true, it should always get the same

>>instance ID, no matter in which port of my USB hub I put it. But

that’s

>>not what happens. After removing all traces of the device from the
>>system (with ‘devcon remove @instanceid’), I’ve plugged it into two of

>>the ports of my hub. Now devcon reports two instance IDs:
>
>
>As far as I know there is no reason that the instance IDs should be
>the same. Actually, I don’t recall reading any guarantees about the
>form of the IDs at all. However, the driver will have access to the
>unique serial number of the device and so will know exactly which
>device is plugged in.

If the device doesn’t get the same ID, then it looks like an entirely
different device to the system and the driver. In case the driver
(and/or a usermode application) safes some configuration data in the
registry key of the device instance, then you get different
configurations depending on the port you connect the device to, even if
*physically* it’s the same device. For me this is a very good reason to
give it the same ID each time.
This is not just a theoretical problem:
I own a USB<->COM adapter. When I connected it to my PC the first time,
it showed up as COM4. Later for some reason I’ve put it into another USB

port, and it showed up as COM5. I found this *very* inconvenient.
It gets even worse if you have a device for which you only have unsigned

drivers, since Windows then will start the interactive setup, including
the dialog that warns about unsigned drivers. If the device would always

get the same ID, this inconvenience would only happen only the very
first time you connect the device to the PC.

Concerning the form of the ID: I don’t care how the ID looks like, as
long as it’s always the same one for the same physical device.

Additionally, I’ve seen ‘each time the same ID’ being used as an
argument to convince people to put a serial number into a USB device,
instead of just setting the serial number descriptor to zero.

I just remembered that I actually have one device that always gets the
same ID: A USB harddrive. On my PC, it has the following instance ID:

USBSTOR\DISK&VEN_MAXTOR&PROD_ONETOUCH&REV_0200\Y60YX3AE____&0

Compare this to the ID of the memory stick:
USBSTOR\DISK&VEN_LEXAR&PROD_DIGITAL_FILM&REV_/W1.\7&12A5B146&0&K10557222
4030314AA__0000000000000000000000000&0

The start similarly (USBSTOR\TYPE&PRODUCT%REVISION), but the rest is
quite different. I wonder if this is meaningful…

Best regards

Rolf Schaeuble


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I would need to have one of these devices to figure out why it isn’t
working :slight_smile: … I didn’t get one b/c I was just a plain old speaker, not
an attendee.

D

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rolf Schaeuble
Sent: Wednesday, February 11, 2004 3:04 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Instance ID for USB device

It might be interesting to find out the exact reason.
If it’s just a serial number that is violating the spec, then it’s just
a broken device. That’s bad, but not changeable.
If it should turn out to be a bug in the usb stack, it might be useful
to point out what exactly it doesn’t like about that serial number, so
that it can be worked around by device manufacturers.

Thanks and best regards

Rolf Schaeuble

Doron Holan wrote:

No, these differences are not meaningful. There must be something
about
the serial number descriptor on the device that the usb core stack is
rejecting and not using.

D

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rolf Schaeuble
Sent: Wednesday, February 11, 2004 2:33 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Instance ID for USB device

Robert Newton wrote:

>>Hi all.
>>
>>Just a few minutes ago my picture of the world broke :wink:
>>
>>From everything I’ve read (including this newsgroup) I got the
>>understanding, that when a USB device has a serial number

(iSerialNumber

>>descriptor != 0), it would get a unique instance ID that is not
>>dependent on the port to which the device is connected.
>>However, this seems to be wrong.
>>
>>I have a memory stick (from Lexar; the present from last year’s
WinHEC

>>;-) ) that according to DDK’s usbview has a serial number descriptor.

>>According to what I believed to be true, it should always get the
same

>>instance ID, no matter in which port of my USB hub I put it. But

that’s

>>not what happens. After removing all traces of the device from the
>>system (with ‘devcon remove @instanceid’), I’ve plugged it into two
of

>>the ports of my hub. Now devcon reports two instance IDs:
>
>
>As far as I know there is no reason that the instance IDs should be
>the same. Actually, I don’t recall reading any guarantees about the
>form of the IDs at all. However, the driver will have access to the
>unique serial number of the device and so will know exactly which
>device is plugged in.

If the device doesn’t get the same ID, then it looks like an entirely
different device to the system and the driver. In case the driver
(and/or a usermode application) safes some configuration data in the
registry key of the device instance, then you get different
configurations depending on the port you connect the device to, even
if
*physically* it’s the same device. For me this is a very good reason
to
give it the same ID each time.
This is not just a theoretical problem:
I own a USB<->COM adapter. When I connected it to my PC the first
time,
it showed up as COM4. Later for some reason I’ve put it into another
USB

port, and it showed up as COM5. I found this *very* inconvenient.
It gets even worse if you have a device for which you only have
unsigned

drivers, since Windows then will start the interactive setup,
including
the dialog that warns about unsigned drivers. If the device would
always

get the same ID, this inconvenience would only happen only the very
first time you connect the device to the PC.

Concerning the form of the ID: I don’t care how the ID looks like, as
long as it’s always the same one for the same physical device.

Additionally, I’ve seen ‘each time the same ID’ being used as an
argument to convince people to put a serial number into a USB device,
instead of just setting the serial number descriptor to zero.

I just remembered that I actually have one device that always gets the

same ID: A USB harddrive. On my PC, it has the following instance ID:

USBSTOR\DISK&VEN_MAXTOR&PROD_ONETOUCH&REV_0200\Y60YX3AE____&0

Compare this to the ID of the memory stick:

USBSTOR\DISK&VEN_LEXAR&PROD_DIGITAL_FILM&REV_/W1.\7&12A5B146&0&K10557222

4030314AA__0000000000000000000000000&0

The start similarly (USBSTOR\TYPE&PRODUCT%REVISION), but the rest is
quite different. I wonder if this is meaningful…

Best regards

Rolf Schaeuble


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Well, if you promise to send it back, I can send it to you :slight_smile:

Best regards

Rolf Schaeuble

Doron Holan wrote:

I would need to have one of these devices to figure out why it isn’t
working :slight_smile: … I didn’t get one b/c I was just a plain old speaker, not
an attendee.

D

This posting is provided “AS IS” with no warranties, and confers no
rights

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rolf Schaeuble
Sent: Wednesday, February 11, 2004 3:04 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Instance ID for USB device

It might be interesting to find out the exact reason.
If it’s just a serial number that is violating the spec, then it’s just
a broken device. That’s bad, but not changeable.
If it should turn out to be a bug in the usb stack, it might be useful
to point out what exactly it doesn’t like about that serial number, so
that it can be worked around by device manufacturers.

Thanks and best regards

Rolf Schaeuble

Doron Holan wrote:

>No, these differences are not meaningful. There must be something

about

>the serial number descriptor on the device that the usb core stack is
>rejecting and not using.
>
>D
>
>This posting is provided “AS IS” with no warranties, and confers no
>rights
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Rolf Schaeuble
>Sent: Wednesday, February 11, 2004 2:33 PM
>To: Windows System Software Devs Interest List
>Subject: Re:[ntdev] Instance ID for USB device
>
>Robert Newton wrote:
>
>
>
>>>Hi all.
>>>
>>>Just a few minutes ago my picture of the world broke :wink:
>>>
>>
>>>From everything I’ve read (including this newsgroup) I got the
>>
>>>understanding, that when a USB device has a serial number
>
>(iSerialNumber
>
>
>>>descriptor != 0), it would get a unique instance ID that is not
>>>dependent on the port to which the device is connected.
>>>However, this seems to be wrong.
>>>
>>>I have a memory stick (from Lexar; the present from last year’s

WinHEC

>
>>>;-) ) that according to DDK’s usbview has a serial number descriptor.

>>>According to what I believed to be true, it should always get the

same

>
>>>instance ID, no matter in which port of my USB hub I put it. But
>
>that’s
>
>
>>>not what happens. After removing all traces of the device from the
>>>system (with ‘devcon remove @instanceid’), I’ve plugged it into two

of

>
>>>the ports of my hub. Now devcon reports two instance IDs:
>>
>>
>>As far as I know there is no reason that the instance IDs should be
>>the same. Actually, I don’t recall reading any guarantees about the
>>form of the IDs at all. However, the driver will have access to the
>>unique serial number of the device and so will know exactly which
>>device is plugged in.
>
>
>If the device doesn’t get the same ID, then it looks like an entirely
>different device to the system and the driver. In case the driver
>(and/or a usermode application) safes some configuration data in the
>registry key of the device instance, then you get different
>configurations depending on the port you connect the device to, even

if

>*physically* it’s the same device. For me this is a very good reason

to

>give it the same ID each time.
>This is not just a theoretical problem:
>I own a USB<->COM adapter. When I connected it to my PC the first

time,

>it showed up as COM4. Later for some reason I’ve put it into another

USB

>port, and it showed up as COM5. I found this *very* inconvenient.
>It gets even worse if you have a device for which you only have

unsigned

>drivers, since Windows then will start the interactive setup,

including

>the dialog that warns about unsigned drivers. If the device would

always

>get the same ID, this inconvenience would only happen only the very
>first time you connect the device to the PC.
>
>Concerning the form of the ID: I don’t care how the ID looks like, as
>long as it’s always the same one for the same physical device.
>
>Additionally, I’ve seen ‘each time the same ID’ being used as an
>argument to convince people to put a serial number into a USB device,
>instead of just setting the serial number descriptor to zero.
>
>
>I just remembered that I actually have one device that always gets the

>same ID: A USB harddrive. On my PC, it has the following instance ID:
>
>USBSTOR\DISK&VEN_MAXTOR&PROD_ONETOUCH&REV_0200\Y60YX3AE____&0
>
>Compare this to the ID of the memory stick:
>

USBSTOR\DISK&VEN_LEXAR&PROD_DIGITAL_FILM&REV_/W1.\7&12A5B146&0&K10557222

>4030314AA__0000000000000000000000000&0
>
>The start similarly (USBSTOR\TYPE&PRODUCT%REVISION), but the rest is
>quite different. I wonder if this is meaningful…
>
>
>
>Best regards
>
>Rolf Schaeuble
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com