HID: wacom: Queue events with missing type/serial data for later processing
authorJason Gerecke <killertofu@gmail.com>
Fri, 10 Nov 2017 19:50:01 +0000 (11:50 -0800)
committerJiri Kosina <jkosina@suse.cz>
Tue, 21 Nov 2017 12:04:35 +0000 (13:04 +0100)
commit83417206427bdf0fef9fa69957807194f25923c3
treee7d1350d7acd2ddcbb116c203a5b5ad8552f033b
parent99acedadde157a02b21761fd406ef7adc7615533
HID: wacom: Queue events with missing type/serial data for later processing

Userspace expects to receive tool type and serial number information
for the active pen in the very first kernel report, if such data is
supported by the hardware. While this expectation is not an issue for
EMR devices, AES sensors will often send several packets worth of in-
range data before relaying type/serial data to the kernel. Sending this
data "late" can result in proximity-tracking issues by xf86-input-wacom,
or an inability to distinguish different pens by input-wacom.

Options for dealing with this situation include ignoring reports from
the tablet until we get the necessary data, or using the information
from the last-seen pen instead of the (eventual) real data. Neither
option is particularly attractive: the former results in truncated
strokes and the latter causes issues with switching between pens.

This commit instead opts to queue up events with missing information
until we receive a report which contains it. At that point, we can
update the driver's state variables (id[0] and serial[0]) and replay
the queued events.

Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/wacom_sys.c
drivers/hid/wacom_wac.c
drivers/hid/wacom_wac.h