HID: wacom: fix bit shift for Cintiq Companion 2 [Linux 4.9.189]

This Linux kernel change "HID: wacom: fix bit shift for Cintiq Companion 2" is included in the Linux 4.9.189 release. This change is authored by Aaron Armstrong Skomra <skomra [at] gmail.com> on Tue Jul 23 11:09:15 2019 -0700. The commit for this change in Linux stable tree is 0cb65f3 (patch) which is from upstream commit 693c3da. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 693c3da.

HID: wacom: fix bit shift for Cintiq Companion 2

commit 693c3dab4e50403f91bca4b52fc6d8562a3180f6 upstream.

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 <[email protected]>
Reviewed-by: Ping Cheng <[email protected]>
Link: https://github.com/linuxwacom/xf86-input-wacom/issues/71
Fixes: c7f0522a1ad1 ("HID: wacom: Slim down wacom_intuos_pad processing")
Cc: <[email protected]> # v4.5+
Signed-off-by: Jiri Kosina <[email protected]>
Signed-off-by: Greg Kroah-Hartman <greg[email protected]>

There are 12 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/hid/wacom_wac.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index b1ad378..6c3bf88 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -529,14 +529,14 @@ static int wacom_intuos_pad(struct wacom_wac *wacom)
         */
        buttons = (data[4] << 1) | (data[3] & 0x01);
    } else if (features->type == CINTIQ_COMPANION_2) {
-       /* d-pad right  -> data[4] & 0x10
-        * d-pad up     -> data[4] & 0x20
-        * d-pad left   -> data[4] & 0x40
-        * d-pad down   -> data[4] & 0x80
-        * d-pad center -> data[3] & 0x01
+       /* d-pad right  -> data[2] & 0x10
+        * d-pad up     -> data[2] & 0x20
+        * d-pad left   -> data[2] & 0x40
+        * d-pad down   -> data[2] & 0x80
+        * d-pad center -> data[1] & 0x01
         */
        buttons = ((data[2] >> 4) << 7) |
-                 ((data[1] & 0x04) << 6) |
+                 ((data[1] & 0x04) << 4) |
                  ((data[2] & 0x0F) << 2) |
                  (data[1] & 0x03);
    } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {

Leave a Reply

Your email address will not be published. Required fields are marked *