linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: elantench - Fix the firmware misreport coordinates for trackpoint occasionally.
@ 2021-07-29  1:09 Phoenix Huang
  2021-08-30 12:19 ` phoenix
  0 siblings, 1 reply; 9+ messages in thread
From: Phoenix Huang @ 2021-07-29  1:09 UTC (permalink / raw)
  To: linux-kernel, linux-input, dmitry.torokhov
  Cc: jingle.wu, josh.chen, dave.wang, Phoenix Huang

Signed-off-by: Phoenix Huang <phoenix@emc.com.tw>
---
 drivers/input/mouse/elantech.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 2d0bc029619f..07e1098f2d31 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -517,6 +517,17 @@ static void elantech_report_trackpoint(struct psmouse *psmouse,
 	case 0x16008020U:
 	case 0x26800010U:
 	case 0x36808000U:
+	
+		/* This firmware misreport coordinates for trackpoint occasionally.
+		* So we discard these packets by pattern to prevent cursor jumps.
+		*/
+		if (packet[4] == 0x80 || packet[5] == 0x80 ||
+		    packet[1] >> 7 == packet[4] >> 7 ||
+		    packet[2] >> 7 == packet[5] >> 7) {
+		    	elantech_debug("discarding packet [%6ph]\n", packet);
+			break;
+
+		}
 		x = packet[4] - (int)((packet[1]^0x80) << 1);
 		y = (int)((packet[2]^0x80) << 1) - packet[5];
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] Input: elantench - Fix the firmware misreport coordinates for trackpoint occasionally.
@ 2021-07-29  1:03 Phoenix Huang
  0 siblings, 0 replies; 9+ messages in thread
From: Phoenix Huang @ 2021-07-29  1:03 UTC (permalink / raw)
  To: linux-kernel, linux-input, dmitry.torokhov
  Cc: jingle.wu, josh.chen, dave.wang, Phoenix Huang

Signed-off-by: Phoenix Huang <phoenix@emc.com.tw>
---
 drivers/input/mouse/elantech.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 2d0bc029619f..a31c2f5b7cf0 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -517,6 +517,17 @@ static void elantech_report_trackpoint(struct psmouse *psmouse,
 	case 0x16008020U:
 	case 0x26800010U:
 	case 0x36808000U:
+	
+		/* This firmware misreport coordinates for trackpoint occasionally.
+		* So we discard these packets by pattern to prevent cursor jumps.
+		*/
+		if (packet[4] == 0x80 || packet[5] == 0x80 ||
+		    packet[1] >> 7 == packet[4] >> 7 ||
+		    packet[2] >> 7 == packet[5] >> 7) {
+		    	elantech_debug("discarding packet [%6ph]\n", packet);
+			break;
+
+		}
 		x = packet[4] - (int)((packet[1]^0x80) << 1);
 		y = (int)((packet[2]^0x80) << 1) - packet[5];
 
@@ -1678,7 +1689,7 @@ static int elantech_query_info(struct psmouse *psmouse,
 		return -EINVAL;
 	}
 	psmouse_info(psmouse,
-		     "assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n",
+		     "(7/19) assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n",
 		     info->hw_version, param[0], param[1], param[2]);
 
 	if (info->send_cmd(psmouse, ETP_CAPABILITIES_QUERY,
-- 
2.25.1


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

end of thread, other threads:[~2021-11-10  6:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  1:09 [PATCH] Input: elantench - Fix the firmware misreport coordinates for trackpoint occasionally Phoenix Huang
2021-08-30 12:19 ` phoenix
2021-08-30 20:23   ` Dmitry Torokhov
2021-09-10  2:18     ` phoenix
2021-11-07 20:02     ` Yufei Du
2021-11-08  6:06       ` Dmitry Torokhov
2021-11-08  6:14         ` Yufei Du
2021-11-10  6:24           ` Dmitry Torokhov
  -- strict thread matches above, loose matches on Subject: below --
2021-07-29  1:03 Phoenix Huang

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