a1ef73
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
a1ef73
Date: Sun, 8 Mar 2015 22:32:43 -0700
a1ef73
Subject: [PATCH] Input: synaptics - handle spurious release of trackstick
a1ef73
 buttons
a1ef73
a1ef73
The Fimware 8.1 has a bug in which the extra buttons are only sent when the
a1ef73
ExtBit is 1.  This should be fixed in a future FW update which should have
a1ef73
a bump of the minor version.
a1ef73
a1ef73
Cc: stable@vger.kernel.org
a1ef73
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
a1ef73
Acked-by: Hans de Goede <hdegoede@redhat.com>
a1ef73
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
a1ef73
---
a1ef73
 drivers/input/mouse/synaptics.c | 33 +++++++++++++++++++++++++--------
a1ef73
 1 file changed, 25 insertions(+), 8 deletions(-)
a1ef73
a1ef73
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
a1ef73
index e78cc5578527..2f42a712f3e0 100644
a1ef73
--- a/drivers/input/mouse/synaptics.c
a1ef73
+++ b/drivers/input/mouse/synaptics.c
a1ef73
@@ -820,14 +820,36 @@ static void synaptics_report_semi_mt_data(struct input_dev *dev,
a1ef73
 	}
a1ef73
 }
a1ef73
 
a1ef73
-static void synaptics_report_buttons(struct psmouse *psmouse,
a1ef73
-				     const struct synaptics_hw_state *hw)
a1ef73
+static void synaptics_report_ext_buttons(struct psmouse *psmouse,
a1ef73
+					 const struct synaptics_hw_state *hw)
a1ef73
 {
a1ef73
 	struct input_dev *dev = psmouse->dev;
a1ef73
 	struct synaptics_data *priv = psmouse->private;
a1ef73
 	int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
a1ef73
 	int i;
a1ef73
 
a1ef73
+	if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
a1ef73
+		return;
a1ef73
+
a1ef73
+	/* Bug in FW 8.1, buttons are reported only when ExtBit is 1 */
a1ef73
+	if (SYN_ID_FULL(priv->identity) == 0x801 &&
a1ef73
+	    !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
a1ef73
+		return;
a1ef73
+
a1ef73
+	for (i = 0; i < ext_bits; i++) {
a1ef73
+		input_report_key(dev, BTN_0 + 2 * i,
a1ef73
+			hw->ext_buttons & (1 << i));
a1ef73
+		input_report_key(dev, BTN_1 + 2 * i,
a1ef73
+			hw->ext_buttons & (1 << (i + ext_bits)));
a1ef73
+	}
a1ef73
+}
a1ef73
+
a1ef73
+static void synaptics_report_buttons(struct psmouse *psmouse,
a1ef73
+				     const struct synaptics_hw_state *hw)
a1ef73
+{
a1ef73
+	struct input_dev *dev = psmouse->dev;
a1ef73
+	struct synaptics_data *priv = psmouse->private;
a1ef73
+
a1ef73
 	input_report_key(dev, BTN_LEFT, hw->left);
a1ef73
 	input_report_key(dev, BTN_RIGHT, hw->right);
a1ef73
 
a1ef73
@@ -839,12 +861,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
a1ef73
 		input_report_key(dev, BTN_BACK, hw->down);
a1ef73
 	}
a1ef73
 
a1ef73
-	for (i = 0; i < ext_bits; i++) {
a1ef73
-		input_report_key(dev, BTN_0 + 2 * i,
a1ef73
-				 hw->ext_buttons & (1 << i));
a1ef73
-		input_report_key(dev, BTN_1 + 2 * i,
a1ef73
-				 hw->ext_buttons & (1 << (i + ext_bits)));
a1ef73
-	}
a1ef73
+	synaptics_report_ext_buttons(psmouse, hw);
a1ef73
 }
a1ef73
 
a1ef73
 static void synaptics_report_slot(struct input_dev *dev, int slot,
a1ef73
-- 
a1ef73
2.1.0
a1ef73