linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input - elantech: Add special check for fw_version 0x470f01  touchpad
@ 2015-07-22 13:55 duson
  2015-07-22 19:55 ` ulrik.debie-os
  0 siblings, 1 reply; 3+ messages in thread
From: duson @ 2015-07-22 13:55 UTC (permalink / raw)
  To: linux-input, linux-kernel, Dmitry Torokhov; +Cc: dusonlin

t is no need to check the packet[0] for sanity check when doing
elantech_packet_check_v4() function for fw_version = 0x470f01 touchpad.

Signed-off by: Duson Lin <dusonlin@emc.com.tw>
---
 drivers/input/mouse/elantech.c |   25 ++++++++++++++++++++++---
 drivers/input/mouse/elantech.h |    1 +
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index ce3d400..d969153 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -784,6 +784,8 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
 	unsigned char *packet = psmouse->packet;
 	unsigned char packet_type = packet[3] & 0x03;
 	bool sanity_check;
+	/* This represents the version of IC body. */
+	int ver = (etd->fw_version & 0x0f0000) >> 16;
 
 	if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)
 		return PACKET_TRACKPOINT;
@@ -796,9 +798,17 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
 	 */
 	if (etd->crc_enabled)
 		sanity_check = ((packet[3] & 0x08) == 0x00);
-	else
-		sanity_check = ((packet[0] & 0x0c) == 0x04 &&
-				(packet[3] & 0x1c) == 0x10);
+	else {
+		/* 
+		 * The sanity check only need to check packet[3]
+		 * when IC_body = 7 and PID = 0x2A  
+		 */
+		if (ver == 7 && etd->samples[1] == 0x2A)
+			sanity_check = ((packet[3] & 0x1c) == 0x10);
+		else
+			sanity_check = ((packet[0] & 0x0c) == 0x04 &&
+					(packet[3] & 0x1c) == 0x10);
+	}
 
 	if (!sanity_check)
 		return PACKET_UNKNOWN;
@@ -1648,6 +1658,15 @@ int elantech_init(struct psmouse *psmouse)
 		     etd->capabilities[0], etd->capabilities[1],
 		     etd->capabilities[2]);
 
+	if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY,
+	    etd->samples)) {
+		psmouse_err(psmouse, "failed to query sample data.\n");
+		goto init_fail;
+	}
+	psmouse_info(psmouse,
+		     "Elan sample query result 0x%02x, 0x%02x, 0x%02x.\n",
+		     etd->samples[0], etd->samples[1], etd->samples[2]);
+
 	if (elantech_set_absolute_mode(psmouse)) {
 		psmouse_err(psmouse,
 			    "failed to put touchpad into absolute mode.\n");
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index f965d15..e1cbf40 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -129,6 +129,7 @@ struct elantech_data {
 	unsigned char reg_26;
 	unsigned char debug;
 	unsigned char capabilities[3];
+	unsigned char samples[3];
 	bool paritycheck;
 	bool jumpy_cursor;
 	bool reports_pressure;







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

* Re: [PATCH] Input - elantech: Add special check for fw_version 0x470f01  touchpad
  2015-07-22 13:55 [PATCH] Input - elantech: Add special check for fw_version 0x470f01 touchpad duson
@ 2015-07-22 19:55 ` ulrik.debie-os
  2015-07-22 23:57   ` DusonLin
  0 siblings, 1 reply; 3+ messages in thread
From: ulrik.debie-os @ 2015-07-22 19:55 UTC (permalink / raw)
  To: duson; +Cc: linux-input, linux-kernel, Dmitry Torokhov


On Wed, Jul 22, 2015 at 09:55:51PM +0800, duson wrote:
> 
> t is no need to check the packet[0] for sanity check when doing
> elantech_packet_check_v4() function for fw_version = 0x470f01 touchpad.
> 
Hi Duson,

The laptops below also had issues with crc_enabled and they were solved by
the elantech_dmi_force_crc_enabled table. (0dc1587905a50f8f61bbc29e850aa592821e4bea)

 * Fujitsu LIFEBOOK E544   0x470f00        d0, 12, 09      2 hw buttons
 * Fujitsu LIFEBOOK E554   0x570f01        40, 14, 0c      2 hw buttons
 * Fujitsu H730            0x570f00        c0, 14, 0c      3 hw buttons (**)

Does the 0x470f01 laptop maybe have exactly the same issue ? In that case,
would it not be better if we could harmonize the solution ?
Do you also have the laptop name, firmware version and button configuration 
available for 0x470f01 and are you in a position to share that information ?
> Signed-off by: Duson Lin <dusonlin@emc.com.tw>
> ---
>  drivers/input/mouse/elantech.c |   25 ++++++++++++++++++++++---
>  drivers/input/mouse/elantech.h |    1 +
>  2 files changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> index ce3d400..d969153 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -784,6 +784,8 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
>  	unsigned char *packet = psmouse->packet;
>  	unsigned char packet_type = packet[3] & 0x03;
>  	bool sanity_check;
> +	/* This represents the version of IC body. */
> +	int ver = (etd->fw_version & 0x0f0000) >> 16;
>  
>  	if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)
>  		return PACKET_TRACKPOINT;
> @@ -796,9 +798,17 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
>  	 */
>  	if (etd->crc_enabled)
>  		sanity_check = ((packet[3] & 0x08) == 0x00);
> -	else
> -		sanity_check = ((packet[0] & 0x0c) == 0x04 &&
> -				(packet[3] & 0x1c) == 0x10);
> +	else {
> +		/* 
> +		 * The sanity check only need to check packet[3]
> +		 * when IC_body = 7 and PID = 0x2A  
> +		 */
> +		if (ver == 7 && etd->samples[1] == 0x2A)
> +			sanity_check = ((packet[3] & 0x1c) == 0x10);
> +		else
> +			sanity_check = ((packet[0] & 0x0c) == 0x04 &&
> +					(packet[3] & 0x1c) == 0x10);
> +	}
>  
>  	if (!sanity_check)
>  		return PACKET_UNKNOWN;
> @@ -1648,6 +1658,15 @@ int elantech_init(struct psmouse *psmouse)
>  		     etd->capabilities[0], etd->capabilities[1],
>  		     etd->capabilities[2]);
>  
> +	if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY,
> +	    etd->samples)) {
> +		psmouse_err(psmouse, "failed to query sample data.\n");
> +		goto init_fail;
> +	}
> +	psmouse_info(psmouse,
> +		     "Elan sample query result 0x%02x, 0x%02x, 0x%02x.\n",
> +		     etd->samples[0], etd->samples[1], etd->samples[2]);
> +

Is this wise to run on all elantech hardware ?

>  	if (elantech_set_absolute_mode(psmouse)) {
>  		psmouse_err(psmouse,
>  			    "failed to put touchpad into absolute mode.\n");
> diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
> index f965d15..e1cbf40 100644
> --- a/drivers/input/mouse/elantech.h
> +++ b/drivers/input/mouse/elantech.h
> @@ -129,6 +129,7 @@ struct elantech_data {
>  	unsigned char reg_26;
>  	unsigned char debug;
>  	unsigned char capabilities[3];
> +	unsigned char samples[3];
>  	bool paritycheck;
>  	bool jumpy_cursor;
>  	bool reports_pressure;
> 
> 
> 
> 
> 
> 
> --
> 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

Kind regards,
Ulrik

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

* RE: [PATCH] Input - elantech: Add special check for fw_version 0x470f01  touchpad
  2015-07-22 19:55 ` ulrik.debie-os
