]> Pileus Git - ~andy/linux/commitdiff
HID: core: add "report" hook, called once the report has been parsed
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>
Thu, 31 Jan 2013 16:22:23 +0000 (17:22 +0100)
committerJiri Kosina <jkosina@suse.cz>
Tue, 5 Feb 2013 11:07:39 +0000 (12:07 +0100)
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>
drivers/hid/hid-core.c
include/linux/hid.h

index eb2ee11b6412ac43e9baa08596b881d92c8430e3..754098a7dd47be7a616942bae0883c1467607df2 100644 (file)
@@ -1195,6 +1195,7 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
 {
        struct hid_report_enum *report_enum = hid->report_enum + type;
        struct hid_report *report;
+       struct hid_driver *hdrv;
        unsigned int a;
        int rsize, csize = size;
        u8 *cdata = data;
@@ -1231,6 +1232,9 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
        if (hid->claimed != HID_CLAIMED_HIDRAW) {
                for (a = 0; a < report->maxfield; a++)
                        hid_input_field(hid, report->field[a], cdata, interrupt);
+               hdrv = hid->driver;
+               if (hdrv && hdrv->report)
+                       hdrv->report(hid, report);
        }
 
        if (hid->claimed & HID_CLAIMED_INPUT)
index 7330a0fef0c073b41a409882145eb36add87dc02..9f56e9040f668cfb5d88c34a85ff90c7a8fd513e 100644 (file)
@@ -589,6 +589,7 @@ struct hid_usage_id {
  * @raw_event: if report in report_table, this hook is called (NULL means nop)
  * @usage_table: on which events to call event (NULL means all)
  * @event: if usage in usage_table, this hook is called (NULL means nop)
+ * @report: this hook is called after parsing a report (NULL means nop)
  * @report_fixup: called before report descriptor parsing (NULL means nop)
  * @input_mapping: invoked on input registering before mapping an usage
  * @input_mapped: invoked on input registering after mapping an usage
@@ -627,6 +628,7 @@ struct hid_driver {
        const struct hid_usage_id *usage_table;
        int (*event)(struct hid_device *hdev, struct hid_field *field,
                        struct hid_usage *usage, __s32 value);
+       void (*report)(struct hid_device *hdev, struct hid_report *report);
 
        __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf,
                        unsigned int *size);