Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1b03f55 authored by Ping Cheng's avatar Ping Cheng Committed by Jiri Kosina
Browse files

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: default avatarPing Cheng <pingc@wacom.com>
Reviewed-by: default avatarJason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 4750f5fe
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -674,20 +674,23 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
			wacom->tool[idx] = BTN_TOOL_PEN;
			break;
		}
		wacom->shared->stylus_in_proximity = true;
		return 1;
	}

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

		/* in Range while exiting */
	if (((data[1] & 0xfe) == 0x20) && wacom->reporting_data) {
		if (wacom->reporting_data) {
			input_report_key(input, BTN_TOUCH, 0);
			input_report_abs(input, ABS_PRESSURE, 0);
			input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max);
			return 2;
		}
		return 1;
	}

	/* Exit report */
	if ((data[1] & 0xfe) == 0x80) {
@@ -871,6 +874,9 @@ static int wacom_intuos_general(struct wacom_wac *wacom)
		data[0] != WACOM_REPORT_INTUOS_PEN)
		return 0;

	if (wacom->shared->touch_down)
		return 1;

	/* don't report events if we don't know the tool ID */
	if (!wacom->id[idx]) {
		/* but reschedule a read of the current tool */