Skip to content

Commit c1b03f5

Browse files
PinglinuxJiri Kosina
authored andcommitted
HID: wacom - Cleanup touch arbitration logic
stylus_in_proximity was introduced to support touch arbitration before in range was supported. With in range event, the logic changed. stylus_in_proximity should be set for both in prox and in range events. To finish a clean touch arbitration logic, we should send touch up (if it was down) before posting any general pen events. Signed-off-by: Ping Cheng <[email protected]> Reviewed-by: Jason Gerecke <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 4750f5f commit c1b03f5

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

drivers/hid/wacom_wac.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -674,19 +674,22 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
674674
wacom->tool[idx] = BTN_TOOL_PEN;
675675
break;
676676
}
677+
wacom->shared->stylus_in_proximity = true;
677678
return 1;
678679
}
679680

680-
wacom->shared->stylus_in_proximity = true;
681-
if (wacom->shared->touch_down)
682-
return 1;
681+
/* in Range */
682+
if ((data[1] & 0xfe) == 0x20) {
683+
wacom->shared->stylus_in_proximity = true;
683684

684-
/* in Range while exiting */
685-
if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
686-
input_report_key(input, BTN_TOUCH, 0);
687-
input_report_abs(input, ABS_PRESSURE, 0);
688-
input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max);
689-
return 2;
685+
/* in Range while exiting */
686+
if (wacom->reporting_data) {
687+
input_report_key(input, BTN_TOUCH, 0);
688+
input_report_abs(input, ABS_PRESSURE, 0);
689+
input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max);
690+
return 2;
691+
}
692+
return 1;
690693
}
691694

692695
/* Exit report */
@@ -871,6 +874,9 @@ static int wacom_intuos_general(struct wacom_wac *wacom)
871874
data[0] != WACOM_REPORT_INTUOS_PEN)
872875
return 0;
873876

877+
if (wacom->shared->touch_down)
878+
return 1;
879+
874880
/* don't report events if we don't know the tool ID */
875881
if (!wacom->id[idx]) {
876882
/* but reschedule a read of the current tool */

0 commit comments

Comments
 (0)