RE: [PATCH] Input: elantench - Fix the firmware misreport coordinates for trackpoint occasionally.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dmitry,

Would you review this patch, thanks

Best regards,
Phoenix Huang

-----Original Message-----
From: Phoenix Huang [mailto:phoenix@xxxxxxxxxx] 
Sent: Thursday, July 29, 2021 9:10 AM
To: linux-kernel@xxxxxxxxxxxxxxx; linux-input@xxxxxxxxxxxxxxx;
dmitry.torokhov@xxxxxxxxx
Cc: jingle.wu@xxxxxxxxxx; josh.chen@xxxxxxxxxx; dave.wang@xxxxxxxxxx;
Phoenix Huang <phoenix@xxxxxxxxxx>
Subject: [PATCH] Input: elantench - Fix the firmware misreport coordinates
for trackpoint occasionally.

Signed-off-by: Phoenix Huang <phoenix@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux