-
Notifications
You must be signed in to change notification settings - Fork 396
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
Possible regression in mac get_feature_report #60
Comments
Can you describe how different is it? |
The message that it is sending on the mac does not appear to include the report ID, so my device reports an error. If I write the rid in both the 1st and 2nd byte it sends the rid as part of the report. However I get a response on the mac of rid, rid, bytes as the mac library is writing the response out starting at the 2nd byte rather then the 1st. Prior to this change it worked correctly. Other platforms include the rid in the (outbound) report and responded with the expected rid, bytes. I wasn't using homebrew, I am building this myself. I was using Signal11/HidAPI (where it worked) but am trying to switch to yours as it is maintained. Once I reverted this pull everything worked as it did before. |
Documentation of IOHIDDeviceGetReport is very explicit, that Can you confirm, that rid is other than 0x0 ? |
I agree that it is very explicit, that's why I asked if anyone else experienced this issue. In this case the report id values that are not working are 0x14, 0x15 and 0x16. It is possible that there is something out of spec with the device I have been using for testing. However it works just fine on all other platforms and on mac without this change. |
What's happening at a protocol level (see section 8.2 of HID 1.11 spec), is that the Report ID will be removed from a response when a device doesn't use Report IDs. This leaves some gaps – it's now up to the kernel to figure out if there's a report ID in there or not. HID has other platform differences:
macOS's documentation suggests that it should never return a report ID, and the patch in #3 would change it to make it like all the others. However, I don't think I have something that uses multiple feature descriptors. Running captures on But doing a request with But, the more I look at this, the more that I see the API is unclear in the first instance. I'm of the opinion that returning a Chromium's mac implementation of this may be a useful reference I think the best way to solve this is to explicitly break compatibility with all callers, with a new method signature that makes intent clearer: int hid_get_feature_report(hid_device *dev, unsigned char report_id, unsigned char* buffer, size_t length);
What is needed here is XHC20 (USB) captures from your software and device running with and without PR #3 on macOS. I suspect there is some other weirdness going on here. You'll need to bring up XHC20 with Then compare it to other platforms with the same code. |
yeah, looks like that documentation isn't right (even though it was written by the same person, as hidapi itself)
this is questionable solution:
|
I did my best to understand Chromium's implementation if HID Get/SetFuature report, and so far I come to a conclusion, that To properly know, whether device is using numbered reports or not, it would require parsing device's descriptor and searching if there defined at least one Report ID. (And that is exactly what Chromium's implementation does (e.g. here and here), and I believe that is the right way to do it). So far, Even though it looks like a proper fix to me, I don't have a devices to verify, and it probably may break existing application on macOS, that are already using builds before #3 or after (since patch #3 was applied to homebrew's formula for some while). My personal observation: I have one HID device (and the application), that uses numbered reports, and #3 broke that application on macOS (I'm still using a local copy of hidapi for that one with a few patches on my own for now). |
Fixed with #70 |
Prior to /pull/3 being merged get_feature_report was working identically for me on all platforms. Now the mac driver is failing as the returned buffer is different from the other platforms. My device does use report ids.
Is it possible that the behavior of OSX was changed from when this change was originally requested back in 2015?
Can anyone reproduce this issue?
The text was updated successfully, but these errors were encountered: