]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.13.6/hid-wacom-properly-report-negative-values-from-intuos-pro-2-bluetooth.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.13.6 / hid-wacom-properly-report-negative-values-from-intuos-pro-2-bluetooth.patch
1 From b63c4c2718d641ba9bec888994f0cb0c23a1ef45 Mon Sep 17 00:00:00 2001
2 From: Jason Gerecke <killertofu@gmail.com>
3 Date: Wed, 30 Aug 2017 15:13:25 -0700
4 Subject: HID: wacom: Properly report negative values from Intuos Pro 2 Bluetooth
5
6 From: Jason Gerecke <killertofu@gmail.com>
7
8 commit b63c4c2718d641ba9bec888994f0cb0c23a1ef45 upstream.
9
10 The wacom driver's IRQ handler for Bluetooth reports from the 2nd-gen
11 Intuos Pro does not correctly process negative numbers. Values for
12 tilt and rotation (which can go negative) are instead interpreted as
13 unsigned and so jump to very large values when the data should be
14 negative. This commit properly casts the data to ensure we report
15 negative numbers when necessary.
16
17 Fixes: 4922cd2 ("HID: wacom: Support 2nd-gen Intuos Pro's Bluetooth classic interface")
18 Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
19 Signed-off-by: Jiri Kosina <jkosina@suse.cz>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 drivers/hid/wacom_wac.c | 6 +++---
24 1 file changed, 3 insertions(+), 3 deletions(-)
25
26 --- a/drivers/hid/wacom_wac.c
27 +++ b/drivers/hid/wacom_wac.c
28 @@ -1229,9 +1229,9 @@ static void wacom_intuos_pro2_bt_pen(str
29 if (range) {
30 input_report_abs(pen_input, ABS_X, get_unaligned_le16(&frame[1]));
31 input_report_abs(pen_input, ABS_Y, get_unaligned_le16(&frame[3]));
32 - input_report_abs(pen_input, ABS_TILT_X, frame[7]);
33 - input_report_abs(pen_input, ABS_TILT_Y, frame[8]);
34 - input_report_abs(pen_input, ABS_Z, get_unaligned_le16(&frame[9]));
35 + input_report_abs(pen_input, ABS_TILT_X, (char)frame[7]);
36 + input_report_abs(pen_input, ABS_TILT_Y, (char)frame[8]);
37 + input_report_abs(pen_input, ABS_Z, (int16_t)get_unaligned_le16(&frame[9]));
38 input_report_abs(pen_input, ABS_WHEEL, get_unaligned_le16(&frame[11]));
39 }
40 input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));