libusb / hidapi

A Simple cross-platform library for communicating with HID devices
https://libusb.info/hidapi/
Other
1.69k stars 399 forks source link

hidraw hid_enumerate issue with vendor / product IDs #609

Closed ghost closed 1 year ago

ghost commented 1 year ago

The current code for hid_enumerate does not properly handle zero value product and vendor IDs. At present the code will check both product and vendor IDs for matches if either of them is non-zero, due to this conditional: vendor_id != 0 || product_id != 0. However the public header documentation implies they should be considered separately and not as a group. This is to allow you to get all devices matching the vendor id, product id, or both, or all devices period. However hidraw as written will only return devices matching both or all devices (if both are zero).

Youw commented 1 year ago

I don't believe that's true. There lines are making sure of that.

Is your observation based on visual code analysys or a result of your testing?

ghost commented 1 year ago

Nevermind, I got the impression because of the outer conditional.