Ports and Interfaces > USB

multiple usb device with one host

(1/1)

kittu:
Hello,

i am working with multiple usb hid devices with same VID &PID

i want to run more than one lock with one pc for diffrent application.

but i cant differentiate them from each other as they are returning same handle.

is there anyway to differentiate this usb device from each other.


thanks.

Jan Axelson:
Each device gets its own handle. That's all you need unless you need to keep track of which is which after removing and reattaching. Then you can use serial numbers.

Jan

kittu:
Hi..

if with every hid device we get different handle.
 
then how we will read that handle(through which function)

is any windows function provided for this?

in my program i use find hid function IN WHICH I got the same handle for every hid device including my mouse & keyboard with my own hid devices

so i can not be differentiate with each other.

my differentiation  is based on my VID & PID

because of this i can use only one device with CPU for one application

I compare my hard coded VID PID with the VID PID that i read from function -HidD_GetAttributes (DeviceHandle, &Attributes);

Thank You.
          

Jan Axelson:
After detecting the first HID, continue searching for additional HIDs and use CreateFIle to open a handle to each HID you want to communicate with.

Jan

mdlayt:
It is hard to tell if your question is actually
  "How can I distinguish my devices from each other because they are the same?"
or
  "How do I keep track of multiple devices attached to one computer?"

Of course, Jan answered both.

If it is the first question, then you need to make them different, eg with serial numbers, or PIDs, or something you can query.

The devices show up differently depending on where they are in your USB topology and once you get a handle to one of them, that handle will always be for that same device.  (This is why Windows "reinstalls" your device each time you change the topology--eg plug it into a different port.)

Navigation

[0] Message Index

Go to full version