[PATCH 0/2] Better support old elantech v2 hardware

STALE5437d

13 messages, 5 authors, 2011-09-19 · open the first message on its own page

[PATCH 0/2] Better support old elantech v2 hardware

From: JJ Ding <hidden>
Date: 2011-09-13 06:13:23

Hi everyone,

Thanks to Richard Schütz's bug report, I did some more research on elantech
v2 hardware. I asked our Windows driver team and firmware team about the
_ancient histroy_ of the dark old days ;-) These two patches are the results.

Hopefully with these 2 we can support v2 hardware as good as Windows does.

I can only get two old v2 (fw: 0x020800, 0x040201) to test. Those who have a elantech v2
hardware please do test, thank you very much.

Note:
These 2 patches are on top of my previous v5 series.

JJ Ding (2):
  Input: elantech - better support all those v2 variants
  Input: elantech - remove module parameter force_elantech

 drivers/input/mouse/elantech.c |   58 +++++++++++++++++++++++++++++----------
 drivers/input/mouse/elantech.h |    1 +
 2 files changed, 44 insertions(+), 15 deletions(-)

-- 
1.7.4.1

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

[PATCH 1/2] Input: elantech - better support all those v2 variants

From: JJ Ding <hidden>
Date: 2011-09-13 06:13:23

V2 hardware has many variants. This patch adddresses two issues:

 - some model also has debounce packets, but with a different signature
   than v3. Now we just check debounce for all v2 hardware.

 - due to different scanning methods the hardware uses, x and y ranges have
   to be calculated differently. And for some specific versions, we can just
   see them as custom-made, so set {x, y} the same values as Windows driver
   does.

Signed-off-by: JJ Ding <redacted>
---
 drivers/input/mouse/elantech.c |   46 +++++++++++++++++++++++++++++++++++----
 drivers/input/mouse/elantech.h |    1 +
 2 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 38fb155..63a0ce7 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -613,6 +613,18 @@ static int elantech_packet_check_v1(struct psmouse *psmouse)
 	       etd->parity[packet[3]] == p3;
 }
 
