lkml.org 
[lkml]   [2014]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 02/11] HID: i2c-hid: implement ll_driver transport-layer callbacks
    Date
    Add output_report and raw_request to i2c-hid.
    Hopefully, we will manage to have the same transport level between
    all the transport drivers.

    Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
    ---
    drivers/hid/i2c-hid/i2c-hid.c | 24 ++++++++++++++++++++++++
    1 file changed, 24 insertions(+)

    diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
    index ce68a12..5099f1f 100644
    --- a/drivers/hid/i2c-hid/i2c-hid.c
    +++ b/drivers/hid/i2c-hid/i2c-hid.c
    @@ -574,6 +574,28 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf,
    return ret;
    }

    +static int i2c_hid_output_report(struct hid_device *hid, __u8 *buf,
    + size_t count)
    +{
    + return i2c_hid_output_raw_report(hid, buf, count, HID_OUTPUT_REPORT);
    +}
    +
    +static int i2c_hid_raw_request(struct hid_device *hid, unsigned char reportnum,
    + __u8 *buf, size_t len, unsigned char rtype,
    + int reqtype)
    +{
    + switch (reqtype) {
    + case HID_REQ_GET_REPORT:
    + return i2c_hid_get_raw_report(hid, reportnum, buf, len, rtype);
    + case HID_REQ_SET_REPORT:
    + if (buf[0] != reportnum)
    + return -EINVAL;
    + return i2c_hid_output_raw_report(hid, buf, len, rtype);
    + default:
    + return -EIO;
    + }
    +}
    +
    static void i2c_hid_request(struct hid_device *hid, struct hid_report *rep,
    int reqtype)
    {
    @@ -761,6 +783,8 @@ static struct hid_ll_driver i2c_hid_ll_driver = {
    .close = i2c_hid_close,
    .power = i2c_hid_power,
    .request = i2c_hid_request,
    + .output_report = i2c_hid_output_report,
    + .raw_request = i2c_hid_raw_request,
    };

    static int i2c_hid_init_irq(struct i2c_client *client)
    --
    1.8.3.1


    \
     
     \ /
      Last update: 2014-02-02 06:43    [W:3.027 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site