]>
Commit | Line | Data |
---|---|---|
6fa1c118 GKH |
1 | From 6441fc781c344df61402be1fde582c4491fa35fa Mon Sep 17 00:00:00 2001 |
2 | From: Jason Gerecke <jason.gerecke@wacom.com> | |
3 | Date: Tue, 7 May 2019 11:53:21 -0700 | |
4 | Subject: HID: wacom: Correct button numbering 2nd-gen Intuos Pro over Bluetooth | |
5 | ||
6 | From: Jason Gerecke <jason.gerecke@wacom.com> | |
7 | ||
8 | commit 6441fc781c344df61402be1fde582c4491fa35fa upstream. | |
9 | ||
10 | The button numbering of the 2nd-gen Intuos Pro is not consistent between | |
11 | the USB and Bluetooth interfaces. Over USB, the HID_GENERIC codepath | |
12 | enumerates the eight ExpressKeys first (BTN_0 - BTN_7) followed by the | |
13 | center modeswitch button (BTN_8). The Bluetooth codepath, however, has | |
14 | the center modeswitch button as BTN_0 and the the eight ExpressKeys as | |
15 | BTN_1 - BTN_8. To ensure userspace button mappings do not change | |
16 | depending on how the tablet is connected, modify the Bluetooth codepath | |
17 | to report buttons in the same order as USB. | |
18 | ||
19 | To ensure the mode switch LED continues to toggle in response to the | |
20 | mode switch button, the `wacom_is_led_toggled` function also requires | |
21 | a small update. | |
22 | ||
23 | Link: https://github.com/linuxwacom/input-wacom/pull/79 | |
24 | Fixes: 4922cd26f03c ("HID: wacom: Support 2nd-gen Intuos Pro's Bluetooth classic interface") | |
25 | Cc: <stable@vger.kernel.org> # 4.11+ | |
26 | Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> | |
27 | Reviewed-by: Aaron Skomra <aaron.skomra@wacom.com> | |
28 | Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> | |
29 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
30 | ||
31 | --- | |
32 | drivers/hid/wacom_wac.c | 11 +++++++---- | |
33 | 1 file changed, 7 insertions(+), 4 deletions(-) | |
34 | ||
35 | --- a/drivers/hid/wacom_wac.c | |
36 | +++ b/drivers/hid/wacom_wac.c | |
37 | @@ -1381,7 +1381,7 @@ static void wacom_intuos_pro2_bt_pad(str | |
38 | struct input_dev *pad_input = wacom->pad_input; | |
39 | unsigned char *data = wacom->data; | |
40 | ||
41 | - int buttons = (data[282] << 1) | ((data[281] >> 6) & 0x01); | |
42 | + int buttons = data[282] | ((data[281] & 0x40) << 2); | |
43 | int ring = data[285] & 0x7F; | |
44 | bool ringstatus = data[285] & 0x80; | |
45 | bool prox = buttons || ringstatus; | |
46 | @@ -3850,7 +3850,7 @@ static void wacom_24hd_update_leds(struc | |
47 | static bool wacom_is_led_toggled(struct wacom *wacom, int button_count, | |
48 | int mask, int group) | |
49 | { | |
50 | - int button_per_group; | |
51 | + int group_button; | |
52 | ||
53 | /* | |
54 | * 21UX2 has LED group 1 to the left and LED group 0 | |
55 | @@ -3860,9 +3860,12 @@ static bool wacom_is_led_toggled(struct | |
56 | if (wacom->wacom_wac.features.type == WACOM_21UX2) | |
57 | group = 1 - group; | |
58 | ||
59 | - button_per_group = button_count/wacom->led.count; | |
60 | + group_button = group * (button_count/wacom->led.count); | |
61 | ||
62 | - return mask & (1 << (group * button_per_group)); | |
63 | + if (wacom->wacom_wac.features.type == INTUOSP2_BT) | |
64 | + group_button = 8; | |
65 | + | |
66 | + return mask & (1 << group_button); | |
67 | } | |
68 | ||
69 | static void wacom_update_led(struct wacom *wacom, int button_count, int mask, |