diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2020-11-26 09:39:57 +1100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2020-11-27 15:48:31 +0100 |
commit | f43d3870cafa2a0f3854c1819c8385733db8f9ae (patch) | |
tree | cf265121361d49572f7941734bffaa3b4611e386 /samples/hidraw | |
parent | 6a0eaf5123e0e1223252b88cd5775f74105e27bd (diff) | |
download | linux-f43d3870cafa2a0f3854c1819c8385733db8f9ae.tar.bz2 |
HID: hidraw: Add additional hidraw input/output report ioctls.
Currently the hidraw module can only read and write feature HID reports on
demand, via dedicated ioctls. Input reports are read from the device through
the read() interface, while output reports are written through the write
interface().
This is insufficient; it is desirable in many situations to be able to read and
write input and output reports through the control interface to cover
additional scenarios:
- Reading an input report by its report ID, to get initial state
- Writing an input report, to set initial input state in the device
- Reading an output report by its report ID, to obtain current state
- Writing an output report by its report ID, out of band
This patch adds these missing ioctl requests to read and write the remaining
HID report types. Note that not all HID backends will neccesarily support this
(e.g. while the USB link layer supports setting Input reports, others may not).
Also included are documentation and example updates. The current hidraw
documentation states that feature reports read from the device does *not*
include the report ID, however this is not the case and the returned report
will have its report ID prepended by conforming HID devices, as the report data
sent from the device over the control endpoint must be indentical in format to
those sent over the regular transport.
Signed-off-by: Dean Camera <dean@fourwalledcubicle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'samples/hidraw')
-rw-r--r-- | samples/hidraw/hid-example.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/samples/hidraw/hid-example.c b/samples/hidraw/hid-example.c index 37a0ffcb4d63..0f73ace3c6c3 100644 --- a/samples/hidraw/hid-example.c +++ b/samples/hidraw/hid-example.c @@ -128,7 +128,7 @@ int main(int argc, char **argv) perror("HIDIOCGFEATURE"); } else { printf("ioctl HIDIOCGFEATURE returned: %d\n", res); - printf("Report data (not containing the report number):\n\t"); + printf("Report data:\n\t"); for (i = 0; i < res; i++) printf("%hhx ", buf[i]); puts("\n"); |