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

Charles Lepple clepple at ghz.cc
Mon Apr 20 03:20:37 UTC 2015


On Apr 19, 2015, at 10:15 PM, christopher.alan.becker at gmail.com wrote:

> 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?

http://lists.alioth.debian.org/pipermail/libhid-discuss/2008-February/000355.html

> 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).

SVN trunk was last updated six years ago - development has ceased.

You may want to consider this library instead: http://www.signal11.us/oss/hidapi/

-- 
- Charles Lepple
http://ghz.cc/charles/





More information about the libhid-discuss mailing list