linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Getting recent elantech touchpads to work with synaptics
@ 2010-04-24 20:40 Florian Ragwitz
  2010-04-24 20:40 ` [PATCH 1/4] Input: elantech - Assume all firmware versions >= 2.48 use 6 byte packets Florian Ragwitz
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Florian Ragwitz @ 2010-04-24 20:40 UTC (permalink / raw)
  To: linux-input

The following 4 patches aim to improve various bits of the the elantech support
in the psmouse driver in order to get it to work with recent elantech firmwares
used in many touchpads of modern laptops. The list of those laptops includes
almost all recent ASUS machines, including the UL{2,3,5,8}0- and and P-series,
but also various others, like many Dell Inspiron machines.

[PATCH 1/4] Input: elantech - Assume all firmware versions >= 2.48 use 6 byte packets

  This patch just fixes a minor thinko in the handling of v1 vs. v2 firmware
  versions.

[PATCH 2/4] Input: Add an option to force the use of the elantech extension

  This adds a force_elantech options to the psmouse module, which allows to
  force the use of the elantech extension if a device responds to the elantech
  magic knock and firmware version request, but the driver doesn't know about
  the particular firmware version yet.

[PATCH 3/4] Input: elantech - Ignore high bits in the position coordinates

  This change is what actually makes things work on new firmwares. The driver
  used to use too many of the bits sent by the device to compute the position
  coordinates. On old versions all those bits were always zero, so it didn't
  actually matter, but new versions apparently reuse the bits for something
  else, screwing up results.

[PATCH 4/4] Input: elantech - Whitelist new models with firmware version 4.1

  This broadens the range of devices which are automatically recognized as
  elantech to include all devices reporting the bytes 0x04 0x01 0x01 upon a
  firmware version request. The check is intentionally rather strict, and I
  assume there's other devices out there, which report slightly different
  versions, but would still work, but given how easy it is to test those
  devices with the force_elantech option, I figured the check could be
  relaxed later, if necessary, and it'd be better to avoid recognizing
  non-elantech devices wrongly.


Those patches are only tested on machines with firmware version 4.1. They
should also be tested on older firmware versions using the 6-byte packet
format, like any ASUS Eee PC, before being applied.

--
BOFH excuse #196:
Me no internet, only janitor, me just wax floors.

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

* [PATCH 1/4] Input: elantech - Assume all firmware versions >= 2.48 use 6 byte packets
  2010-04-24 20:40 Getting recent elantech touchpads to work with synaptics Florian Ragwitz
@ 2010-04-24 20:40 ` Florian Ragwitz
  2010-04-26 14:19   ` Getting recent elantech touchpads to work with synaptics Florian Ragwitz
  2010-04-24 20:41 ` [PATCH 2/4] Input: Add an option to force the use of the elantech extension Florian Ragwitz
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Florian Ragwitz @ 2010-04-24 20:40 UTC (permalink / raw)
  To: linux-input; +Cc: Florian Ragwitz

This way firmware versions with a major version > 2, but a minor version < 48,
like version 4.1, will be recognized correctly.

Signed-off-by: Florian Ragwitz <rafl@debian.org>
---
 drivers/input/mouse/elantech.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index a138b5d..07f6b17 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -666,7 +666,8 @@ int elantech_init(struct psmouse *psmouse)
 	 * Assume every version greater than this is new EeePC style
 	 * hardware with 6 byte packets
 	 */
-	if (etd->fw_version_maj >= 0x02 && etd->fw_version_min >= 0x30) {
+	if ((etd->fw_version_maj == 0x02 && etd->fw_version_min >= 0x30) ||
+	    etd->fw_version_maj > 0x02) {
 		etd->hw_version = 2;
 		/* For now show extra debug information */
 		etd->debug = 1;
-- 
1.7.0.5


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

* [PATCH 2/4] Input: Add an option to force the use of the elantech extension
  2010-04-24 20:40 Getting recent elantech touchpads to work with synaptics Florian Ragwitz
  2010-04-24 20:40 ` [PATCH 1/4] Input: elantech - Assume all firmware versions >= 2.48 use 6 byte packets Florian Ragwitz
@ 2010-04-24 20:41 ` Florian Ragwitz
  2010-04-24 20:41 ` [PATCH 3/4] Input: elantech - Ignore high bits in the position coordinates Florian Ragwitz
  2010-04-24 20:41 ` [PATCH 4/4] Input: elantech - Whitelist new models with firmware version 4.1 Florian Ragwitz
  3 siblings, 0 replies; 9+ messages in thread
From: Florian Ragwitz @ 2010-04-24 20:41 UTC (permalink / raw)
  To: linux-input; +Cc: Florian Ragwitz

Apparently hardware vendors now ship elantech touchpads with different version
magic. This options allows for them to be tested easier with the current driver
in order to add their magic to the whitelist later.

Signed-off-by: Florian Ragwitz <rafl@debian.org>
---
 drivers/input/mouse/elantech.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 07f6b17..bfd08c7 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -25,6 +25,10 @@
 			printk(KERN_DEBUG format, ##arg);	\
 	} while (0)
 
+static unsigned int force_elantech;
+module_param_named(force_elantech, force_elantech, bool, 0644);
+MODULE_PARM_DESC(force_elantech, "Force the Elantech PS/2 protocol extension to be used, 1 = enabled, 0 = disabled (default).");
+
 /*
  * Send a Synaptics style sliced query command
  */
@@ -596,8 +600,12 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
 		 param[0], param[1], param[2]);
 
 	if (param[0] == 0 || param[1] != 0) {
-		pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
-		return -1;
+		if (!force_elantech) {
+			pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
+			return -1;
+		}
+
+		pr_debug("elantech.c: Probably not a real Elantech touchpad. Enabling anyway due to force_elantech.\n");
 	}
 
 	if (set_properties) {
-- 
1.7.0.5


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

* [PATCH 3/4] Input: elantech - Ignore high bits in the position coordinates
  2010-04-24 20:40 Getting recent elantech touchpads to work with synaptics Florian Ragwitz
  2010-04-24 20:40 ` [PATCH 1/4] Input: elantech - Assume all firmware versions >= 2.48 use 6 byte packets Florian Ragwitz
  2010-04-24 20:41 ` [PATCH 2/4] Input: Add an option to force the use of the elantech extension Florian Ragwitz
@ 2010-04-24 20:41 ` Florian Ragwitz
  2010-04-24 20:41 ` [PATCH 4/4] Input: elantech - Whitelist new models with firmware version 4.1 Florian Ragwitz
  3 siblings, 0 replies; 9+ messages in thread
From: Florian Ragwitz @ 2010-04-24 20:41 UTC (permalink / raw)
  To: linux-input; +Cc: Florian Ragwitz

In older versions of the elantech hardware/firmware those bits always were
unset, so it didn't actually matter, but newer versions seem to use those high
bits for something else, screwing up the coordinates we report to the input
layer for those devices.

Signed-off-by: Florian Ragwitz <rafl@debian.org>
---
 drivers/input/mouse/elantech.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index bfd08c7..254a967 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -251,13 +251,13 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
 
 	switch (fingers) {
 	case 1:
-		/* byte 1: x15 x14 x13 x12 x11 x10 x9  x8
+		/* byte 1:  .   .   .   .   .  x10 x9  x8
 		   byte 2: x7  x6  x5  x4  x4  x2  x1  x0 */
-		input_report_abs(dev, ABS_X, (packet[1] << 8) | packet[2]);
-		/* byte 4: y15 y14 y13 y12 y11 y10 y8  y8
+		input_report_abs(dev, ABS_X, ((packet[1] & 0x07) << 8) | packet[2]);
+		/* byte 4:  .   .   .   .   .   .  y8  y8
 		   byte 5: y7  y6  y5  y4  y3  y2  y1  y0 */
 		input_report_abs(dev, ABS_Y, ETP_YMAX_V2 -
-			((packet[4] << 8) | packet[5]));
+			(((packet[4] & 0x03) << 8) | packet[5]));
 		break;
 
 	case 2:
-- 
1.7.0.5


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

* [PATCH 4/4] Input: elantech - Whitelist new models with firmware version 4.1
  2010-04-24 20:40 Getting recent elantech touchpads to work with synaptics Florian Ragwitz
                   ` (2 preceding siblings ...)
  2010-04-24 20:41 ` [PATCH 3/4] Input: elantech - Ignore high bits in the position coordinates Florian Ragwitz
@ 2010-04-24 20:41 ` Florian Ragwitz
  3 siblings, 0 replies; 9+ messages in thread
From: Florian Ragwitz @ 2010-04-24 20:41 UTC (permalink / raw)
  To: linux-input; +Cc: Florian Ragwitz

The check is intentionally quite strict. It will probably need to be relaxed
later, but given how easy it is to test a non-whitelisted firmware with
force_elantech, that's OK.

Signed-off-by: Florian Ragwitz <rafl@debian.org>
---
 drivers/input/mouse/elantech.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 254a967..70321b7 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -599,7 +599,8 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
 	pr_debug("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) {
+	if ((param[0] == 0 || param[1] != 0) &&
+	    (param[0] != 4 && param[1] != 1 && param[2] != 1)) {
 		if (!force_elantech) {
 			pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
 			return -1;
-- 
1.7.0.5


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

* Re: Getting recent elantech touchpads to work with synaptics
  2010-04-24 20:40 ` [PATCH 1/4] Input: elantech - Assume all firmware versions >= 2.48 use 6 byte packets Florian Ragwitz
@ 2010-04-26 14:19   ` Florian Ragwitz
  2010-04-27  7:36     ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Florian Ragwitz @ 2010-04-26 14:19 UTC (permalink / raw)
  To: linux-input

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

This set of patches is now confirmed to work on various models of the
UL30, a K60IJ, and an UL80V-B2.

I also got a chance to test the modifications on an EeePc, where things
still Just Work, just as without the patches applied.


-- 
BOFH excuse #121:
halon system went off and killed the operators.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Getting recent elantech touchpads to work with synaptics
  2010-04-26 14:19   ` Getting recent elantech touchpads to work with synaptics Florian Ragwitz
@ 2010-04-27  7:36     ` Dmitry Torokhov
  2010-04-27 14:58       ` Florian Ragwitz
  2010-04-27 14:58       ` [PATCH] Update elantech documentation Florian Ragwitz
  0 siblings, 2 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2010-04-27  7:36 UTC (permalink / raw)
  To: Florian Ragwitz; +Cc: linux-input

On Mon, Apr 26, 2010 at 04:19:15PM +0200, Florian Ragwitz wrote:
> This set of patches is now confirmed to work on various models of the
> UL30, a K60IJ, and an UL80V-B2.
> 
> I also got a chance to test the modifications on an EeePc, where things
> still Just Work, just as without the patches applied.
> 

Florian, great work. I will queue the patches for .34, I think is not
too late.

Thanks!

-- 
Dmitry

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

* Re: Getting recent elantech touchpads to work with synaptics
  2010-04-27  7:36     ` Dmitry Torokhov
@ 2010-04-27 14:58       ` Florian Ragwitz
  2010-04-27 14:58       ` [PATCH] Update elantech documentation Florian Ragwitz
  1 sibling, 0 replies; 9+ messages in thread
From: Florian Ragwitz @ 2010-04-27 14:58 UTC (permalink / raw)
  To: linux-input

On Tue, 27 Apr 2010 00:36:54 -0700, Dmitry Torokhov wrote:
> Florian, great work. I will queue the patches for .34, I think is not
> too late.

Great news. Thank you!

I also just noticed my initial patch updated the comments about the packet
structure in the source code, but failed to update the relevant docs in
Documentation/.

The following patch does just that.

  [PATCH] Update elantech documentation


-- 
BOFH excuse #390:
Increased sunspot activity.

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

* [PATCH] Update elantech documentation
  2010-04-27  7:36     ` Dmitry Torokhov
  2010-04-27 14:58       ` Florian Ragwitz
@ 2010-04-27 14:58       ` Florian Ragwitz
  1 sibling, 0 replies; 9+ messages in thread
From: Florian Ragwitz @ 2010-04-27 14:58 UTC (permalink / raw)
  To: linux-input; +Cc: Florian Ragwitz

Signed-off-by: Florian Ragwitz <rafl@debian.org>
---
 Documentation/input/elantech.txt |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/input/elantech.txt b/Documentation/input/elantech.txt
index a10c3b6..56941ae 100644
--- a/Documentation/input/elantech.txt
+++ b/Documentation/input/elantech.txt
@@ -333,14 +333,14 @@ byte 0:
 byte 1:
 
    bit   7   6   5   4   3   2   1   0
-        x15 x14 x13 x12 x11 x10 x9  x8
+         .   .   .   .   .  x10 x9  x8
 
 byte 2:
 
    bit   7   6   5   4   3   2   1   0
         x7  x6  x5  x4  x4  x2  x1  x0
 
-         x15..x0 = absolute x value (horizontal)
+         x10..x0 = absolute x value (horizontal)
 
 byte 3:
 
@@ -350,14 +350,14 @@ byte 3:
 byte 4:
 
    bit   7   6   5   4   3   2   1   0
-        y15 y14 y13 y12 y11 y10 y8  y8
+         .   .   .   .   .   .  y9  y8
 
 byte 5:
 
    bit   7   6   5   4   3   2   1   0
         y7  y6  y5  y4  y3  y2  y1  y0
 
-         y15..y0 = absolute y value (vertical)
+         y9..y0 = absolute y value (vertical)
 
 
 4.2.2 Two finger touch
-- 
1.7.1


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

end of thread, other threads:[~2010-04-27 15:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-24 20:40 Getting recent elantech touchpads to work with synaptics Florian Ragwitz
2010-04-24 20:40 ` [PATCH 1/4] Input: elantech - Assume all firmware versions >= 2.48 use 6 byte packets Florian Ragwitz
2010-04-26 14:19   ` Getting recent elantech touchpads to work with synaptics Florian Ragwitz
2010-04-27  7:36     ` Dmitry Torokhov
2010-04-27 14:58       ` Florian Ragwitz
2010-04-27 14:58       ` [PATCH] Update elantech documentation Florian Ragwitz
2010-04-24 20:41 ` [PATCH 2/4] Input: Add an option to force the use of the elantech extension Florian Ragwitz
2010-04-24 20:41 ` [PATCH 3/4] Input: elantech - Ignore high bits in the position coordinates Florian Ragwitz
2010-04-24 20:41 ` [PATCH 4/4] Input: elantech - Whitelist new models with firmware version 4.1 Florian Ragwitz

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).