+static int elantech_debounce_check_v2(struct psmouse *psmouse)
+{
+        /*
+         * When we encounter packet that matches this exactly, it means the
+         * hardware is in debounce status. Just ignore the whole packet.
+         */
+        const u8 debounce_packet[] = { 0x84, 0xff, 0xff, 0x02, 0xff, 0xff };
+        unsigned char *packet = psmouse->packet;
+
+        return !memcmp(packet, debounce_packet, sizeof(debounce_packet));
+}
+
 static int elantech_packet_check_v2(struct psmouse *psmouse)
 {
 	struct elantech_data *etd = psmouse->private;
@@ -708,6 +720,10 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
 		break;
 
 	case 2:
+		/* ignore debounce */
+		if (elantech_debounce_check_v2(psmouse))
+			return PSMOUSE_FULL_PACKET;
+
 		if (etd->paritycheck && !elantech_packet_check_v2(psmouse))
 			return PSMOUSE_BAD_DATA;
 
@@ -824,7 +840,6 @@ static int set_range(struct psmouse *psmouse, unsigned int *x_min,
 	struct elantech_data *etd = psmouse->private;
 	unsigned char param[3];
 	unsigned char traces;
-	int i;
 
 	switch (etd->hw_version) {
 	case 1:
@@ -843,12 +858,33 @@ static int set_range(struct psmouse *psmouse, unsigned int *x_min,
 			*x_max = ETP_XMAX_V2;
 			*y_max = ETP_YMAX_V2;
 		} else {
+			int i;
+			int fixed_dpi;
+
 			i = (etd->fw_version > 0x020800 &&
 			     etd->fw_version < 0x020900) ? 1 : 2;
-			*x_min = 0;
-			*y_min = 0;
-			*x_max = (etd->capabilities[1] - i) * 64;
-			*y_max = (etd->capabilities[2] - i) * 64;
+
+			if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param))
+				return -1;
+
+			fixed_dpi = param[1] & 0x10;
+
+			if (((etd->fw_version >> 16) == 0x14) && fixed_dpi) {
+				if (synaptics_send_cmd(psmouse, ETP_SAMPLE_QUERY, param))
+					return -1;
+
+				*x_max = (etd->capabilities[1] - i) * param[1] / 2;
+				*y_max = (etd->capabilities[2] - i) * param[2] / 2;
+			} else if (etd->fw_version == 0x040216) {
+				*x_max = 819;
+				*y_max = 405;
+			} else if (etd->fw_version == 0x040219 || etd->fw_version == 0x040215) {
+				*x_max = 900;
+				*y_max = 500;
+			} else {
+				*x_max = (etd->capabilities[1] - i) * 64;
+				*y_max = (etd->capabilities[2] - i) * 64;
+			}
 		}
 		break;
 
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index 7ecaef0..9e5f1aa 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -19,6 +19,7 @@
 #define ETP_FW_ID_QUERY			0x00
 #define ETP_FW_VERSION_QUERY		0x01
 #define ETP_CAPABILITIES_QUERY		0x02
+#define ETP_SAMPLE_QUERY		0x03
 
 /*
  * Command values for register reading or writing
-- 
1.7.4.1

[PATCH 2/2] Input: elantech - remove module parameter force_elantech

From: JJ Ding <hidden>
Date: 2011-09-13 06:13:24

This essentially reverts commit f81bc788ff91d4efd4baf88b2c29713838caa8e5.

With recent work on elantech driver, I believe we now have complete support
for all elantech touchpads. So remove this hack.

Signed-off-by: JJ Ding <redacted>
---
 drivers/input/mouse/elantech.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 63a0ce7..ea8cdcf 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -28,10 +28,6 @@
 			printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__);	\
 	} while (0)
 
-static bool 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
  */
@@ -1163,12 +1159,8 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
 		 param[0], param[1], param[2]);
 
 	if (!elantech_is_signature_valid(param)) {
-		if (!force_elantech) {
-			pr_debug("Probably not a real Elantech touchpad. Aborting.\n");
-			return -1;
-		}
-
-		pr_debug("Probably not a real Elantech touchpad. Enabling anyway due to force_elantech.\n");
+		pr_debug("Probably not a real Elantech touchpad. Aborting.\n");
+		return -1;
 	}
 
 	if (set_properties) {
-- 
1.7.4.1

Re: [PATCH 1/2] Input: elantech - better support all those v2 variants

From: Richard Schütz <hidden>
Date: 2011-09-13 10:25:10

Am 13.09.2011 08:15, schrieb JJ Ding:
V2 hardware has many variants. This patch adddresses two issues:

  - some model also has debounce packets, but with a different signature
    than v3. Now we just check debounce for all v2 hardware.

  - due to different scanning methods the hardware uses, x and y ranges have
    to be calculated differently. And for some specific versions, we can just
    see them as custom-made, so set {x, y} the same values as Windows driver
    does.

Signed-off-by: JJ Ding<redacted>
Tested-by: Richard Schütz <redacted>

Works like a charm now, thanks!

-- 
Regards,
Richard Schütz
--
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

Re: [PATCH 0/2] Better support old elantech v2 hardware

From: Éric Piel <hidden>
Date: 2011-09-13 11:02:46

Op 13-09-11 08:15, JJ Ding schreef:
Hi everyone,

Thanks to Richard Schütz's bug report, I did some more research on elantech
v2 hardware. I asked our Windows driver team and firmware team about the
_ancient histroy_ of the dark old days ;-) These two patches are the results.

Hopefully with these 2 we can support v2 hardware as good as Windows does.

I can only get two old v2 (fw: 0x020800, 0x040201) to test. Those who have a elantech v2
hardware please do test, thank you very much.
Thanks JJ Ding for the patches. They look good :-) I think my hardware 
is also 0x020800, but I'll test anyway and report back.

Cheers,
Éric
--
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

Re: [PATCH 1/2] Input: elantech - better support all those v2 variants

From: JJ Ding <hidden>
Date: 2011-09-13 11:25:35

