Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5708632pxv; Wed, 28 Jul 2021 18:13:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMLDecF7/g+LEhUCkVq4V3mc4sBcbDCK/c7U4g3mtg1Ht6j+jKcs4nl11TGMBP93njJzs5 X-Received: by 2002:a05:6e02:1b03:: with SMTP id i3mr1795495ilv.160.1627521231693; Wed, 28 Jul 2021 18:13:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627521231; cv=none; d=google.com; s=arc-20160816; b=UtHdHVGx0xTaGbU0fyuYQIOjAXVhfJiEJo6kkZzwYCoYIABI81lBD8IgrRpkYlzLtI WMf6SyL15i8QAKR311S9kVenjJnCyXXkbYb64ThSsak0ZI+jmwceGLOZ4XmqzFBRD7l+ TlcI6FmU0r3pinErloAOVeDMvYhOP0NRxcz91VuMq0y7oS8x0F59VMRdSRZj7uPQsoYf QuBK1nYlW8PKDqKGkmKnlU14iZlaNr/gwPj4gzLjamaBD7eqAUY7hLLue+cKe2/4P1vY moe2EbyS94MfaFAU+Lrx4PPvudZj4vVdvYzTUHF2cRBe2jiHNE1inY4OxWUJP3TVsFVN uCkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ps7Xku5w0o3oJKOBV8v6aF+ZeyZC8qRusQUiJSyYSy0=; b=OIF31J1ExtsBW0RpWWe8HByS6sMeVI3jNPYTaj7AUxo05Kv4Z6YM7rdt4LorIyc42V G0af7KxXUJDRaehYkg3/RuzUMpOPuY/D8ixk+j/AeACXLKsoL5HU1j5sz0e/E3eMThw7 1yJwBJJV/xijKdHNT++hX9koo0IRdhj5cDyOoFC9pw+2d3EejnMYnw0oFMJv/FUa+9tp AtjJHF6d/oSmi+KdAZN0uzjIlNwg9D5ofFxXseO73XLYKIV2F3PeXBBlKpN1v1yBun6T cgN3jOcaAUVwoApbWBkDHo38FELpUEdG0FBGi/Du8pMcXUPlKafxL+gG0N2zt8CrfwOD IQ+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si1602584ilu.69.2021.07.28.18.13.40; Wed, 28 Jul 2021 18:13:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233153AbhG2BM4 (ORCPT + 99 others); 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