-
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
RFC: to include hidapitester as it is a very useful tool for debugging #285
Comments
Only issue to include hidapitester is probably the GPL 3 license, which may or may not be a problem. I do not see it as a problem. But if some people see it as a problem, we can ask @todbot to see if he is willing to change the license. |
@todbot How do you like the idea of including hidapitester in HIDAPI project? |
Sounds great to me |
I can change the license to whatever is most useful |
HIDAPI license: hidapitester is already licensed under GPL3, just need to add the other two licenses. |
Just FYI on the original hidtest, it is based on Microchip Demo FW (part of Microchip USB Stack) but I do not know if Alan Ott published the modified FW or not. With the original FW (04d8:003f), here is the output.
|
With the enhancement for hidtest, it is of course worth to keep it now. But still I think hidapitester is a worthy add-on for the hidapi project as it is useful for different type of HID devices. |
Example run log of hidapitester with a modified Lakeview Research Generic HID example. Device: input report ID 1, output report ID 2, feature in report id 3 and feature output report id 4. From the run log, it seems that my FW sent an extra byte for the Feature IN report. But I need to check again under different OS.
With the libusb test code, here is the output. Take note I purposefully send one more byte.
|
Test under Linux (Raspberry Pi 400), hidapitester performs fine (tested with the hidraw backend).
|
@todbot It seems to me that hidapitester report reading of one more bytes for the Feature report under Windows. Not so sure if this is a problem with hidapitester or hidapi under Windows. If it is related to hidapi under Windows, the test gui seems to be correct. That is strange. |
hidapitester is using hidapi directly, and not doing anything platform-specific. If there's a byte miscount, I think it's either in the testgui or the build of hidapitester you're using uses a hidapi with off-by-one errors (this used to exist in hidapi for certain situations, I forget the details at the moment) |
It could be an hidapi issue under Windows in the end. Here is the test result from the original generic HID example here: The C# based GUI application works fine. And the libusb1 hid backend works fine with the off-by-one fix libusb/libusb#986 Host libusb1 codes:
|
hidapitester output: total number of read bytes seems to be correct (2 bytes). But the data read seems to be not consistent between input report and feature report. I think we probably need to report reading 3 bytes for the Feature In report, including the report id 0. Let me try other os as well.
|
@todbot In the end I think hidapitester is good. |
@Youw : please take a look as well for the feature report. Thanks. Ref:
|
My recommendation is to discard the report id 0 for feature report under Windows, to be consistent with input report handing under Windows, and also other OS. Edit: this may not be correct. From the Linux hidapitester output, indeed there is a difference in dealing with input report the feature report. Not so sure if this is because of API difference or real different on the wire. |
Output under Linux:
Output under macOS (Mac Mini M1, macOS Big Sur ARM64), same as Linux.
|
Hopefully other Windows users can chime in and test latest git of hidapi to see if there is a real issue for the feature report or not. |
Just tried hidapitester with hidapi-0.10.1 release and hidapi git head, with regard to input report, the result is the same since it is using hid_read_timeout(). So #232 does not matter in that case. With regard to feature report, then the result will be different as it uses hid_get_feature_report(). So commit 6fcb0bb does matter for getting the feature report. In this particular case without report id (report id zero), it seems to me the commit is not correct.
|
For those with report id, commit 6fcb0bb seems to be correct.
|
Here is a quick hack of hidapitester with libusb backend (todbot/hidapitester#8) With patched libusb-1.0.dll (libusb/libusb#986), it works fine.
hidapitester_mingw64_libusb.zip It also works fine with devices with report ids (my mod FW of the above generic hid example from Jan Axelson).
|
All in all, hidapitester is okay. But we may need to fix hidapi under Windows, for reading of feature report. Therefore I have created an issue #328. |
I will close this as hidapitester is already mentioned in hidapi README.md. |
hidtest is using a test device based on modified Microchip Simple HID demo. It can be kept as an example but not that useful as a test tool for the project.
hidapitester is an excellent tool for testing of HID devices and HIDAPI. It will be good to include it in HIDAPI.
https://github.com/todbot/hidapitester
The text was updated successfully, but these errors were encountered: