[libhid-discuss] LIBHID: Latest SVN Trunk: hid_opening.c: hid_compare_usb_device(): product_id matched incorrectly

christopher.alan.becker at gmail.com christopher.alan.becker at gmail.com
Mon Apr 20 02:15:13 UTC 2015


Hi:

I ran into a situation with libhid where a USB product  ID of 0x0501 was 
matching on a USB device with a product ID of 0x0503.  I narrowed it 
down in hid_compare_usb_device() to the line below:
-----
((dev->descriptor.idProduct & match->product_id) == match->product_id)
-----

Tracing the values of the above, both match and dev descriptor, the 
values were showing correct (0x0501, 0x0503), but still evaluating as 
matched.

If I change the above code to just:
-----
(dev->descriptor.idProduct == match->product_id)
-----

Then the product ID's match correctly, and only 0x0501 matches 0x0501.  
Any ideas on why 0x0503 would match 0x0501 on the original code?

Actual hex codes were set/used in the passed HIDInterfaceMatcher struct.

As a side note, the vendor ID did not experience this problem. Latest 
SVN trunk (2015-04-19).

Thanks.


~ Chris



More information about the libhid-discuss mailing list