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