Commit b1a1442a authored by Jiri Kosina's avatar Jiri Kosina

HID: core: fix reporting of raw events

hdrw->raw event can return three different return value types:

- ret < 0	indicates that the hdrv driver found an error while parsing
- ret == 0	indicates no error has been encountered, and the driver has
          	processed the report
- ret > 0	indicates that there was no parsing error, and the driver hasn't
		processed the event.

Calling hid_report_raw_event() has to be called appropriately so that it
reflects what has been done by ->raw_event() callback, otherwise we might
updates of the in-kernel structure are lost upon arrival of the report, which
is wrong.
Reported-and-tested-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reported-and-tested-by: default avatarDaniel Leung <daniel.leung@linux.intel.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 68e353fe
...@@ -1293,7 +1293,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i ...@@ -1293,7 +1293,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i
if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) { if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
ret = hdrv->raw_event(hid, report, data, size); ret = hdrv->raw_event(hid, report, data, size);
if (ret != 0) { if (ret < 0) {
ret = ret < 0 ? ret : 0; ret = ret < 0 ? ret : 0;
goto unlock; goto unlock;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment