]> git.baikalelectronics.ru Git - kernel.git/commit
HID: hidraw: Add additional hidraw input/output report ioctls.
authorDean Camera <dean@fourwalledcubicle.com>
Wed, 25 Nov 2020 22:39:57 +0000 (09:39 +1100)
committerJiri Kosina <jkosina@suse.cz>
Fri, 27 Nov 2020 14:48:31 +0000 (15:48 +0100)
commit721e8491f085d922e8833d3be4ba5e2538c8ada5
treecf265121361d49572f7941734bffaa3b4611e386
parent1c38ede7681f99a569430ff6ea548f4df7590cbc
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>
Documentation/hid/hidraw.rst
drivers/hid/hidraw.c
include/uapi/linux/hidraw.h
samples/hidraw/hid-example.c