hid_compare_usb_device() returns false positives for devices with
similar vendor or product ids.
In the current code we check:
"if ((dev->descriptor.idProduct & match->product_id) == match->product_id)"
However, "(dev->descriptor.idProduct & match->product_id) ==
match->product_id" does not imply that dev->descriptor.idProduct ==
match->product_id.
Example:
idProduct = 0x0011
product_id = 0x0001
idProduct & product_id == 0x0001
Let me know if the patch is not formatted properly,
Christopher Berner
Index: src/hid_opening.c
===================================================================
--- src/hid_opening.c (revision 362)
+++ src/hid_opening.c (working copy)
@@ -77,14 +77,14 @@
TRACE("inspecting vendor ID...");
if (dev->descriptor.idVendor > 0 &&
- (dev->descriptor.idVendor & match->vendor_id) == match->vendor_id) {
+ (dev->descriptor.idVendor == match->vendor_id)) {
TRACE("match on vendor ID: 0x%04x.", dev->descriptor.idVendor);
ret |= USB_MATCH_VENDOR;
}
else TRACE("no match on vendor ID.");
TRACE("inspecting product ID...");
- if ((dev->descriptor.idProduct & match->product_id) == match->product_id) {
+ if ((dev->descriptor.idProduct == match->product_id)) {
TRACE("match on product ID: 0x%04x.", dev->descriptor.idProduct);
ret |= USB_MATCH_PRODUCT;
}
_______________________________________________
libhid-discuss mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss