Author Topic: InstanceID for detecting devices ?  (Read 2387 times)

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
InstanceID for detecting devices ?
« on: September 25, 2009, 06:18:52 am »
Hi Roman,

I´m actually starting to implement the TnrHid component to our application. In the past we only used  serial ports so it´s a little bit tricky to get the HID interface working the same way  :)

For our serial devices we store the COM port into an INI file. If you reload the device it´s an easy task to detect if the port is available and reuse it. But if you take a look at HID devices (or in general USB devices) you will get into some little trouble. There is not one port with a specific number - there are only USB ports ....  :P

Ok, now I´m trying to find out if there is any property which is usefull to detect the device again. This is needed for the following scenario:
* Software has detected the device and uses it with an USB port
* Software is closed
* Software starts again ...

If the device is at the same port the InstanceID won´t change. And it won´t change if you restart the computer, too. I´ve checked that on a Windows 2000 system.

So in that case that the device was not connected to another USB Port this would be a solution to redetect the device?
The only thing which can´t be detected is changing  the device itself on the same USB port (if the devices are the same). But this case isn´t so important for us.
But if you have 2 identical devices on two different USB ports it would be possible to redetect the used device?

btw. could you give me / us a short description what the InstanceID is about? The first part is ok but what is the second part (bold)?
HID\VID_18EF&PID_E013\6&24F09737&0&0000

Greetz
   Dominik

moelski

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: InstanceID for detecting devices ?
« Reply #1 on: September 26, 2009, 03:43:54 am »
Hi Roman,

forget about the answer. I got it myself  8)
http://msdn.microsoft.com/en-us/library/dd567983.aspx