aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>2013-01-31 11:22:23 -0500
committerJiri Kosina <jkosina@suse.cz>2013-02-05 06:07:39 -0500
commit6d85d037d6247b06e1060b5e5ad0e4854a7d1e3b (patch)
treed2340762020aa4c8512a21d74f564d73d3f9fde8
parentcf5425bfcd6909f9831a00bc06ccb9a5b163766a (diff)
HID: core: add "report" hook, called once the report has been parsed
This callback is called when the parsing of the report has been done by hid-core (so after the calls to .event). The hid drivers can now have access to the whole report by relying on the values stored in the different fields. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-core.c4
-rw-r--r--include/linux/hid.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index eb2ee11b6412..754098a7dd47 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1195,6 +1195,7 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1195{ 1195{
1196 struct hid_report_enum *report_enum = hid->report_enum + type; 1196 struct hid_report_enum *report_enum = hid->report_enum + type;
1197 struct hid_report *report; 1197 struct hid_report *report;
1198 struct hid_driver *hdrv;
1198 unsigned int a; 1199 unsigned int a;
1199 int rsize, csize = size; 1200 int rsize, csize = size;
1200 u8 *cdata = data; 1201 u8 *cdata = data;
@@ -1231,6 +1232,9 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
1231 if (hid->claimed != HID_CLAIMED_HIDRAW) { 1232 if (hid->claimed != HID_CLAIMED_HIDRAW) {
1232 for (a = 0; a < report->maxfield; a++) 1233 for (a = 0; a < report->maxfield; a++)
1233 hid_input_field(hid, report->field[a], cdata, interrupt); 1234 hid_input_field(hid, report->field[a], cdata, interrupt);
1235 hdrv = hid->driver;
1236 if (hdrv && hdrv->report)
1237 hdrv->report(hid, report);
1234 } 1238 }
1235 1239
1236 if (hid->claimed & HID_CLAIMED_INPUT) 1240 if (hid->claimed & HID_CLAIMED_INPUT)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 7330a0fef0c0..9f56e9040f66 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -589,6 +589,7 @@ struct hid_usage_id {
589 * @raw_event: if report in report_table, this hook is called (NULL means nop) 589 * @raw_event: if report in report_table, this hook is called (NULL means nop)
590 * @usage_table: on which events to call event (NULL means all) 590 * @usage_table: on which events to call event (NULL means all)
591 * @event: if usage in usage_table, this hook is called (NULL means nop) 591 * @event: if usage in usage_table, this hook is called (NULL means nop)
592 * @report: this hook is called after parsing a report (NULL means nop)
592 * @report_fixup: called before report descriptor parsing (NULL means nop) 593 * @report_fixup: called before report descriptor parsing (NULL means nop)
593 * @input_mapping: invoked on input registering before mapping an usage 594 * @input_mapping: invoked on input registering before mapping an usage
594 * @input_mapped: invoked on input registering after mapping an usage 595 * @input_mapped: invoked on input registering after mapping an usage
@@ -627,6 +628,7 @@ struct hid_driver {
627 const struct hid_usage_id *usage_table; 628 const struct hid_usage_id *usage_table;
628 int (*event)(struct hid_device *hdev, struct hid_field *field, 629 int (*event)(struct hid_device *hdev, struct hid_field *field,
629 struct hid_usage *usage, __s32 value); 630 struct hid_usage *usage, __s32 value);
631 void (*report)(struct hid_device *hdev, struct hid_report *report);
630 632
631 __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf, 633 __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf,
632 unsigned int *size); 634 unsigned int *size);