8b91e0
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
8b91e0
Date: Thu, 16 Apr 2015 13:01:46 -0400
8b91e0
Subject: [PATCH] Input - synaptics: pin 3 touches when the firmware reports 3
8b91e0
 fingers
8b91e0
8b91e0
Synaptics PS/2 touchpad can send only 2 touches in a report. They can
8b91e0
detect 4 or 5 and this information is valuable.
8b91e0
8b91e0
In commit 63c4fda (Input: synaptics - allocate 3 slots to keep stability
8b91e0
in image sensors), we allocate 3 slots, but we still continue to report
8b91e0
the 2 available fingers. That means that the client sees 2 used slots while
8b91e0
there is a total of 3 fingers advertised by BTN_TOOL_TRIPLETAP.
8b91e0
8b91e0
For old kernels this is not a problem because max_slots was 2 and libinput/
8b91e0
xorg-synaptics knew how to deal with that. Now that max_slot is 3, the
8b91e0
clients ignore BTN_TOOL_TRIPLETAP and count the actual used slots (so 2).
8b91e0
It then gets confused when receiving the BTN_TOOL_TRIPLETAP and DOUBLETAP
8b91e0
information, and goes wild.
8b91e0
8b91e0
We can pin the 3 slots until we get a total number of fingers below 2.
8b91e0
8b91e0
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1212230
8b91e0
8b91e0
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
8b91e0
---
8b91e0
 drivers/input/mouse/synaptics.c | 8 ++++++++
8b91e0
 1 file changed, 8 insertions(+)
8b91e0
8b91e0
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
228ccc
index 3a32caf06bf1..58102970f94f 100644
8b91e0
--- a/drivers/input/mouse/synaptics.c
8b91e0
+++ b/drivers/input/mouse/synaptics.c
c68e89
@@ -940,6 +940,14 @@ static void synaptics_report_mt_data(struct psmouse *psmouse,
8b91e0
 		input_report_abs(dev, ABS_MT_PRESSURE, hw[i]->z);
8b91e0
 	}
8b91e0
 
8b91e0
+	/* keep (slot count <= num_fingers) by pinning all slots */
8b91e0
+	if (num_fingers >= 3) {
8b91e0
+		for (i = 0; i < 3; i++) {
8b91e0
+			input_mt_slot(dev, i);
8b91e0
+			input_mt_report_slot_state(dev, MT_TOOL_FINGER, true);
8b91e0
+		}
8b91e0
+	}
8b91e0
+
8b91e0
 	input_mt_drop_unused(dev);
8b91e0
 
8b91e0
 	/* Don't use active slot count to generate BTN_TOOL events. */