]>
Commit | Line | Data |
---|---|---|
6fa1c118 GKH |
1 | From e92a7be7fe5b2510fa60965eaf25f9e3dc08b8cc Mon Sep 17 00:00:00 2001 |
2 | From: Jason Gerecke <jason.gerecke@wacom.com> | |
3 | Date: Wed, 24 Apr 2019 15:12:58 -0700 | |
4 | Subject: HID: wacom: Don't report anything prior to the tool entering range | |
5 | ||
6 | From: Jason Gerecke <jason.gerecke@wacom.com> | |
7 | ||
8 | commit e92a7be7fe5b2510fa60965eaf25f9e3dc08b8cc upstream. | |
9 | ||
10 | If the tool spends some time in prox before entering range, a series of | |
11 | events (e.g. ABS_DISTANCE, MSC_SERIAL) can be sent before we or userspace | |
12 | have any clue about the pen whose data is being reported. We need to hold | |
13 | off on reporting anything until the pen has entered range. Since we still | |
14 | want to report events that occur "in prox" after the pen has *left* range | |
15 | we use 'wacom-tool[0]' as the indicator that the pen did at one point | |
16 | enter range and provide us/userspace with tool type and serial number | |
17 | information. | |
18 | ||
19 | Fixes: a48324de6d4d ("HID: wacom: Bluetooth IRQ for Intuos Pro should handle prox/range") | |
20 | Cc: <stable@vger.kernel.org> # 4.11+ | |
21 | Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> | |
22 | Reviewed-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com> | |
23 | Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> | |
24 | Signed-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 |