none
How to distinguish between identical USB devices? RRS feed

  • Question

  • I can have up to 4 specialized USB devices attached to a windows system.  They are identical in every way except for what they connect to in the outside world.  For this reason they must be kept distinct.  The application I am writing will allow a user to choose one of the devices the first time the app is run and then save the choice for subsequent runs. Once they are all attached to the computer and the OS booted, one can tell them apart by their unique Device Instance ID.  However, what happens under the following circumstances?

    1) The computer is rebooted.  Do the Device Instance ID's change? 

    2) The devices are removed and then plugged into different ports. Do the Device Instance ID's change?

    3) Are the devices enumerated during boot in the same order each time based on which ports are used?  It appears that the device driver maintains this internally but it is not clear how it determines which one is which.

    This may not have a solution but if I understand what would happen it might help.

    Thanks, Tom

    Thursday, December 7, 2017 3:06 AM

Answers

  • 1 remains the same 2 is the same if the device reports a serial number, different if it doesn’t 3 no guarantees about enumeration ordering. Do not take a dependency on it. After boot a device can be disabled and enabled, further disturbing an observed order. Once chosen, you set a property or value in the device node that you can retrieve on subsequent invocations of the app. The device node changes when the instance of changes. If you can have the device report a serial number, it will be your best path moving forward

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, December 7, 2017 3:20 AM

All replies

  • 1 remains the same 2 is the same if the device reports a serial number, different if it doesn’t 3 no guarantees about enumeration ordering. Do not take a dependency on it. After boot a device can be disabled and enabled, further disturbing an observed order. Once chosen, you set a property or value in the device node that you can retrieve on subsequent invocations of the app. The device node changes when the instance of changes. If you can have the device report a serial number, it will be your best path moving forward

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, December 7, 2017 3:20 AM
  • Hi,

    Thanks!  This device does not report a serial number.

    So, once I choose a device I can set a property in the device node.  I can then store this in the program I write.  The next time the application is run, I can then look to see if that property is set in the list of devices and if found I can use it.  If not, then I force a choice again.  Is that the idea?

    You say that the device node changes "when the instance of changes" .I don't quite get that?

    Thanks

    Thursday, December 7, 2017 3:31 AM
  • case2: if you plug the device into a new port, it gets a new instance ID.  this means it gets a new device node. this means that the property you set on the old instance will no longer be present.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Thursday, December 7, 2017 5:55 AM