On Tue, 13 Sep 2011 12:24:50 +0200, Richard Schütz [off-list ref] wrote:
Am 13.09.2011 08:15, schrieb JJ Ding:
quoted
V2 hardware has many variants. This patch adddresses two issues:

  - some model also has debounce packets, but with a different signature
    than v3. Now we just check debounce for all v2 hardware.

  - due to different scanning methods the hardware uses, x and y ranges have
    to be calculated differently. And for some specific versions, we can just
    see them as custom-made, so set {x, y} the same values as Windows driver
    does.

Signed-off-by: JJ Ding<redacted>
Tested-by: Richard Schütz <redacted>

Works like a charm now, thanks!
Good to hear it works for you. Thanks for testing.

jj
-- 
Regards,
Richard Schütz
--
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

Re: [PATCH 0/2] Better support old elantech v2 hardware

From: JJ Ding <hidden>
Date: 2011-09-13 11:29:43

On Tue, 13 Sep 2011 13:02:42 +0200, Éric Piel [off-list ref] wrote:
Op 13-09-11 08:15, JJ Ding schreef:
quoted
Hi everyone,

Thanks to Richard Schütz's bug report, I did some more research on elantech
v2 hardware. I asked our Windows driver team and firmware team about the
_ancient histroy_ of the dark old days ;-) These two patches are the results.

Hopefully with these 2 we can support v2 hardware as good as Windows does.

I can only get two old v2 (fw: 0x020800, 0x040201) to test. Those who have a elantech v2
hardware please do test, thank you very much.
Thanks JJ Ding for the patches. They look good :-) I think my hardware 
No problem ;-)
is also 0x020800, but I'll test anyway and report back.

Cheers,
Éric
Éric, may I have your Reviewed-by after you test this?
Thank you very much.

jj
--
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

Re: [PATCH 0/2] Better support old elantech v2 hardware

From: Chase Douglas <hidden>
Date: 2011-09-13 21:33:06

On 09/13/2011 01:15 AM, JJ Ding wrote:
Hi everyone,

Thanks to Richard Schütz's bug report, I did some more research on elantech
v2 hardware. I asked our Windows driver team and firmware team about the
_ancient histroy_ of the dark old days ;-) These two patches are the results.

Hopefully with these 2 we can support v2 hardware as good as Windows does.
I just want to say: Thank you so much for all this! The Linux community
is often ignored by vendors, and then if we aren't ignored they only put
the effort into making the latest stuff work. Personally, I greatly
appreciate what you have contributed.

Thanks again!

-- Chase
--
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

Re: [PATCH 0/2] Better support old elantech v2 hardware

From: JJ Ding <hidden>
Date: 2011-09-14 03:40:31

On Tue, 13 Sep 2011 16:33:00 -0500, Chase Douglas [off-list ref] wrote:
On 09/13/2011 01:15 AM, JJ Ding wrote:
quoted
Hi everyone,

Thanks to Richard Schütz's bug report, I did some more research on elantech
v2 hardware. I asked our Windows driver team and firmware team about the
_ancient histroy_ of the dark old days ;-) These two patches are the results.

Hopefully with these 2 we can support v2 hardware as good as Windows does.
I just want to say: Thank you so much for all this! The Linux community
is often ignored by vendors, and then if we aren't ignored they only put
the effort into making the latest stuff work. Personally, I greatly
appreciate what you have contributed.

Thanks again!

-- Chase
Thank you, Chase, it's nice to hear this from you.

I've been a long time Linux user, so I do understand the frustration
when having a device working OK on Windows, but just can't get Linux to
support it ;)

I am happy to have a chance to contribute, even just a little bit.

jj
--
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

Re: [PATCH 0/2] Better support old elantech v2 hardware

From: M. Edward (Ed) Borasky <hidden>
Date: 2011-09-14 04:33:00

I just got an Asus U46E-BAL5 and the touchpad is showing up in
openSUSE Linux 11.4 as a PS/2 mouse. I think this patch set might fix
that issue - how can I get the patches to try it?

On Tue, Sep 13, 2011 at 8:43 PM, JJ Ding [off-list ref] wrote:
On Tue, 13 Sep 2011 16:33:00 -0500, Chase Douglas [off-list ref] wrote:
quoted
On 09/13/2011 01:15 AM, JJ Ding wrote:
quoted
Hi everyone,

