Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3011379ybi; Mon, 17 Jun 2019 14:38:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcYR2p7L6QtuW76AitU39Zm0vwixmcTrxSyUHsW7jaHeVVaMn0ScdoNGcXCmwXcmAOSloX X-Received: by 2002:a17:902:b94a:: with SMTP id h10mr110372061pls.265.1560807522866; Mon, 17 Jun 2019 14:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560807522; cv=none; d=google.com; s=arc-20160816; b=yWMmYUjYHwhT7Zll7ZQvq0YlJysUcIIOtr/T5BZdcJKGTmXa46aSfiq47eQgNqv/2Z rRtZ4lB5B8chCMX9NtgYl1F356pTBQDnF+yivjyljGpRoJfwjKJPg3sDWH1HOQL6jH10 NLOiJfvrmyO7YbXwnmVr0X/PshnoG6V5k/v6xWjDFowMOTLh7BDe3cy01TwfWMgGGi4v cMe6JTyRtWJTSSULif41H/FG/8EbXJZjnTEvBOSrvyptj8/bzXu7UDk59o9xTnrlrP+o XplCkCcKiCjtS3u9yLIn7xHd166Evc9F+eXUf+9Wxb9g5j8oePyq6G1FurtKACKa7gzq AEoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZlMjjnAwSu+LEp23OaDBeZG0+6KXHqanz2AmaJUE+BE=; b=wMteS+vamCm0tPyEaq5h7/pyg3cIkJgKnO+dJCqxEzogA1PN6LCsdwMkR5NAlmcrqs 9IZZ54CdAFBqpAMiM4zgkG3ii2CypmVpXa/i0fZ/uWlpDP8NcXeLo/ENk0U211q4FWmz XO12C+z1PcX5DmOgEvLCxvTN1KHcRpUCVtQ9R/oJiegrowynReebMtaiLqD7N7NvAzqP 4rtVoEnx+AqnoEGDoIPdV/KqRUUY8SxZ6+W5h3TJwTP0Bet2ud1VCEevRlNBl5MTqW8n dARrV0JaLzh5gd580zF9MK40wtfMBFNKoMQBqZkaVB7+cO9KAuv27a3fTe5ALLSsTmD6 w96w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="GRB4q/SV"; 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 h21si11267301pgv.266.2019.06.17.14.38.27; Mon, 17 Jun 2019 14:38:42 -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; dkim=pass header.i=@kernel.org header.s=default header.b="GRB4q/SV"; 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 S1727102AbfFQVSg (ORCPT + 99 others); Mon, 17 Jun 2019 17:18:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:42088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbfFQVSf (ORCPT ); Mon, 17 Jun 2019 17:18:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57920208CB; Mon, 17 Jun 2019 21:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806314; bh=loqM1FvE8p0d5XRVN46uVoBtpy2yvMzgd4zOq2yJjDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GRB4q/SVrC1utdHxszvGjG9LpcyVHKxcIpK9vHhE7wsqo7vxzOhhSkpfiWxacF2zr cFYH1XLOI2Cskr9CIHM0KMgEkrOI73gY7NBghDu+t0Ob0pI47+Xsev7klonyDkHt58 Lvj0nH3q5BaG97WzzvsYooe4ucScrCpTFVWTwlL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Gerecke , Aaron Skomra , Benjamin Tissoires Subject: [PATCH 5.1 010/115] HID: wacom: Correct button numbering 2nd-gen Intuos Pro over Bluetooth Date: Mon, 17 Jun 2019 23:08:30 +0200 Message-Id: <20190617210800.444784204@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210759.929316339@linuxfoundation.org> References: <20190617210759.929316339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Gerecke commit 6441fc781c344df61402be1fde582c4491fa35fa upstream. The button numbering of the 2nd-gen Intuos Pro is not consistent between the USB and Bluetooth interfaces. Over USB, the HID_GENERIC codepath enumerates the eight ExpressKeys first (BTN_0 - BTN_7) followed by the center modeswitch button (BTN_8). The Bluetooth codepath, however, has the center modeswitch button as BTN_0 and the the eight ExpressKeys as BTN_1 - BTN_8. To ensure userspace button mappings do not change depending on how the tablet is connected, modify the Bluetooth codepath to report buttons in the same order as USB. To ensure the mode switch LED continues to toggle in response to the mode switch button, the `wacom_is_led_toggled` function also requires a small update. Link: https://github.com/linuxwacom/input-wacom/pull/79 Fixes: 4922cd26f03c ("HID: wacom: Support 2nd-gen Intuos Pro's Bluetooth classic interface") Cc: # 4.11+ Signed-off-by: Jason Gerecke Reviewed-by: Aaron Skomra Signed-off-by: Benjamin Tissoires Signed-off-by: Greg Kroah-Hartman --- drivers/hid/wacom_wac.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1383,7 +1383,7 @@ static void wacom_intuos_pro2_bt_pad(str struct input_dev *pad_input = wacom->pad_input; unsigned char *data = wacom->data; - int buttons = (data[282] << 1) | ((data[281] >> 6) & 0x01); + int buttons = data[282] | ((data[281] & 0x40) << 2); int ring = data[285] & 0x7F; bool ringstatus = data[285] & 0x80; bool prox = buttons || ringstatus; @@ -3832,7 +3832,7 @@ static void wacom_24hd_update_leds(struc static bool wacom_is_led_toggled(struct wacom *wacom, int button_count, int mask, int group) { - int button_per_group; + int group_button; /* * 21UX2 has LED group 1 to the left and LED group 0 @@ -3842,9 +3842,12 @@ static bool wacom_is_led_toggled(struct if (wacom->wacom_wac.features.type == WACOM_21UX2) group = 1 - group; - button_per_group = button_count/wacom->led.count; + group_button = group * (button_count/wacom->led.count); - return mask & (1 << (group * button_per_group)); + if (wacom->wacom_wac.features.type == INTUOSP2_BT) + group_button = 8; + + return mask & (1 << group_button); } static void wacom_update_led(struct wacom *wacom, int button_count, int mask,