-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hid_enumerate() gives unexpected device instances #155
Comments
|
Thank you for your answer. |
As @Youw mentioned, you need to filter by "usage" and "usage_page" in addition to "vendor_id" and "product_id". You probably should not rely on filtering by strings. |
Thanks, @todbot ! |
HID usage and usage_pages settings in the HID report descriptor and are used to describe to the OS what kind of HID device it is. Common usages (like mouse, keyboard) will be seen by the OS and owned by them. You can get a list of common usages by looking at this PDF: https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf |
This reverts commit ca1a2d6. Currently breaks razer_test, see libusb#155
I also discovered today that this breaks my application on macOS. I'm currently checking for |
I suspect you haven't used your application on Windows? |
I actually did run it on Windows a couple of times before (limited testing but still) and never saw an issue like that. |
Windows always separates different usage/usage_page into a different logical devices would you be able to share a list of enumerated devices on Windows and macOS (with order preserved)? in that case it would allow us to have same behavior on Windows and macOS AND don't break your (and others) application |
Thank you all of you. I think my problem is solved. |
Care to share what was the solution?) |
usage_page and usage along with vendor_id and product_id, combination of those values can be identifier. |
Just for completeness, the fix in my software is this: - if (cur_dev->interface_number != 0) {
+ if (cur_dev->usage_page != 0x1 || cur_dev->usage != 0x80) { |
hid_enumerate() works well on Windows and was able to find the correct port by dev->product_string.
However, on Mac, hid_enumerate() gives three instances of hid_device_info and they all include same product_string and none of them are what I expected.
This is the code.
I debugged the app and found that string "transport" in dev->path as a substring in it.
Of course, windows code is a little bit different but logic is same as this.
I'd like to know what the problem is and how I can solve this.
The text was updated successfully, but these errors were encountered: