oblitum / Interception

The Interception API aims to build a portable programming interface that allows one to intercept and control a range of input devices.
http://oblita.com/interception
1.35k stars 269 forks source link

Hardware Id for USB Device #4

Closed MarioWallner closed 11 years ago

MarioWallner commented 11 years ago

Is it possible to get the device instance path for a USB keyboard instead of the HID Hardware ID using interception_get_hardware_id()?

Using your function i'll get:

HID\VID_413C&PID_2105&REV_0352

This makes it impossible to identify devices of the same type (vendor, product and revision are the same). If it's somehow possible to get the device instance path instead, which looks like this:

USB\VID_413C&PID_2105\6&2912A764&0&2

we could identify devices by its serial number (here: 2912A764)

I assume this is a driver level implementation, or am I wrong?

oblitum commented 11 years ago

Yes it's. If I remember correctly, the API I'm able to use in the position of the device stack the driver is may not return serial number. I would like to support this, but this is not easy or realiable.

That's why the API also provides a way to get a dynamic ID, as I say in http://oblita.com/interception. It's not fixed, but allows one do differentiate between devices from same vendor, there's no risk of having two equals dynamic ID's for two connected devices.

Have you tried to use both ways for identification?

MarioWallner commented 11 years ago

Thank's for your answer. Yes currently is use the dynamics ID's to differentiate the devices. I asked you, because I want to achieve the following:

I have 2 or more wireless Mouse / Keyboard combinations of the same manufacturer and I'm looking for a way to permanently map the mouse to the corresponding keyboard. Lets say I put a sticker with '#1' on a mouse and a keyboard pair so one user has his own input devices. This is possible until restart of the system with dynamic ID's and a 'calibration mechanism'. With serial numbers I could configure the device pairs once and they mapping persists thru system restart.

If it's not that easy, i'll go with the dynamic ID's and the calibration. Thanks for your time and effort in this great project.

oblitum commented 11 years ago

It's not easy I think, I have already looked into that matters, I'll close the issue but will not forget to try further when the time comes. Thanks.