Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: wacom: fix bit shift for Cintiq Companion 2

The bit indicating BTN_6 on this device is overshifted
by 2 bits, resulting in the incorrect button being
reported.

Also fix copy-paste mistake in comments.

Signed-off-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
Link: https://github.com/linuxwacom/xf86-input-wacom/issues/71
Fixes: c7f0522a1ad1 ("HID: wacom: Slim down wacom_intuos_pad processing")
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Aaron Armstrong Skomra and committed by
Jiri Kosina
693c3dab 7bc74853

+6 -6
+6 -6
drivers/hid/wacom_wac.c
··· 533 533 */ 534 534 buttons = (data[4] << 1) | (data[3] & 0x01); 535 535 } else if (features->type == CINTIQ_COMPANION_2) { 536 - /* d-pad right -> data[4] & 0x10 537 - * d-pad up -> data[4] & 0x20 538 - * d-pad left -> data[4] & 0x40 539 - * d-pad down -> data[4] & 0x80 540 - * d-pad center -> data[3] & 0x01 536 + /* d-pad right -> data[2] & 0x10 537 + * d-pad up -> data[2] & 0x20 538 + * d-pad left -> data[2] & 0x40 539 + * d-pad down -> data[2] & 0x80 540 + * d-pad center -> data[1] & 0x01 541 541 */ 542 542 buttons = ((data[2] >> 4) << 7) | 543 - ((data[1] & 0x04) << 6) | 543 + ((data[1] & 0x04) << 4) | 544 544 ((data[2] & 0x0F) << 2) | 545 545 (data[1] & 0x03); 546 546 } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {