From patchwork Wed Nov 30 10:11:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Phidias Chiang X-Patchwork-Id: 700937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3tTGQq5X6mz9t1C; Wed, 30 Nov 2016 21:11:15 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1cC1r6-0007lz-Jh; Wed, 30 Nov 2016 10:11:12 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1cC1qv-0007hd-T7 for kernel-team@lists.ubuntu.com; Wed, 30 Nov 2016 10:11:01 +0000 Received: from 114-34-181-73.hinet-ip.hinet.net ([114.34.181.73] helo=ktx.tw) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1cC1qv-0003St-3H for kernel-team@lists.ubuntu.com; Wed, 30 Nov 2016 10:11:01 +0000 From: Phidias Chiang To: kernel-team@lists.ubuntu.com Subject: [SRU][Xenial][Yakkety][PATCH 2/4] Input: ALPS - handle 0-pressure 1F events Date: Wed, 30 Nov 2016 18:11:00 +0800 Message-Id: <1480500662-23888-3-git-send-email-phidias.chiang@canonical.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1480500662-23888-1-git-send-email-phidias.chiang@canonical.com> References: <1480500662-23888-1-git-send-email-phidias.chiang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Ben Gamari BugLink: http://bugs.launchpad.net/bugs/1571530 While a button is held SS5 hardware will give us single-finger packets with x, y, and pressure equal to zero. This causes annoying jumps in pointer position if a touch is released while the button is held. Handle this by claiming zero contacts to ensure that no position events are provided to the user. Reviewed-by: Pali Rohár Tested-by: Michal Hocko Signed-off-by: Ben Gamari Signed-off-by: Dmitry Torokhov (cherry picked from commit a831776323e7c532ef9c88d0d62512ae15d78415) Signed-off-by: Phidias Chiang --- drivers/input/mouse/alps.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 27a32db..b32bfd1 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -1197,7 +1197,13 @@ static int alps_decode_ss4_v2(struct alps_fields *f, f->mt[0].x = SS4_1F_X_V2(p); f->mt[0].y = SS4_1F_Y_V2(p); f->pressure = ((SS4_1F_Z_V2(p)) * 2) & 0x7f; - f->fingers = 1; + /* + * When a button is held the device will give us events + * with x, y, and pressure of 0. This causes annoying jumps + * if a touch is released while the button is held. + * Handle this by claiming zero contacts. + */ + f->fingers = f->pressure > 0 ? 1 : 0; f->first_mp = 0; f->is_mp = 0; break;