linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gerecke <killertofu@gmail.com>
To: linuxwacom-devel@lists.sourceforge.net,
	linux-input@vger.kernel.org, pinglinux@gmail.com
Cc: Jason Gerecke <killertofu@gmail.com>
Subject: [PATCH 3/3] Input: wacom - Send proper tablet state info when pen leaves proximity
Date: Thu, 22 Aug 2013 18:15:37 -0700	[thread overview]
Message-ID: <1377220537-1474-3-git-send-email-killertofu@gmail.com> (raw)
In-Reply-To: <1377220537-1474-1-git-send-email-killertofu@gmail.com>

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>
---
 drivers/input/tablet/wacom_wac.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 869e9c9..f67a75a 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -425,6 +425,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)
-- 
1.8.3.4


  parent reply	other threads:[~2013-08-23  1:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23  1:15 [PATCH 1/3] Input: wacom - Support EMR and MFT sensors of Cintiq Companion Hybrid Jason Gerecke
2013-08-23  1:15 ` [PATCH 2/3] Input: wacom - Provide a range for the ABS_MISC axis Jason Gerecke
2013-08-24 23:50   ` Dmitry Torokhov
2013-08-25 17:43     ` Jason Gerecke
2013-08-23  1:15 ` Jason Gerecke [this message]
2013-08-24 23:56 ` [PATCH 1/3] Input: wacom - Support EMR and MFT sensors of Cintiq Companion Hybrid Dmitry Torokhov
2013-08-26 17:13 ` [PATCH 1/3 v2] " Jason Gerecke
2013-08-29  1:10   ` Peter Hutterer
2013-09-03 21:52 ` [PATCH 1/3 v3] " Jason Gerecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377220537-1474-3-git-send-email-killertofu@gmail.com \
    --to=killertofu@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linuxwacom-devel@lists.sourceforge.net \
    --cc=pinglinux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).