Commit 1cc1cc92 authored by Brent Adam's avatar Brent Adam Committed by Jiri Kosina

HID: multitouch: Fix fields from pen report ID being interpreted for multitouch

Fields like HID_DG_CONTACTCOUNT are outside of the physical collection,
but within the application collection and report ID.  Make sure to catch
those fields that are not part of the mt_report_id and return 0 so they
can be processed with the pen.  Otherwise, the wrong HID_DG_CONTACTCOUNT
will be applied to cc_index and result in dereferencing a null pointer in
mt_touch_report.
Signed-off-by: default avatarBrent Adam <brentadam@smarttech.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.com>
parent c5b2b809
...@@ -778,9 +778,16 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, ...@@ -778,9 +778,16 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
/* /*
* some egalax touchscreens have "application == HID_DG_TOUCHSCREEN" * some egalax touchscreens have "application == HID_DG_TOUCHSCREEN"
* for the stylus. * for the stylus.
* The check for mt_report_id ensures we don't process
* HID_DG_CONTACTCOUNT from the pen report as it is outside the physical
* collection, but within the report ID.
*/ */
if (field->physical == HID_DG_STYLUS) if (field->physical == HID_DG_STYLUS)
return 0; return 0;
else if ((field->physical == 0) &&
(field->report->id != td->mt_report_id) &&
(td->mt_report_id != -1))
return 0;
if (field->application == HID_DG_TOUCHSCREEN || if (field->application == HID_DG_TOUCHSCREEN ||
field->application == HID_DG_TOUCHPAD) field->application == HID_DG_TOUCHPAD)
......
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