• Dean Camera's avatar
    HID: hidraw: Add additional hidraw input/output report ioctls. · f43d3870
    Dean Camera authored
    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: default avatarDean Camera <dean@fourwalledcubicle.com>
    Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
    f43d3870
hid-example.c 3.87 KB