-
Notifications
You must be signed in to change notification settings - Fork 398
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_get_input_report: Correct number of bytes_returned #232
Conversation
And definitely breaks something else |
What does it break? Do you have an example of an HID device where the old code returned the correct number of bytes? Can you share the HID Report Descriptor of this device and the number of read bytes returned? |
So I guess |
@todbot any chance you could take a look at this? I don't have any device that uses all of: feature, input and interrupt reports. |
ping @todbot |
While unable to verify it myself, I tried to check MS documentation for details on What bothers me here, is that same applies for But: @JoergAtGithub, any chance you can verify the behavior of |
Why do you expect reading 3 bytes, if report size for both of the reports is 8 as per descriptor? |
1 byte ReportID + ReportSize (8Bit) * ReportCount(2) |
In such case we're at square 1 again, as without this patch you'd get 2 and 3 byts. What about the content of the buffer? Is it updated as expected? |
I patched hid_get_input_report, and tested as requested hid_get_feature_report. The later is not related to my patch. |
I understad that. I'm just trying to get the full picture, as I'd expect an idential usage from two almost identical functions with pretty much identical API. |
One more thing. |
Win7 |
http://janaxelson.com/hidpage.htm |
I will try to dig out my device with my test FW last time I used to test libusb Windows HID backend. It is a simple mod of Jan's Generic HID FW. |
So I just got my example up and running with libusb HID backend. I need to update my test code (INTERFACE to MYINTERFACE to avoid conflict) a bit. First pair (char) is report ID (Out report ID and Input report ID), the results seems to be okay I will see if I can translate the code to hidapi and then test again.
|
I think I can use hidapitester.
|
From my test, it seems to me the input report is correct with hidapi.
|
From my test, it seems to me there is an issue with feature report readback with hidapi. It says reading 4 bytes.
|
Report Descriptor of the device.
|
Unfortunately hidapitester does not test the correctness of hid_get_input_report(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the changes is correct based on my testing and analysis in #229. Similar changes need to be implemented for feature report as well.
The change is also confirmed by Tim Roberts' answer to my query in libusb-devel mailing list. Similar changes need to be implemented for feature report as well. |
@JoergAtGithub or @Youw Is it possible for you to create another pull request for feature report? I am poor at git myself and I do not want to touch the code for hidapi (or libusb as well).
|
Yes, I will. |
This originally tested/confirmed by @mcuee. Confirmed the expected behavior by Tim Roberts https://sourceforge.net/p/libusb/mailman/message/37303650/. Relates to: #232.
This fixes #229