]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - pending-4.19/hid-wacom-don-t-report-anything-prior-to-the-tool-entering-range.patch
move existing queues out of the way for the moment...
[thirdparty/kernel/stable-queue.git] / pending-4.19 / hid-wacom-don-t-report-anything-prior-to-the-tool-entering-range.patch
CommitLineData
6fa1c118
GKH
1From e92a7be7fe5b2510fa60965eaf25f9e3dc08b8cc Mon Sep 17 00:00:00 2001
2From: Jason Gerecke <jason.gerecke@wacom.com>
3Date: Wed, 24 Apr 2019 15:12:58 -0700
4Subject: HID: wacom: Don't report anything prior to the tool entering range
5
6From: Jason Gerecke <jason.gerecke@wacom.com>
7
8commit e92a7be7fe5b2510fa60965eaf25f9e3dc08b8cc upstream.
9
10If the tool spends some time in prox before entering range, a series of
11events (e.g. ABS_DISTANCE, MSC_SERIAL) can be sent before we or userspace
12have any clue about the pen whose data is being reported. We need to hold
13off on reporting anything until the pen has entered range. Since we still
14want to report events that occur "in prox" after the pen has *left* range
15we use 'wacom-tool[0]' as the indicator that the pen did at one point
16enter range and provide us/userspace with tool type and serial number
17information.
18
19Fixes: a48324de6d4d ("HID: wacom: Bluetooth IRQ for Intuos Pro should handle prox/range")
20Cc: <stable@vger.kernel.org> # 4.11+
21Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
22Reviewed-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
23Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
24Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26---
27 drivers/hid/wacom_wac.c | 33 ++++++++++++++++++---------------
28 1 file changed, 18 insertions(+), 15 deletions(-)
29
30--- a/drivers/hid/wacom_wac.c
31+++ b/drivers/hid/wacom_wac.c
32@@ -1288,23 +1288,26 @@ static void wacom_intuos_pro2_bt_pen(str
33 get_unaligned_le16(&frame[11]));
34 }
35 }
36- input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));
37- if (wacom->features.type == INTUOSP2_BT) {
38- input_report_abs(pen_input, ABS_DISTANCE,
39- range ? frame[13] : wacom->features.distance_max);
40- } else {
41- input_report_abs(pen_input, ABS_DISTANCE,
42- range ? frame[7] : wacom->features.distance_max);
43- }
44
45- input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x01);
46- input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02);
47- input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04);
48+ if (wacom->tool[0]) {
49+ input_report_abs(pen_input, ABS_PRESSURE, get_unaligned_le16(&frame[5]));
50+ if (wacom->features.type == INTUOSP2_BT) {
51+ input_report_abs(pen_input, ABS_DISTANCE,
52+ range ? frame[13] : wacom->features.distance_max);
53+ } else {
54+ input_report_abs(pen_input, ABS_DISTANCE,
55+ range ? frame[7] : wacom->features.distance_max);
56+ }
57+
58+ input_report_key(pen_input, BTN_TOUCH, frame[0] & 0x01);
59+ input_report_key(pen_input, BTN_STYLUS, frame[0] & 0x02);
60+ input_report_key(pen_input, BTN_STYLUS2, frame[0] & 0x04);
61
62- input_report_key(pen_input, wacom->tool[0], prox);
63- input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]);
64- input_report_abs(pen_input, ABS_MISC,
65- wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */
66+ input_report_key(pen_input, wacom->tool[0], prox);
67+ input_event(pen_input, EV_MSC, MSC_SERIAL, wacom->serial[0]);
68+ input_report_abs(pen_input, ABS_MISC,
69+ wacom_intuos_id_mangle(wacom->id[0])); /* report tool id */
70+ }
71
72 wacom->shared->stylus_in_proximity = prox;
73