From patchwork Fri Aug 23 01:15:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 2848486 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D7CFABF546 for ; Fri, 23 Aug 2013 01:16:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 183242026F for ; Fri, 23 Aug 2013 01:16:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F895201EE for ; Fri, 23 Aug 2013 01:16:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753491Ab3HWBQa (ORCPT ); Thu, 22 Aug 2013 21:16:30 -0400 Received: from mail-pb0-f43.google.com ([209.85.160.43]:44760 "EHLO mail-pb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753301Ab3HWBQ3 (ORCPT ); Thu, 22 Aug 2013 21:16:29 -0400 Received: by mail-pb0-f43.google.com with SMTP id md4so18263pbc.2 for ; Thu, 22 Aug 2013 18:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B1W5rtwQq7kHSVT2pY+vjc0tqMqlMNEbtZGOAMjDwJA=; b=wvdahSR20CjdZbBGgIIO9zubfu+MyUSQtHS/UhalzkF3Sm+5CW5qzqvMOoVr+xbtJ4 CyN7YyqurFJnQ82N0WrA2GEyp6ztFIkTOw2HHktpwkxm72d0YmEmj/TVrDExtLCZLbfh Wz36J/xW1I4OicSwpub8pNhbHk2ZlcXOx1l27UL8xP47qkZwMkroyIvoiH/VoWPmLF2m Ho2AAOJgVMNUGbsZYYBXa8la5hzQFzNrT4DomyVExs+OEnfyTJHvO9xjUWwuavRvIsG0 4IVslcHYxDMugKqDL6bGLNm+R9KY6R9HXbctOT2moyyFzS8ZNi7rCYN+f1rIqn3k5Gks iidw== X-Received: by 10.68.139.201 with SMTP id ra9mr16234342pbb.46.1377220589484; Thu, 22 Aug 2013 18:16:29 -0700 (PDT) Received: from wacom-arch.wacom.com ([67.51.163.2]) by mx.google.com with ESMTPSA id om2sm17755690pbc.30.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Aug 2013 18:16:28 -0700 (PDT) From: Jason Gerecke To: linuxwacom-devel@lists.sourceforge.net, linux-input@vger.kernel.org, pinglinux@gmail.com Cc: Jason Gerecke Subject: [PATCH 3/3] Input: wacom - Send proper tablet state info when pen leaves proximity Date: Thu, 22 Aug 2013 18:15:37 -0700 Message-Id: <1377220537-1474-3-git-send-email-killertofu@gmail.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1377220537-1474-1-git-send-email-killertofu@gmail.com> References: <1377220537-1474-1-git-send-email-killertofu@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)