Skip to contentSkip to conversation

elantech touchpad driver miss-recognising logitech mice

PATCH Andy Whitcroft 3 participants 4 messages Jan 26, 2009 – Feb 5, 2009 Input drivers

lore
Share & tools
lore
#0 lore raw

We have been receiving reports of the elantech driver miss-recognising logitech mice as per the patchwork thread below:

    http://patchwork.kernel.org/patch/319/

That thread indicates that the patch as presented is not sufficient so I am wondering if this has progressed and if there is a later patch I could test with. I cannot see anything later in mainline as yet?

Failing that I did build a modified patch (below) based on that from the thread plus the suggested improvements. This has been tested by people with the Logitech mice successfully, and also by people with elantech touchpads who report no regressions.

If there is no later patches then perhaps you could test this one, and then I can push it upstream.

Comments?

-apw

Quoted 1 line

From b39b647dfd5106c340d588920704b6d696b182d9 Mon Sep 17 00:00:00 2001

From: Andy Whitcroft <[email protected]>
Date: Fri, 23 Jan 2009 17:42:05 +0000
Subject: [PATCH 1/1] elantech touchpad -- weed out incorrectly identified Logitech Mice

Some Logitech USB-PS/2 Optical Mouse are triggering on the special knock sequence when attached on PS/2. Use the version number to weed those out. Note that as we have no private data we end up doing the version check twice.

Based on an original patch by Arjan Opmeer <[email protected]> and based on suggestions from him on how to improve it.

---
 drivers/input/mouse/elantech.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
drivers/input/mouse/elantech.c +16 -0
index b9a25d5..32febf5 100644
@@ -556,6 +556,22 @@ int elantech_detect(struct psmouse *psmouse, int set_properties)
 		return -1;
 	}
 
+	/*
+	 * Some Logitech USB-PS/2 Optical Mouse devices are responding to
+	 * our magic knock.  So ask for our device version and validate
+	 * using that.
+	 */
+	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";
Signature · 1 line
1.6.1.258.g7ff14.dirty
#1 lore raw
Quoted 5 lines · Andy Whitcroft

Failing that I did build a modified patch (below) based on that from the thread plus the suggested improvements. This has been tested by people with the Logitech mice successfully, and also by people with elantech touchpads who report no regressions.

Good! This means the suggested fix is working :)

However, my original proposal:

http://patchwork.kernel.org/patch/595/

also removed printing the version query result in elantech_init() to keep the amount of log messages the same.

Quoted 2 lines

If there is no later patches then perhaps you could test this one, and then I can push it upstream.

Dmitry suggested moving the Elantech detection down in psmouse_extensions() in psmouse-base.c to make the mouse detection less chatty:

http://lkml.org/lkml/2009/1/20/55

However, Alexander pointed out he did not move it far enough down:

http://lkml.org/lkml/2009/1/22/18

It should have been moved all the way down below the call to im_explorer_detect() for him to not see the extra Elantech detection noise.

Now, it is Dmitry's call again to determine whether he really wants to move the call to elantech_detect() that far down or can live with the extra log messages... :)

Arjan

#2 lore raw
Quoted 27 lines · On Mon, 26 Jan 2009 17:23:03 +0100 Arjan Opmeer <[email protected]> wrote:
Quoted 5 lines · Andy Whitcroft

Failing that I did build a modified patch (below) based on that from the thread plus the suggested improvements. This has been tested by people with the Logitech mice successfully, and also by people with elantech touchpads who report no regressions.

Good! This means the suggested fix is working :)

However, my original proposal:

   http://patchwork.kernel.org/patch/595/

also removed printing the version query result in elantech_init() to keep the amount of log messages the same.

Quoted 2 lines

If there is no later patches then perhaps you could test this one, and then I can push it upstream.

Dmitry suggested moving the Elantech detection down in psmouse_extensions() in psmouse-base.c to make the mouse detection less chatty:

   http://lkml.org/lkml/2009/1/20/55

However, Alexander pointed out he did not move it far enough down:

Quoted 9 lines
   http://lkml.org/lkml/2009/1/22/18

It should have been moved all the way down below the call to im_explorer_detect() for him to not see the extra Elantech detection noise.

Now, it is Dmitry's call again to determine whether he really wants to move the call to elantech_detect() that far down or can live with the extra log messages... :)

blah. Please propose a final patch for me to stash away, lest the issue get forgotten about.

#3 lore raw
Quoted 2 lines · Andrew Morton

blah.

Very eloquent and very motivational...

Quoted 2 lines

Please propose a final patch for me to stash away, lest the issue get forgotten about.

How about you stash away my original proposal? Andy has proof that it works. Some of the debug messages can always be removed later when no other regressions surface and people find the current detection routine too verbose.

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.

---

drivers/input/mouse/elantech.c +17 -3
index b9a25d5..5abc5f7 100644
@@ -556,6 +556,22 @@ int elantech_detect(struct psmouse *psmouse, int set_properties)
 		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 *psmouse)
 		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];