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