Slion / SharpLibHid

C# HID Library using Windows Raw Input.
http://publish.slions.net/HidDemo/
58 stars 18 forks source link

Handler ProcessInput does not filter registered devices #3

Closed suddenelfilio closed 5 years ago

suddenelfilio commented 5 years ago

I have 2 barcode readers from different vendors. I create a handler with 1 device from vendor A. However if I scan with reader from vendor B the Handler does process the input. I would expect it to ignore this because I did not pass that device when creating the Handler.

Is this by design?

Slion commented 5 years ago

If they have the same UsagePage and Usage that's the expected behaviour, yes. So if you register one keyboard you will get notifications from any keyboard.

However you should then be able to filter yourself per device using the Device property of the Event object.

That's just how the Windows API is working. You simply register for a UsagePage/Usage.

Arguably support for something like this could be implement in SharpLibHid. However I rather not as this is trivial to implement at the application level.