Discussion:
[libhid-discuss] Matching usb devices
Arnold Spence
2008-10-09 03:31:49 UTC
Permalink
Hi all, good work on this project..

I was wondering if anyone knows why the hid_compare_usb_device function does
a bitwise AND of the vendor and product IDs? For example, the product ID is
matched with the following code..

if (dev->descriptor.idVendor > 0 && (dev->descriptor.idVendor &
match->vendor_id) == match->vendor_id)

The problem I'm having is this. If all the 1s in the descriptor.idVendor
match the 1s in the vendor_id I'm looking for, it will register as a match
when in fact they are different IDs. I can work around this by taking
advantage of the custom match function but wanted to run this by somebody.

Thanks.
--
Arnold
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20081009/84d0e8aa/attachment.htm
Charles Lepple
2008-10-09 11:45:28 UTC
Permalink
Post by Arnold Spence
The problem I'm having is this. If all the 1s in the
descriptor.idVendor match the 1s in the vendor_id I'm looking for,
it will register as a match when in fact they are different IDs. I
can work around this by taking advantage of the custom match
function but wanted to run this by somebody.
It's legacy code, due to be replaced sometime. You're on the right
track with the custom match function.
--
Charles Lepple


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20081009/87442dc8/attachment.htm
Loading...