From patchwork Fri Jan 12 06:46:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Ma X-Patchwork-Id: 10159677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2761A602D8 for ; Fri, 12 Jan 2018 06:47:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1367C28870 for ; Fri, 12 Jan 2018 06:47:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 081C528872; Fri, 12 Jan 2018 06:47:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BB9F28874 for ; Fri, 12 Jan 2018 06:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752701AbeALGrj (ORCPT ); Fri, 12 Jan 2018 01:47:39 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:51372 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750716AbeALGri (ORCPT ); Fri, 12 Jan 2018 01:47:38 -0500 Received: from [219.142.94.193] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1eZt7o-0007CP-9H; Fri, 12 Jan 2018 06:47:37 +0000 From: Aaron Ma To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Input: trackpoint - force 3 buttons if 0 button is reported Date: Fri, 12 Jan 2018 14:46:58 +0800 Message-Id: <20180112064658.25019-1-aaron.ma@canonical.com> X-Mailer: git-send-email 2.14.3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Lenovo introduced trackpoint compatible sticks with minimum PS/2 commands. Some of these sticks with 3 buttons always return 0 when reading extended button info, set it as 3 buttons to enable middle button. Cc: stable@vger.kernel.org Signed-off-by: Aaron Ma --- drivers/input/mouse/trackpoint.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 0871010f18d5..00c0d1706567 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c @@ -383,6 +383,10 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) if (trackpoint_read(ps2dev, TP_EXT_BTN, &button_info)) { psmouse_warn(psmouse, "failed to get extended button data, assuming 3 buttons\n"); button_info = 0x33; + } else if (!button_info) { + psmouse_warn(psmouse, + "got no extended button data, assuming 3 buttons\n"); + button_info = 0x33; } psmouse->private = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL);