* [PATCH] input: elantech.c provide a workaround for jumpy cursor on firmware 2.34
@ 2009-03-20 5:35 Arjan Opmeer
2009-03-21 5:46 ` Dmitry Torokhov
0 siblings, 1 reply; 3+ messages in thread
From: Arjan Opmeer @ 2009-03-20 5:35 UTC (permalink / raw)
To: dtor, linux-input, linux-kernel
From: Arjan Opmeer <arjan@opmeer.net>
It seems that Elantech touchpad firmware version 2.34 on the Hercules eCAFÉ
suffers from a problem where bogus coordinates get reported at the beginning
of a touch action. This causes the mouse cursor or the scrolled page to
jump.
Included patch provides a workaround, enabled by default for firmware
version 2.34, that discards mouse packets that are likely to contain bogus
coordinates. To allow users of other firmware versions, that may also see
this problem, to experiment the workaround can be enabled and disabled via a
sysfs entry.
Signed-off-by: Arjan Opmeer <arjan@opmeer.net>
---
diff --git a/Documentation/input/elantech.txt b/Documentation/input/elantech.txt
index a10c3b6..3156a8e 100644
--- a/Documentation/input/elantech.txt
+++ b/Documentation/input/elantech.txt
@@ -1,7 +1,7 @@
Elantech Touchpad Driver
========================
- Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net>
+ Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
Extra information for hardware version 1 found and
provided by Steve Havelka
@@ -64,8 +64,8 @@ completeness sake.
2. Extra knobs
~~~~~~~~~~~
-Currently the Linux Elantech touchpad driver provides two extra knobs under
-/sys/bus/serio/drivers/psmouse/serio? for the user.
+Currently the Linux Elantech touchpad driver provides three extra knobs
+under /sys/bus/serio/drivers/psmouse/serio? for the user.
* debug
@@ -98,6 +98,20 @@ Currently the Linux Elantech touchpad driver provides two extra knobs under
bits. Hence checking is disabled by default. Currently even turning it on
will do nothing.
+* jumpy_cursor
+
+ Turns a workaround for jumpy mouse cursor ON or OFF.
+
+ By echo "0" to to this file the workaround will be turned OFF. Any
+ non-zero value will turn it ON. For firmware version 2.34 the default is
+ ON.
+
+ Firmware version 2.34 seems to suffer from a problem where in the
+ starting phase of a touch action bogus coordinates are reported. This
+ causes the mouse cursor or the scrolled page to jump. This knob enables a
+ workaround that discards mouse packets likely to contain bogus
+ coordinates.
+
/////////////////////////////////////////////////////////////////////////////
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 6ab0eb1..da3ff23 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1,7 +1,7 @@
/*
- * Elantech Touchpad driver (v5)
+ * Elantech Touchpad driver (v6)
*
- * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net>
+ * Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
@@ -178,6 +178,7 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
struct elantech_data *etd = psmouse->private;
unsigned char *packet = psmouse->packet;
int fingers;
+ static int old_fingers;
if (etd->fw_version_maj == 0x01) {
/* byte 0: D U p1 p2 1 p3 R L
@@ -190,6 +191,14 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
fingers = (packet[0] & 0xc0) >> 6;
}
+ if (etd->jumpy_cursor) {
+ /* Discard packets that are likely to have bogus coordinates */
+ if (fingers > old_fingers) {
+ elantech_debug("elantech.c: discarding packet\n");
+ goto discard_packet_v1;
+ }
+ }
+
input_report_key(dev, BTN_TOUCH, fingers != 0);
/* byte 2: x7 x6 x5 x4 x3 x2 x1 x0
@@ -216,6 +225,9 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
}
input_sync(dev);
+
+ discard_packet_v1:
+ old_fingers = fingers;
}
/*
@@ -507,6 +519,7 @@ ELANTECH_INT_ATTR(reg_25, 0x25);
ELANTECH_INT_ATTR(reg_26, 0x26);
ELANTECH_INT_ATTR(debug, 0);
ELANTECH_INT_ATTR(paritycheck, 0);
+ELANTECH_INT_ATTR(jumpy_cursor, 0);
static struct attribute *elantech_attrs[] = {
&psmouse_attr_reg_10.dattr.attr,
@@ -520,6 +533,7 @@ static struct attribute *elantech_attrs[] = {
&psmouse_attr_reg_26.dattr.attr,
&psmouse_attr_debug.dattr.attr,
&psmouse_attr_paritycheck.dattr.attr,
+ &psmouse_attr_jumpy_cursor.dattr.attr,
NULL
};
@@ -662,6 +676,17 @@ int elantech_init(struct psmouse *psmouse)
param[0], param[1], param[2]);
etd->capabilities = param[0];
+ /*
+ * This firmware seems to suffer from misreporting coordinates when
+ * a touch action starts causing the mouse cursor or scrolled page
+ * to jump. Enable a workaround.
+ */
+ if (etd->fw_version_maj == 0x02 && etd->fw_version_min == 0x22) {
+ pr_info("elantech.c: firmware version 2.34 detected, "
+ "enabling jumpy cursor workaround\n");
+ etd->jumpy_cursor = 1;
+ }
+
if (elantech_set_absolute_mode(psmouse)) {
pr_err("elantech.c: failed to put touchpad into absolute mode.\n");
goto init_fail;
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index bee282b..ed848cc 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -1,7 +1,7 @@
/*
- * Elantech Touchpad driver (v5)
+ * Elantech Touchpad driver (v6)
*
- * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net>
+ * Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
@@ -104,6 +104,7 @@ struct elantech_data {
unsigned char fw_version_min;
unsigned char hw_version;
unsigned char paritycheck;
+ unsigned char jumpy_cursor;
unsigned char parity[256];
};
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] input: elantech.c provide a workaround for jumpy cursor on firmware 2.34
2009-03-20 5:35 [PATCH] input: elantech.c provide a workaround for jumpy cursor on firmware 2.34 Arjan Opmeer
@ 2009-03-21 5:46 ` Dmitry Torokhov
2009-03-21 12:17 ` Arjan Opmeer
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2009-03-21 5:46 UTC (permalink / raw)
To: Arjan Opmeer; +Cc: linux-input, linux-kernel
Hi Arjan,
On Thursday 19 March 2009 22:35:09 Arjan Opmeer wrote:
>
> + if (etd->jumpy_cursor) {
> + /* Discard packets that are likely to have bogus coordinates */
> + if (fingers > old_fingers) {
> + elantech_debug("elantech.c: discarding packet\n");
> + goto discard_packet_v1;
Can we do this unconditionally for the v1 protocol and not have an
extra konb? Do you have access to boxes with unbroken V1 to test?
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] input: elantech.c provide a workaround for jumpy cursor on firmware 2.34
2009-03-21 5:46 ` Dmitry Torokhov
@ 2009-03-21 12:17 ` Arjan Opmeer
0 siblings, 0 replies; 3+ messages in thread
From: Arjan Opmeer @ 2009-03-21 12:17 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
On Fri, Mar 20, 2009 at 10:46:37PM -0700, Dmitry Torokhov wrote:
> On Thursday 19 March 2009 22:35:09 Arjan Opmeer wrote:
> >
> > + if (etd->jumpy_cursor) {
> > + /* Discard packets that are likely to have bogus coordinates */
> > + if (fingers > old_fingers) {
> > + elantech_debug("elantech.c: discarding packet\n");
> > + goto discard_packet_v1;
>
> Can we do this unconditionally for the v1 protocol and not have an extra
> konb?
That is of course possible, although I am not sure it will not have any
negative side effects.
> Do you have access to boxes with unbroken V1 to test?
Nope. I am sorry. I don't have access to any machine with an Elantech
touchpad after my laptop died. I am trying to give the best support I can by
using 'remote development' where users have to report and test changes to
the driver. As you can imagine it is slow going.
Arjan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-21 12:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-20 5:35 [PATCH] input: elantech.c provide a workaround for jumpy cursor on firmware 2.34 Arjan Opmeer
2009-03-21 5:46 ` Dmitry Torokhov
2009-03-21 12:17 ` 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 NNTP newsgroup(s).