@ 2015-07-22 23:57   ` DusonLin
  0 siblings, 0 replies; 3+ messages in thread
From: DusonLin @ 2015-07-22 23:57 UTC (permalink / raw)
  To: ulrik.debie-os; +Cc: linux-input, linux-kernel, 'Dmitry Torokhov'

Hi,
I think it is different. It looks like the issue about these three laptops
are enabled CRC but can't use the sanity check for crc_enabled=1 case. So,
they need change to go to crc_enabled=0 case.

 * Fujitsu LIFEBOOK E544   0x470f00        d0, 12, 09      2 hw buttons
 * Fujitsu LIFEBOOK E554   0x570f01        40, 14, 0c      2 hw buttons
 * Fujitsu H730           0x570f00        c0, 14, 0c      3 hw buttons (**)

But the issue for 0x470f01 touchpad is the CRC doesn't enabled and the
sanity check for crc_enabled=0 case still can't satisfy the check.

BTW, yes, I can share the laptop information, I will upstream patch again.
Thanks for your advice.

Duson


-----Original Message-----
From: ulrik.debie-os@e2big.org [mailto:ulrik.debie-os@e2big.org] 
Sent: Thursday, July 23, 2015 3:55 AM
To: duson
Cc: linux-input@vger.kernel.org; linux-kernel@vger.kernel.org; Dmitry
Torokhov
Subject: Re: [PATCH] Input - elantech: Add special check for fw_version
0x470f01 touchpad


On Wed, Jul 22, 2015 at 09:55:51PM +0800, duson wrote:
> 
> t is no need to check the packet[0] for sanity check when doing
> elantech_packet_check_v4() function for fw_version = 0x470f01 touchpad.
> 
Hi Duson,

The laptops below also had issues with crc_enabled and they were solved by
the elantech_dmi_force_crc_enabled table.
(0dc1587905a50f8f61bbc29e850aa592821e4bea)

 * Fujitsu LIFEBOOK E544   0x470f00        d0, 12, 09      2 hw buttons
 * Fujitsu LIFEBOOK E554   0x570f01        40, 14, 0c      2 hw buttons
 * Fujitsu H730            0x570f00        c0, 14, 0c      3 hw buttons (**)

Does the 0x470f01 laptop maybe have exactly the same issue ? In that case,
would it not be better if we could harmonize the solution ?
Do you also have the laptop name, firmware version and button configuration
available for 0x470f01 and are you in a position to share that information ?
> Signed-off by: Duson Lin <dusonlin@emc.com.tw>
> ---
>  drivers/input/mouse/elantech.c |   25 ++++++++++++++++++++++---
>  drivers/input/mouse/elantech.h |    1 +
>  2 files changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/mouse/elantech.c 
> b/drivers/input/mouse/elantech.c index ce3d400..d969153 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -784,6 +784,8 @@ static int elantech_packet_check_v4(struct psmouse
*psmouse)
>  	unsigned char *packet = psmouse->packet;
>  	unsigned char packet_type = packet[3] & 0x03;
>  	bool sanity_check;
> +	/* This represents the version of IC body. */
> +	int ver = (etd->fw_version & 0x0f0000) >> 16;
>  
>  	if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)
>  		return PACKET_TRACKPOINT;
> @@ -796,9 +798,17 @@ static int elantech_packet_check_v4(struct psmouse
*psmouse)
>  	 */
>  	if (etd->crc_enabled)
>  		sanity_check = ((packet[3] & 0x08) == 0x00);
> -	else
> -		sanity_check = ((packet[0] & 0x0c) == 0x04 &&
> -				(packet[3] & 0x1c) == 0x10);
> +	else {
> +		/* 
> +		 * The sanity check only need to check packet[3]
> +		 * when IC_body = 7 and PID = 0x2A  
> +		 */
> +		if (ver == 7 && etd->samples[1] == 0x2A)
> +			sanity_check = ((packet[3] & 0x1c) == 0x10);
> +		else
> +			sanity_check = ((packet[0] & 0x0c) == 0x04 &&
> +					(packet[3] & 0x1c) == 0x10);
> +	}
>  
>  	if (!sanity_check)
>  		return PACKET_UNKNOWN;
> @@ -1648,6 +1658,15 @@ int elantech_init(struct psmouse *psmouse)
>  		     etd->capabilities[0], etd->capabilities[1],
>  		     etd->capabilities[2]);
>  
> +	if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY,
> +	    etd->samples)) {
> +		psmouse_err(psmouse, "failed to query sample data.\n");
> +		goto init_fail;
> +	}
> +	psmouse_info(psmouse,
> +		     "Elan sample query result 0x%02x, 0x%02x, 0x%02x.\n",
> +		     etd->samples[0], etd->samples[1], etd->samples[2]);
> +

Is this wise to run on all elantech hardware ?

>  	if (elantech_set_absolute_mode(psmouse)) {
>  		psmouse_err(psmouse,
>  			    "failed to put touchpad into absolute mode.\n");
diff --git 
> a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h 
> index f965d15..e1cbf40 100644
> --- a/drivers/input/mouse/elantech.h
> +++ b/drivers/input/mouse/elantech.h
> @@ -129,6 +129,7 @@ struct elantech_data {
>  	unsigned char reg_26;
>  	unsigned char debug;
>  	unsigned char capabilities[3];
> +	unsigned char samples[3];
>  	bool paritycheck;
>  	bool jumpy_cursor;
>  	bool reports_pressure;
> 
> 
> 
> 
> 
> 
> --
> 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

Kind regards,
Ulrik



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

end of thread, other threads:[~2015-07-22 23:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22 13:55 [PATCH] Input - elantech: Add special check for fw_version 0x470f01 touchpad duson
2015-07-22 19:55 ` ulrik.debie-os
2015-07-22 23:57   ` DusonLin

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