LKML Archive mirror
 help / color / mirror / Atom feed
* elantech touchpad driver miss-recognising logitech mice
@ 2009-01-26 15:08 Andy Whitcroft
  2009-01-26 16:23 ` Arjan Opmeer
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Whitcroft @ 2009-01-26 15:08 UTC (permalink / raw
  To: arjan, patrakov, dmitry.torokhov; +Cc: linux-kernel

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


>From b39b647dfd5106c340d588920704b6d696b182d9 Mon Sep 17 00:00:00 2001
From: Andy Whitcroft <apw@canonical.com>
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 <arjan@opmeer.net> and based
on suggestions from him on how to improve it.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 drivers/input/mouse/elantech.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index b9a25d5..32febf5 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -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";
-- 
1.6.1.258.g7ff14.dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: elantech touchpad driver miss-recognising logitech mice
  2009-01-26 15:08 elantech touchpad driver miss-recognising logitech mice Andy Whitcroft
@ 2009-01-26 16:23 ` Arjan Opmeer
  2009-01-30 23:23   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Arjan Opmeer @ 2009-01-26 16:23 UTC (permalink / raw
  To: Andy Whitcroft; +Cc: patrakov, dmitry.torokhov, linux-kernel


On Mon, Jan 26, 2009 at 03:08:21PM +0000, Andy Whitcroft wrote:
> 
> 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.

> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: elantech touchpad driver miss-recognising logitech mice
  2009-01-26 16:23 ` Arjan Opmeer
@ 2009-01-30 23:23   ` Andrew Morton
  2009-02-05  5:05     ` Arjan Opmeer
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2009-01-30 23:23 UTC (permalink / raw
  To: Arjan Opmeer; +Cc: apw, patrakov, dmitry.torokhov, linux-kernel

On Mon, 26 Jan 2009 17:23:03 +0100
Arjan Opmeer <arjan@opmeer.net> wrote:

> 
> On Mon, Jan 26, 2009 at 03:08:21PM +0000, Andy Whitcroft wrote:
> > 
> > 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.
> 
> > 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... :)
> 

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: elantech touchpad driver miss-recognising logitech mice
  2009-01-30 23:23   ` Andrew Morton
@ 2009-02-05  5:05     ` Arjan Opmeer
  0 siblings, 0 replies; 4+ messages in thread
From: Arjan Opmeer @ 2009-02-05  5:05 UTC (permalink / raw
  To: Andrew Morton; +Cc: apw, patrakov, dmitry.torokhov, linux-kernel

On Fri, Jan 30, 2009 at 03:23:30PM -0800, Andrew Morton wrote:
> 
> blah. 

Very eloquent and very motivational...

> 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 <arjan@opmeer.net>

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.

Signed-off-by: Arjan Opmeer <arjan@opmeer.net>
---
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index b9a25d5..5abc5f7 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -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];
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-02-05  5:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-26 15:08 elantech touchpad driver miss-recognising logitech mice Andy Whitcroft
2009-01-26 16:23 ` Arjan Opmeer
2009-01-30 23:23   ` Andrew Morton
2009-02-05  5:05     ` Arjan Opmeer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).