[libhid-discuss] Bug in hid_opening: hid_compare_usb_device()

Charles Lepple clepple at ghz.cc
Tue Feb 5 00:11:07 UTC 2008


On Feb 4, 2008, at 1:36 PM, Warren Jasper wrote:

>          if (dev->descriptor.idVendor & match->vendor_id) ==
> match->vendor_id) {
>
> and
>
>   if ((dev->descriptor.idProduct & match->product_id) ==
> match->product_id) {
>
> are wrong.

"Not the way I would do it" does not always equal "wrong". This makes  
it easy to open up any device whose product ID matches a mask  
(although I admit the names do not immediately suggest that the match- 
 >*_id members are masks-- this was more obvious in the old libHID  
code).

Is anyone else depending on this behavior? (Martin, I cc'd you  
because of libphidgets - does it still use libhid as-is?)

This is something that a custom matching function can take care of,  
though.

-- 
Charles Lepple





More information about the libhid-discuss mailing list