From patchwork Tue Mar 15 03:45:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 8585151 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 24C399F44D for ; Tue, 15 Mar 2016 03:47:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E5D5201F5 for ; Tue, 15 Mar 2016 03:47:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 33CA920160 for ; Tue, 15 Mar 2016 03:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933557AbcCODrb (ORCPT ); Mon, 14 Mar 2016 23:47:31 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:48620 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932162AbcCODra (ORCPT ); Mon, 14 Mar 2016 23:47:30 -0400 Received: from [123.114.56.117] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1affxA-0007tE-AP; Tue, 15 Mar 2016 03:47:28 +0000 From: Hui Wang To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, hui.wang@canonical.com Subject: [PATCH] Input: synaptics - checking Extbit when passing ext_buttons to pt_port Date: Tue, 15 Mar 2016 11:45:22 +0800 Message-Id: <1458013522-8139-1-git-send-email-hui.wang@canonical.com> X-Mailer: git-send-email 1.9.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We found a problem on couples of Lenovo laptop models, when we press down the extend button of trackstick (IBM trackpoint), the driver will report both key_down and key_up events to the userspace, while we release that button, the driver won't report any events to the userspace. Through debugging, we found when we press down or release the extend button, the hardware will report more than one packets to the driver, only one packet is valid (Extbit is set to 1), the rest of the packets only contain zero. The current driver won't drop those invalid packets but regard them as ext_button packets and pass them to the pt_port, unfortunately the zero means key release, as a result the userspace get the key_up event immediately following the key_down event. Adding an Extbit check before passing ext_buttons to pt_port can drop all invalid packets and fix this problem. Signed-off-by: Hui Wang --- drivers/input/mouse/synaptics.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 6025eb4..ad81140 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -880,9 +880,11 @@ static void synaptics_report_ext_buttons(struct psmouse *psmouse, /* * This generation of touchpads has the trackstick buttons * physically wired to the touchpad. Re-route them through - * the pass-through interface. + * the pass-through interface. And only pass extend button + * events to pt_port when ExtBit is 1. */ - if (!priv->pt_port) + if (!priv->pt_port || + !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02)) return; /* The trackstick expects at most 3 buttons */