From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5118C4338F for ; Thu, 29 Jul 2021 01:12:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96BF660F91 for ; Thu, 29 Jul 2021 01:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233182AbhG2BM4 (ORCPT ); Wed, 28 Jul 2021 21:12:56 -0400 Received: from emcscan.emc.com.tw ([192.72.220.5]:32512 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232837AbhG2BMz (ORCPT ); Wed, 28 Jul 2021 21:12:55 -0400 X-IronPort-AV: E=Sophos;i="5.56,253,1539619200"; d="scan'208";a="41939805" Received: from unknown (HELO webmail.emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with ESMTP; 29 Jul 2021 09:03:11 +0800 Received: from 192.168.10.23 by webmail.emc.com.tw with MailAudit ESMTP Server V5.0(119551:0:AUTH_RELAY) (envelope-from ); Thu, 29 Jul 2021 09:03:10 +0800 (CST) Received: from 49.216.187.106 by webmail.emc.com.tw with Mail2000 ESMTPA Server V7.00(2473:0:AUTH_LOGIN) (envelope-from ); Thu, 29 Jul 2021 09:03:08 +0800 (CST) From: Phoenix Huang To: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com Cc: jingle.wu@emc.com.tw, josh.chen@emc.com.tw, dave.wang@emc.com.tw, Phoenix Huang Subject: [PATCH] Input: elantench - Fix the firmware misreport coordinates for trackpoint occasionally. Date: Thu, 29 Jul 2021 09:03:06 +0800 Message-Id: <20210729010306.5339-1-phoenix@emc.com.tw> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Phoenix Huang --- 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