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