2021-07-29 01:13:51

by Phoenix

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

Signed-off-by: Phoenix Huang <[email protected]>
---
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



2021-11-08 10:40:50

by Yufei Du

[permalink] [raw]
Subject: Re: [PATCH] Input: elantench - Fix the firmware misreport coordinates for trackpoint occasionally.

Hi Dmitry,

> Sorry I lost track of this patch. Can I add your Tested-by to it before
> applying?

Sure. Thanks!

Best,
Yufei

2021-11-10 06:30:01

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH] Input: elantench - Fix the firmware misreport coordinates for trackpoint occasionally.

On Mon, Nov 08, 2021 at 01:14:44AM -0500, Yufei Du wrote:
> Hi Dmitry,
>
> > Sorry I lost track of this patch. Can I add your Tested-by to it before
> > applying?
>
> Sure. Thanks!

It is applied now, thank you everyone.

--
Dmitry