Skip to content

Commit 49a397a

Browse files
jigpuJiri Kosina
authored andcommitted
HID: wacom: Interpret tilt data from Intuos Pro BT as signed values
The tilt data contained in the Bluetooth packets of an Intuos Pro are supposed to be interpreted as signed values. Simply casting the values to type `char` is not guaranteed to work since it is implementation- defined whether it is signed or unsigned. At least one user has noticed the data being reported incorrectly on their system. To ensure that the data is interpreted properly, we specifically cast to `signed char` instead. Link: linuxwacom/input-wacom#445 Fixes: 4922cd2 ("HID: wacom: Support 2nd-gen Intuos Pro's Bluetooth classic interface") CC: stable@vger.kernel.org # 4.11+ Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 177f25d commit 49a397a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hid/wacom_wac.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,9 +1353,9 @@ static void wacom_intuos_pro2_bt_pen(struct wacom_wac *wacom)
13531353
rotation -= 1800;
13541354

13551355
input_report_abs(pen_input, ABS_TILT_X,
1356-
(char)frame[7]);
1356+
(signed char)frame[7]);
13571357
input_report_abs(pen_input, ABS_TILT_Y,
1358-
(char)frame[8]);
1358+
(signed char)frame[8]);
13591359
input_report_abs(pen_input, ABS_Z, rotation);
13601360
input_report_abs(pen_input, ABS_WHEEL,
13611361
get_unaligned_le16(&frame[11]));

0 commit comments

Comments
 (0)