]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Input: wacom - send proper tablet state info when pen leaves proximity
authorJason Gerecke <killertofu@gmail.com>
Fri, 20 Sep 2013 16:48:46 +0000 (09:48 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 20 Sep 2013 16:58:54 +0000 (09:58 -0700)
The EMR sensor of Intuos4 and newer devices can send a packet with
0x20 in its second byte which contains only location information.
This packet is sent when the pen is too far away to reliably obtain
other information. Because only the location is updated userspace
will continue to see stale information for other values, most notably
TOUCH, PRESSURE, and DISTANCE.

This patch ensures userspace is not left with stale device state
information when the pen re-enters proximity (possibly leading to
the assumption the pen is still in contact even though it is
actually hovering).

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/tablet/wacom_wac.c

index 45984afb040dd8511e98086a60e65b50ad6fb93e..102480621079dc1e590e80c200ca059f25e6b554 100644 (file)
@@ -427,6 +427,13 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
                        (features->type == WACOM_21UX2))
                return 1;
 
+       /* Range Report */
+       if ((data[1] & 0xfe) == 0x20) {
+               input_report_key(input, BTN_TOUCH, 0);
+               input_report_abs(input, ABS_PRESSURE, 0);
+               input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max);
+       }
+
        /* Exit report */
        if ((data[1] & 0xfe) == 0x80) {
                if (features->quirks == WACOM_QUIRK_MULTI_INPUT)