Skip to contentSkip to conversation

Patch "HID: multitouch: Only look at non touch fields in first packet of a frame" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Mar 16, 2018

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

HID: multitouch: Only look at non touch fields in first packet of a frame

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
hid-multitouch-only-look-at-non-touch-fields-in-first-packet-of-a-frame.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Fri Mar 16 15:43:16 CET 2018

From: Hans de Goede <[email protected]>
Date: Wed, 22 Nov 2017 12:57:09 +0100
Subject: HID: multitouch: Only look at non touch fields in first packet of a frame

From: Hans de Goede <[email protected]>

[ Upstream commit 55746d28d66860bccaae20a67b55b9d5db7c14af ]

Devices in "single finger hybrid mode" will send one report per finger, on some devices only the first report of such a multi-packet frame will contain a value for BTN_LEFT, in subsequent reports (if multiple fingers are down) the value is always 0, causing hid-mt to report BTN_LEFT going 1 - 0 - 1 - 0 when pressing a clickpad and putting down a second finger. This happens for example on USB 0603:0002 mt touchpads.

This commit fixes this by only reporting non touch fields for the first packet of a (possibly) multi-packet frame.

---
 drivers/hid/hid-multitouch.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/hid/hid-multitouch.c +15 -2
@@ -738,9 +738,11 @@ static int mt_touch_event(struct hid_dev
 }
 
 static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
-				struct hid_usage *usage, __s32 value)
+				struct hid_usage *usage, __s32 value,
+				bool first_packet)
 {
 	struct mt_device *td = hid_get_drvdata(hid);
+	__s32 cls = td->mtclass.name;
 	__s32 quirks = td->mtclass.quirks;
 	struct input_dev *input = field->hidinput->input;
 
@@ -794,6 +796,15 @@ static void mt_process_mt_event(struct h
 			break;
 
 		default:
+			/*
+			 * For Win8 PTP touchpads we should only look at
+			 * non finger/touch events in the first_packet of
+			 * a (possible) multi-packet frame.
+			 */
+			if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) &&
+			    !first_packet)
+				return;
+
 			if (usage->type)
 				input_event(input, usage->type, usage->code,
 						value);
@@ -813,6 +824,7 @@ static void mt_touch_report(struct hid_d
 {
 	struct mt_device *td = hid_get_drvdata(hid);
 	struct hid_field *field;
+	bool first_packet;
 	unsigned count;
 	int r, n;
 
@@ -831,6 +843,7 @@ static void mt_touch_report(struct hid_d
 			td->num_expected = value;
 	}
 
+	first_packet = td->num_received == 0;
 	for (r = 0; r < report->maxfield; r++) {
 		field = report->field[r];
 		count = field->report_count;
@@ -840,7 +853,7 @@ static void mt_touch_report(struct hid_d
 
 		for (n = 0; n < count; n++)
 			mt_process_mt_event(hid, field, &field->usage[n],
-					field->value[n]);
+					    field->value[n], first_packet);
 	}
 
 	if (td->num_received >= td->num_expected)

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/asoc-rt5651-fix-regcache-sync-errors-on-resume.patch queue-4.14/uas-fix-comparison-for-error-code.patch queue-4.14/hid-multitouch-only-look-at-non-touch-fields-in-first-packet-of-a-frame.patch