linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: wacom: Stop mapping touch usages after processing HID_DG_CONTACTCOUNT
@ 2016-07-11 17:59 Jason Gerecke
  2016-07-12  7:32 ` Benjamin Tissoires
  0 siblings, 1 reply; 11+ messages in thread
From: Jason Gerecke @ 2016-07-11 17:59 UTC (permalink / raw)
  To: linux-input
  Cc: Ping Cheng, Aaron Skomra, Benjamin Tissoires, Jason Gerecke,
	Jason Gerecke

If a touchscreen contains both multitouch and single-touch reports in its
descriptor in that order, the driver may overwrite information it saved
about the format of the multitouch report. This can cause the report
processing code to get tripped up and send an incorrect event stream to
userspace.

In particular, this can cause last_slot_field to be overwritten with the
result that the driver prematurely assumes it has finished processing a
slot and sending the ABS_MT_SLOT event at the wrong point in time,
associating events for the current contact with the following contact
instead.

To prevent this from occuring, we stop mapping usages after having seen
HID_DG_CONTACTCOUNT. This usage is only present in multitouch reports,
so the format of any following single-touch reports will have no effect.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
---
 drivers/hid/wacom_wac.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index fcf2264..e499cdb 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1560,6 +1560,11 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
 	struct input_dev *input = wacom_wac->touch_input;
 	unsigned touch_max = wacom_wac->features.touch_max;
 
+	/* stop processing after the first multitouch report */
+	if (wacom_wac->hid_data.cc_report &&
+	    wacom_wac->hid_data.cc_report != field->report->id)
+		return;
+
 	switch (usage->hid) {
 	case HID_GD_X:
 		features->last_slot_field = usage->hid;
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-08-11 20:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-11 17:59 [PATCH] HID: wacom: Stop mapping touch usages after processing HID_DG_CONTACTCOUNT Jason Gerecke
2016-07-12  7:32 ` Benjamin Tissoires
2016-07-20 16:36   ` Jason Gerecke
2016-07-20 21:35     ` Jason Gerecke
2016-07-21 16:10       ` [PATCH v2] HID: wacom: Update last_slot_field during pre_report phase Jason Gerecke
2016-07-21 18:01         ` Ping Cheng
2016-07-25  9:38         ` Benjamin Tissoires
2016-08-10 15:51           ` Jason Gerecke
2016-08-11  8:27             ` Jiri Kosina
2016-08-11 15:22               ` Jason Gerecke
2016-08-11 20:39         ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).