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

Andrew Silverman andrewsi at microsoft.com
Mon Apr 20 04:34:15 UTC 2015


If you're trying to rewrite the Linux tools for the ultimarc u360, I've already done it- posted on github under andrewsil1/ultrastik tools.

_____________
Andy




On Sun, Apr 19, 2015 at 9:15 PM -0700, "christopher.alan.becker at gmail.com" <christopher.alan.becker at gmail.com<mailto:christopher.alan.becker at gmail.com>> wrote:

Thanks Andrew and Charles for the responses.

@Andrew: At least now I know I'm not crazy :)

I'm working with a USB driver for a joystick that uses libhid. If I ever
have to rewrite it, I will definitely go down the HIDAPI route.

Much appreciated!


~ Chris

On 4/19/2015 9:18 PM, Andrew Silverman wrote:
> My recollection is that this is already a known bug that was never officially patched, as evidently libhid has long since been considered obsolete in favor of newer HID libraries (http://www.signal11.us/oss/hidapi/).  I have the same change in my own code that still works with the existing library.
>
> -----Original Message-----
> From: libhid-discuss [mailto:libhid-discuss-bounces+andrewsi=microsoft.com at lists.alioth.debian.org] On Behalf Of christopher.alan.becker at gmail.com
> Sent: Sunday, April 19, 2015 7:15 PM
> To: libhid-discuss at lists.alioth.debian.org
> Subject: [libhid-discuss] LIBHID: Latest SVN Trunk: hid_opening.c: hid_compare_usb_device(): product_id matched incorrectly
>
> 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
>
> _______________________________________________
> libhid-discuss mailing list
> libhid-discuss at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/libhid-discuss
> http://libhid.alioth.debian.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20150420/18051a26/attachment.html>


More information about the libhid-discuss mailing list