Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5707072pxv; Wed, 28 Jul 2021 18:10:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMpMxAH37upG/g5sS4nmlCHz/rlCAJu85BsASljfD82aS5oNx+WtYT2JxESD4dIchLdxES X-Received: by 2002:a6b:4f16:: with SMTP id d22mr1836794iob.15.1627521049702; Wed, 28 Jul 2021 18:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627521049; cv=none; d=google.com; s=arc-20160816; b=las1LhdnoZPgoilHob7i4G/89aPOJ8/gFOTwsGFLYJfYRR+3scTFeIqxC1piMaWpyn rraRPVraF7SxgX+6pjwm1rFI8dXHLe0c/xUdb8UNvhXjX+A3ZK2juEQQaHNiHcnFuxcb HHxu9Zye8a2WOrQUbV9TD+LgdqGqQJYnZwIgZmhreagrwdpi+ykwcuzVIaiD+OHVsZPg l2A2lsk/TMy3mSmNnbC4WXFjDbq5TrBmbZx783zh++aVdP5B6hLfqnyMZucHJLVVV923 FTI4eSGTzuxqRvgg8DxQVPzYgZ8DodGReWxzanTLQ5V4LQRCkfh3pzoCLYdrXf1m3sJq HJrw== 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=GEqcNV8j1n67WuvujMlGyxinxg6/NSYtPUGyPat4grA=; b=feU6rfCfR0o3Ijxqrqfx8k2R+kVnUyKRJYN0XH2piGhbrhT17SzPxt/GZdAj+6Xsca 9IO8QiCLbNK0aqV/rdP30jKfj7gAugEIZzotkdkkD8c+FvRQrHkASDh7Yd526dLq5ovy QqSH/stzpUqgKpqAQSwdKPAtGfhJhRjW5FL0L41ehL2bgD8lQiz1qL6CEb9UJN6JXFDZ DxtR4P8UarBqnJRLvcV2JucrCKwhcOOpZYnyGaKuP6kwqHA2wQHVuDu5OA3UeoX4Iik7 iv4Uk5ENV+TIgbqEB76pIzG2iASHA4VUJ+VdM98XFA6Vn8CMbF7GhCKcmKyhXRDVcyoF ugcQ== 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 i1si1516109ils.142.2021.07.28.18.10.38; Wed, 28 Jul 2021 18:10:49 -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 S233067AbhG2BKB (ORCPT + 99 others); Wed, 28 Jul 2021 21:10:01 -0400 Received: from emcscan.emc.com.tw ([192.72.220.5]:36055 "EHLO emcscan.emc.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232837AbhG2BKB (ORCPT ); Wed, 28 Jul 2021 21:10:01 -0400 X-Greylist: delayed 406 seconds by postgrey-1.27 at vger.kernel.org; Wed, 28 Jul 2021 21:10:01 EDT X-IronPort-AV: E=Sophos;i="5.56,253,1539619200"; d="scan'208";a="41940684" Received: from unknown (HELO webmail.emc.com.tw) ([192.168.10.1]) by emcscan.emc.com.tw with ESMTP; 29 Jul 2021 09:09:58 +0800 Received: from 192.168.10.23 by webmail.emc.com.tw with MailAudit ESMTP Server V5.0(115098:0:AUTH_RELAY) (envelope-from ); Thu, 29 Jul 2021 09:09:55 +0800 (CST) Received: from 49.216.187.106 by webmail.emc.com.tw with Mail2000 ESMTPA Server V7.00(2476:0:AUTH_LOGIN) (envelope-from ); Thu, 29 Jul 2021 09:09:55 +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:09:40 +0800 Message-Id: <20210729010940.5752-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 | 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