Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2993596imm; Sun, 1 Jul 2018 09:55:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeRSZ4SzQc8LvyaKdyJg6I7nrSujytjXSIduFRgLwlkF2jLloE0CwP/xXWD2uKTSWYYfY5E X-Received: by 2002:a62:2785:: with SMTP id n127-v6mr22348513pfn.129.1530464111126; Sun, 01 Jul 2018 09:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530464111; cv=none; d=google.com; s=arc-20160816; b=jDr+CzWf1hyMTeZ0pSSQDqhkOFWftMzSNudhn2rjFDfK9rj5C7IcOaqjNhefnjZ87J QrODdKqVd1ilaRft/JVfkp8A9PUa6flRbxu3Edw8o9B/V2bdoBhIdspLK/CsP9eBz2zE ofjFN+1Zm8pyVuffMH8zvp7dJIYRJsdgGhpclOZ69zmeZYeabkp/CcsRyTDeQsEE3Hjh 87c50WdiFqg2eWYJLjzvyVSR46VwTRK+jLTLGiFPIG0pzdj6e0cPVm0EWvOCQ2cgcQR7 DOpO/RzfnvUS0/JJT029zjKutJS3pJ+BzWXOfT3N7XMpyHumrKOJfauYJNVsgpO5nBMn go8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=zLy2aKqpqjbzu1zNsT3Ep/B/N0VoLVjWO/o6XErxUa4=; b=b9/VlxJmctNC1svhhKm0TC921ij0gJflcAzQLSo1zIAtafKkO1zwc5/vnWH296Cwc8 87oR+a5a1e9kTKjAU91s4tBpW9dalJlSRDAXJGQobof6rH4D5pml7YlYMZySWv3F935Z nJBwHzJWrs5pTUCLX9xP/U2P/1BO9bgdhXHG1ps+g2Gbk5y/vrP7EMC3CQB8NTlBWi+v uUCaA+LKhd5Dm/sXI91/n6dmigmXSYUn1+mR+MqgDcLb6SKDvYdcMiWJpdjtxHpjL3xW 15tRBNeIBVokF9wr+mIDlqkQi/TJRPFOG3MQxW1Mz8HNhmy9kV8xhYo2G7JRdwDcAbj0 h5Mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6-v6si9758341ply.300.2018.07.01.09.54.56; Sun, 01 Jul 2018 09:55:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753506AbeGAQxd (ORCPT + 99 others); Sun, 1 Jul 2018 12:53:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38240 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752819AbeGAQpe (ORCPT ); Sun, 1 Jul 2018 12:45:34 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B6E6CA73; Sun, 1 Jul 2018 16:45:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Dmitry Torokhov Subject: [PATCH 4.17 197/220] Input: psmouse - fix button reporting for basic protocols Date: Sun, 1 Jul 2018 18:23:41 +0200 Message-Id: <20180701160916.415186666@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov commit 03ae3a9caf4a59edd32b65c89c375a98ce3ea1ef upstream. The commit ba667650c568 ("Input: psmouse - clean up code") was pretty brain-dead and broke extra buttons reporting for variety of PS/2 mice: Genius, Thinkmouse and Intellimouse Explorer. We need to actually inspect the data coming from the device when reporting events. Fixes: ba667650c568 ("Input: psmouse - clean up code") Reported-by: Jiri Slaby Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/psmouse-base.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c @@ -192,8 +192,8 @@ psmouse_ret_t psmouse_process_byte(struc else input_report_rel(dev, REL_WHEEL, -wheel); - input_report_key(dev, BTN_SIDE, BIT(4)); - input_report_key(dev, BTN_EXTRA, BIT(5)); + input_report_key(dev, BTN_SIDE, packet[3] & BIT(4)); + input_report_key(dev, BTN_EXTRA, packet[3] & BIT(5)); break; } break; @@ -203,13 +203,13 @@ psmouse_ret_t psmouse_process_byte(struc input_report_rel(dev, REL_WHEEL, -(s8) packet[3]); /* Extra buttons on Genius NewNet 3D */ - input_report_key(dev, BTN_SIDE, BIT(6)); - input_report_key(dev, BTN_EXTRA, BIT(7)); + input_report_key(dev, BTN_SIDE, packet[0] & BIT(6)); + input_report_key(dev, BTN_EXTRA, packet[0] & BIT(7)); break; case PSMOUSE_THINKPS: /* Extra button on ThinkingMouse */ - input_report_key(dev, BTN_EXTRA, BIT(3)); + input_report_key(dev, BTN_EXTRA, packet[0] & BIT(3)); /* * Without this bit of weirdness moving up gives wildly @@ -223,7 +223,7 @@ psmouse_ret_t psmouse_process_byte(struc * Cortron PS2 Trackball reports SIDE button in the * 4th bit of the first byte. */ - input_report_key(dev, BTN_SIDE, BIT(3)); + input_report_key(dev, BTN_SIDE, packet[0] & BIT(3)); packet[0] |= BIT(3); break;