Skip to content
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

hidraw support for hid_get_input_report + missing other combinations #258

Closed
smunaut opened this issue Apr 7, 2021 · 3 comments
Closed
Labels
hidraw Related to Linux/hidraw backend

Comments

@smunaut
Copy link

smunaut commented Apr 7, 2021

Looking at the hidraw API I see thos ioctl :

HIDIOCSINPUT
HIDIOCGINPUT
HIDIOCSOUTPUT
HIDIOCGOUTPUT

which is exactly the functions I'd need for a device I have here but :

  • hid_get_input_report is the only function I see in the API and it's not implemented for hidraw
  • There is no function for the other combination like hid_set_input_report / hid_get_output_report / hid_set_output_report
@Youw
Copy link
Member

Youw commented Apr 7, 2021

hid_set_output_report = hid_write (hid_write is even a bit more flexible from functional point of view)

hid_get_output_report/hid_set_input_report - I don't believe HID standard defines this operations. USB implementation defines it, but others may not. Windows backend definitely doesn't support those.
macOS backend technically could implement such thing, but I'm not sure whether it is functional.
And of course, the device itself has to support such operation.

Please keep in mind, that hidapi is a cross-platform library in a first place, and it is not intended to implement platform-specific things or non-standard extensions.


As for get_input_report implementation on hidraw backend - Linux kernel itself didn't support it as far as 4 months ago, so that one is yet to be added to hidapi.

@Youw Youw added the hidraw Related to Linux/hidraw backend label Apr 7, 2021
@smunaut
Copy link
Author

smunaut commented Apr 7, 2021

hid_set_output_report - But won't hid_write the OUT interrupt EP if a device has such a thing instead of doing a control transfer ?
hid_get_input_report - Yeah, right it's recent, I didn't check the history of the kernel to see when it was done, I just opened the latest hidraw doc.

Anyway, feel free to close, turns out that I misread the trace ... (the raw hw capture usb trace showed a SET/GET_REPORT but I missed the fact the report type was set to feature 🤦 ).

@Youw
Copy link
Member

Youw commented Apr 7, 2021

But won't hid_write the OUT interrupt EP if a device has such a thing instead of doing a control transfer ?

That's what I called "more flexible". I find interrupt endpoints more prefereble for cases where they can be used.


Anyway, thanks for pointing out to a new Kernel API - I haven't checked for it recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hidraw Related to Linux/hidraw backend
Projects
None yet
Development

No branches or pull requests

2 participants