]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Nov 2022 08:30:58 +0000 (09:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Nov 2022 08:30:58 +0000 (09:30 +0100)
added patches:
hid-wacom-fix-logic-used-for-3rd-barrel-switch-emulation.patch

queue-6.0/hid-wacom-fix-logic-used-for-3rd-barrel-switch-emulation.patch [new file with mode: 0644]
queue-6.0/series

diff --git a/queue-6.0/hid-wacom-fix-logic-used-for-3rd-barrel-switch-emulation.patch b/queue-6.0/hid-wacom-fix-logic-used-for-3rd-barrel-switch-emulation.patch
new file mode 100644 (file)
index 0000000..afbd595
--- /dev/null
@@ -0,0 +1,53 @@
+From f77810f744139572a63e5a85ab6a8c10c2d44fb1 Mon Sep 17 00:00:00 2001
+From: Jason Gerecke <killertofu@gmail.com>
+Date: Thu, 3 Nov 2022 10:33:04 -0700
+Subject: HID: wacom: Fix logic used for 3rd barrel switch emulation
+
+From: Jason Gerecke <killertofu@gmail.com>
+
+commit f77810f744139572a63e5a85ab6a8c10c2d44fb1 upstream.
+
+When support was added for devices using an explicit 3rd barrel switch,
+the logic used by devices emulating this feature was broken. The 'if'
+statement / block that was introduced only handles the case where the
+button is pressed (i.e. 'barrelswitch' and 'barrelswitch2' are both set)
+but not the case where it is released (i.e. one or both being cleared).
+This results in a BTN_STYLUS3 "down" event being sent when the button
+is pressed, but no "up" event ever being sent afterwards.
+
+This patch restores the previously-used logic for determining button
+states in the emulated case so that switches are reported correctly
+again.
+
+Link: https://github.com/linuxwacom/xf86-input-wacom/issues/292
+Fixes: 6d09085b38e5 ("HID: wacom: Adding Support for new usages")
+CC: stable@vger.kernel.org #v5.19+
+Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
+Tested-by: Joshua Dickens <joshua.dickens@wacom.com>
+Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/hid/wacom_wac.c |   11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+--- a/drivers/hid/wacom_wac.c
++++ b/drivers/hid/wacom_wac.c
+@@ -2522,11 +2522,12 @@ static void wacom_wac_pen_report(struct
+       if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) {
+               int id = wacom_wac->id[0];
+-              if (wacom_wac->features.quirks & WACOM_QUIRK_PEN_BUTTON3 &&
+-                  wacom_wac->hid_data.barrelswitch & wacom_wac->hid_data.barrelswitch2) {
+-                      wacom_wac->hid_data.barrelswitch = 0;
+-                      wacom_wac->hid_data.barrelswitch2 = 0;
+-                      wacom_wac->hid_data.barrelswitch3 = 1;
++              if (wacom_wac->features.quirks & WACOM_QUIRK_PEN_BUTTON3) {
++                      int sw_state = wacom_wac->hid_data.barrelswitch |
++                                     (wacom_wac->hid_data.barrelswitch2 << 1);
++                      wacom_wac->hid_data.barrelswitch = sw_state == 1;
++                      wacom_wac->hid_data.barrelswitch2 = sw_state == 2;
++                      wacom_wac->hid_data.barrelswitch3 = sw_state == 3;
+               }
+               input_report_key(input, BTN_STYLUS, wacom_wac->hid_data.barrelswitch);
+               input_report_key(input, BTN_STYLUS2, wacom_wac->hid_data.barrelswitch2);
index 34b262c4c68e61606e137808a742d44ee1025cf7..73d441f0e1141feed64fde3e014cfeca405692af 100644 (file)
@@ -11,3 +11,4 @@ drm-amd-display-set-memclk-levels-to-be-at-least-1-f.patch
 drm-amdkfd-handle-cpu-fault-on-cow-mapping.patch
 drm-amdkfd-fix-null-pointer-dereference-in-svm_migra.patch
 cxl-region-recycle-region-ids.patch
+hid-wacom-fix-logic-used-for-3rd-barrel-switch-emulation.patch