diff options
| -rw-r--r-- | drivers/hid/i2c-hid/i2c-hid.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index ec7930217a6d..935f387be95a 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
| @@ -563,6 +563,37 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf, | |||
| 563 | return ret; | 563 | return ret; |
| 564 | } | 564 | } |
| 565 | 565 | ||
| 566 | static 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 | struct i2c_hid *ihid = i2c_get_clientdata(client); | ||
| 571 | char *buf; | ||
| 572 | int ret; | ||
| 573 | |||
| 574 | buf = kzalloc(ihid->bufsize, 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, ihid->bufsize, | ||
| 581 | rep->type); | ||
| 582 | if (ret < 0) | ||
| 583 | dev_err(&client->dev, "%s: unable to get report: %d\n", | ||
| 584 | __func__, ret); | ||
| 585 | else | ||
| 586 | hid_input_report(hid, rep->type, buf, ret, 0); | ||
| 587 | break; | ||
| 588 | case HID_REQ_SET_REPORT: | ||
| 589 | hid_output_report(rep, buf); | ||
| 590 | i2c_hid_output_raw_report(hid, buf, ihid->bufsize, rep->type); | ||
| 591 | break; | ||
| 592 | } | ||
| 593 | |||
| 594 | kfree(buf); | ||
| 595 | } | ||
| 596 | |||
| 566 | static int i2c_hid_parse(struct hid_device *hid) | 597 | static int i2c_hid_parse(struct hid_device *hid) |
| 567 | { | 598 | { |
| 568 | struct i2c_client *client = hid->driver_data; | 599 | struct i2c_client *client = hid->driver_data; |
| @@ -742,6 +773,7 @@ static struct hid_ll_driver i2c_hid_ll_driver = { | |||
| 742 | .open = i2c_hid_open, | 773 | .open = i2c_hid_open, |
| 743 | .close = i2c_hid_close, | 774 | .close = i2c_hid_close, |
| 744 | .power = i2c_hid_power, | 775 | .power = i2c_hid_power, |
| 776 | .request = i2c_hid_request, | ||
| 745 | .hidinput_input_event = i2c_hid_hidinput_input_event, | 777 | .hidinput_input_event = i2c_hid_hidinput_input_event, |
| 746 | }; | 778 | }; |
| 747 | 779 | ||
