Skip to content

Commit 6441fc7

Browse files
jigpubentiss
authored andcommitted
HID: wacom: Correct button numbering 2nd-gen Intuos Pro over Bluetooth
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: linuxwacom/input-wacom#79 Fixes: 4922cd2 ("HID: wacom: Support 2nd-gen Intuos Pro's Bluetooth classic interface") Cc: <[email protected]> # 4.11+ Signed-off-by: Jason Gerecke <[email protected]> Reviewed-by: Aaron Skomra <[email protected]> Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent fe7f8d7 commit 6441fc7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/hid/wacom_wac.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ static void wacom_intuos_pro2_bt_pad(struct wacom_wac *wacom)
13831383
struct input_dev *pad_input = wacom->pad_input;
13841384
unsigned char *data = wacom->data;
13851385

1386-
int buttons = (data[282] << 1) | ((data[281] >> 6) & 0x01);
1386+
int buttons = data[282] | ((data[281] & 0x40) << 2);
13871387
int ring = data[285] & 0x7F;
13881388
bool ringstatus = data[285] & 0x80;
13891389
bool prox = buttons || ringstatus;
@@ -3832,7 +3832,7 @@ static void wacom_24hd_update_leds(struct wacom *wacom, int mask, int group)
38323832
static bool wacom_is_led_toggled(struct wacom *wacom, int button_count,
38333833
int mask, int group)
38343834
{
3835-
int button_per_group;
3835+
int group_button;
38363836

38373837
/*
38383838
* 21UX2 has LED group 1 to the left and LED group 0
@@ -3842,9 +3842,12 @@ static bool wacom_is_led_toggled(struct wacom *wacom, int button_count,
38423842
if (wacom->wacom_wac.features.type == WACOM_21UX2)
38433843
group = 1 - group;
38443844

3845-
button_per_group = button_count/wacom->led.count;
3845+
group_button = group * (button_count/wacom->led.count);
38463846

3847-
return mask & (1 << (group * button_per_group));
3847+
if (wacom->wacom_wac.features.type == INTUOSP2_BT)
3848+
group_button = 8;
3849+
3850+
return mask & (1 << group_button);
38483851
}
38493852

38503853
static void wacom_update_led(struct wacom *wacom, int button_count, int mask,

0 commit comments

Comments
 (0)