Skip to contentSkip to conversation

input: elantech touchpad driver miss-recognising logitech mice

PATCH New [email protected] 1 participant 1 message Feb 11, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 19/19 input: elantech touchpad driver miss-recognising logitech mice

From: Arjan Opmeer <[email protected]>

Some Logitech mice react to the magic knock like an Elantech touchpad would. This leads to those mice being misdetected as Elantech touchpads. Add a version query to elantech_detect() to distinguish the two.

Cc Andy Whitcroft <[email protected]>
Cc Dmitry Torokhov <[email protected]>

---

 drivers/input/mouse/elantech.c |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/input/mouse/elantech.c renamed from drivers/input/mouse/elantech.c~input-elantech-touchpad-driver-miss-recognising-logitech-mice +17 -3
diff -puN drivers/input/mouse/elantech.c~input-elantech-touchpad-driver-miss-recognising-logitech-mice drivers/input/mouse/elantech.c
@@ -556,6 +556,22 @@ int elantech_detect(struct psmouse *psmo
 		return -1;
 	}
 
+	/*
+	 * There are Logitech mice that react to the magic knock exactly
+	 * like an Elantech touchpad would, so do a version query here to
+	 * try to distinguish the two
+	 */
+	if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
+		pr_err("elantech.c: failed to query firmware version.\n");
+		return -1;
+	}
+	pr_info("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
+		param[0], param[1], param[2]);
+	if (param[0] == 0 || param[1] != 0) {
+		pr_info("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
+		return -1;
+	}
+
 	if (set_properties) {
 		psmouse->vendor = "Elantech";
 		psmouse->name = "Touchpad";
@@ -610,14 +626,12 @@ int elantech_init(struct psmouse *psmous
 		etd->parity[i] = etd->parity[i & (i - 1)] ^ 1;
 
 	/*
-	 * Find out what version hardware this is
+	 * Do the version query again so we can store the result
 	 */
 	if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
 		pr_err("elantech.c: failed to query firmware version.\n");
 		goto init_fail;
 	}
-	pr_info("elantech.c: Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
-		param[0], param[1], param[2]);
 	etd->fw_version_maj = param[0];
 	etd->fw_version_min = param[2];
 

_