aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/i2c-hid/i2c-hid.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/i2c-hid/i2c-hid.c')
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index ec7930217a6d..2b1799a3b212 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -563,6 +563,36 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf,
563 return ret; 563 return ret;
564} 564}
565 565
566static void i2c_hid_request(struct hid_device *hid, struct hid_report *rep,
567 int reqtype)
568{
569 struct i2c_client *client = hid->driver_data;
570 char *buf;
571 int ret;
572 int len = i2c_hid_get_report_length(rep) - 2;
573
574 buf = kzalloc(len, GFP_KERNEL);
575 if (!buf)
576 return;
577
578 switch (reqtype) {
579 case HID_REQ_GET_REPORT:
580 ret = i2c_hid_get_raw_report(hid, rep->id, buf, len, rep->type);
581 if (ret < 0)
582 dev_err(&client->dev, "%s: unable to get report: %d\n",
583 __func__, ret);
584 else
585 hid_input_report(hid, rep->type, buf, ret, 0);
586 break;
587 case HID_REQ_SET_REPORT:
588 hid_output_report(rep, buf);
589 i2c_hid_output_raw_report(hid, buf, len, rep->type);
590 break;
591 }
592
593 kfree(buf);
594}
595
566static int i2c_hid_parse(struct hid_device *hid) 596static int i2c_hid_parse(struct hid_device *hid)
567{ 597{
568 struct i2c_client *client = hid->driver_data; 598 struct i2c_client *client = hid->driver_data;
@@ -742,6 +772,7 @@ static struct hid_ll_driver i2c_hid_ll_driver = {
742 .open = i2c_hid_open, 772 .open = i2c_hid_open,
743 .close = i2c_hid_close, 773 .close = i2c_hid_close,
744 .power = i2c_hid_power, 774 .power = i2c_hid_power,
775 .request = i2c_hid_request,
745 .hidinput_input_event = i2c_hid_hidinput_input_event, 776 .hidinput_input_event = i2c_hid_hidinput_input_event,
746}; 777};
747 778