Thanks to Richard Schütz's bug report, I did some more research on elantech
v2 hardware. I asked our Windows driver team and firmware team about the
_ancient histroy_ of the dark old days ;-) These two patches are the results.

Hopefully with these 2 we can support v2 hardware as good as Windows does.
I just want to say: Thank you so much for all this! The Linux community
is often ignored by vendors, and then if we aren't ignored they only put
the effort into making the latest stuff work. Personally, I greatly
appreciate what you have contributed.

Thanks again!

-- Chase
Thank you, Chase, it's nice to hear this from you.

I've been a long time Linux user, so I do understand the frustration
when having a device working OK on Windows, but just can't get Linux to
support it ;)

I am happy to have a chance to contribute, even just a little bit.

jj
--
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


-- 
http://twitter.com/znmeb http://borasky-research.net

"A mathematician is a device for turning coffee into theorems." -- Paul Erdős
--
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

Re: [PATCH 0/2] Better support old elantech v2 hardware

From: JJ Ding <hidden>
Date: 2011-09-16 08:53:31

On Tue, 13 Sep 2011 14:15:47 +0800, JJ Ding [off-list ref] wrote:
Hi everyone,

Thanks to Richard Schütz's bug report, I did some more research on elantech
v2 hardware. I asked our Windows driver team and firmware team about the
_ancient histroy_ of the dark old days ;-) These two patches are the results.

Hopefully with these 2 we can support v2 hardware as good as Windows does.

I can only get two old v2 (fw: 0x020800, 0x040201) to test. Those who have a elantech v2
hardware please do test, thank you very much.
I just found an old v2 with firmware version 0x140200 to test, and it
worked well.

Dmitry, do you have any comment on these two changes? Do these two
patches seem OK for your -next tree?

Thank you,
jj
Note:
These 2 patches are on top of my previous v5 series.

JJ Ding (2):
  Input: elantech - better support all those v2 variants
  Input: elantech - remove module parameter force_elantech

 drivers/input/mouse/elantech.c |   58 +++++++++++++++++++++++++++++----------
 drivers/input/mouse/elantech.h |    1 +
 2 files changed, 44 insertions(+), 15 deletions(-)

-- 
1.7.4.1
--
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

Re: [PATCH 0/2] Better support old elantech v2 hardware

From: Éric Piel <hidden>
Date: 2011-09-16 14:21:14

Op 13-09-11 08:15, JJ Ding schreef:
Hi everyone,

Thanks to Richard Schütz's bug report, I did some more research on elantech
v2 hardware. I asked our Windows driver team and firmware team about the
_ancient histroy_ of the dark old days ;-) These two patches are the results.

Hopefully with these 2 we can support v2 hardware as good as Windows does.

I can only get two old v2 (fw: 0x020800, 0x040201) to test. Those who have a elantech v2
hardware please do test, thank you very much.
Hello,
I've tested these patches on my hardware with version 0x020801. 
Everything looks fine.


Reviewed-by: Éric Piel <eric.piel@tremplin-utc.net>

Cheers,
Éric
--
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

Re: [PATCH 0/2] Better support old elantech v2 hardware

From: JJ Ding <hidden>
Date: 2011-09-19 04:52:11

On Fri, 16 Sep 2011 16:21:10 +0200, Éric Piel [off-list ref] wrote:
Op 13-09-11 08:15, JJ Ding schreef:
quoted
Hi everyone,

Thanks to Richard Schütz's bug report, I did some more research on elantech
v2 hardware. I asked our Windows driver team and firmware team about the
_ancient histroy_ of the dark old days ;-) These two patches are the results.

Hopefully with these 2 we can support v2 hardware as good as Windows does.

I can only get two old v2 (fw: 0x020800, 0x040201) to test. Those who have a elantech v2
hardware please do test, thank you very much.
Hello,
I've tested these patches on my hardware with version 0x020801. 
Everything looks fine.


Reviewed-by: Éric Piel <eric.piel@tremplin-utc.net>

Cheers,
Éric
Thank you, Éric, for testing and reviewing.

jj
--
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help