From patchwork Sat Jan 9 01:16:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 7991561 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C62D69F6FA for ; Sat, 9 Jan 2016 01:16:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F065C201C8 for ; Sat, 9 Jan 2016 01:16:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26728201C7 for ; Sat, 9 Jan 2016 01:16:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754369AbcAIBQO (ORCPT ); Fri, 8 Jan 2016 20:16:14 -0500 Received: from mail-pa0-f65.google.com ([209.85.220.65]:35796 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753852AbcAIBQO (ORCPT ); Fri, 8 Jan 2016 20:16:14 -0500 Received: by mail-pa0-f65.google.com with SMTP id gi1so29468830pac.2 for ; Fri, 08 Jan 2016 17:16:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=ppNXDa9AC11ex3F2EZVSLVBlWZDYGSMzRAKtMCviQPA=; b=abW+mtNievwitNRWd2gLloyuXKx0oH8utlRD7U/3SYapnZb9fYNkizB1AUfO0eQ51X V7IhDQJULZpnrpHm7daBtDbzr8jeYMvP2/6qZlGeLxNZ9HT32/BQq3hkbB1tsdEODvJq yWzd/mElXgwWNSqGA6qreH6v2J28cj7f9TIMEx0HfOKgAiR7Px1IDsK/1o/t5kKskaUG SGgdcYAYtqlNZYjMZt1qnewB3M77CZ7vWIs8KWaTdRYtQIHor/OUs5VkhUS6zPUyYUvs 3mxkkQe0SMs2NYWeaWg0W1G9fJ5fnd2nH//2c0zfTmewkHEzY2oBJT967Q2BLQSKb22F rLIQ== X-Received: by 10.66.100.198 with SMTP id fa6mr122457583pab.123.1452302173360; Fri, 08 Jan 2016 17:16:13 -0800 (PST) Received: from wacom-XPS-8500.corp.onewacom.com ([67.51.163.2]) by smtp.gmail.com with ESMTPSA id x18sm7350248pfa.65.2016.01.08.17.16.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jan 2016 17:16:12 -0800 (PST) From: Ping Cheng X-Google-Original-From: Ping Cheng To: linux-input@vger.kernel.org Cc: jkosina@suse.cz, killertofu@gmail.com, Ping Cheng Subject: [PATCH 3/4] HID: wacom - Cleanup touch arbitration logic Date: Fri, 8 Jan 2016 17:16:06 -0800 Message-Id: <1452302166-5601-1-git-send-email-pingc@wacom.com> X-Mailer: git-send-email 1.9.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 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 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: Ping Cheng Reviewed-by: Jason Gerecke --- drivers/hid/wacom_wac.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 8507028..af9ecf4 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -670,19 +670,22 @@ static int wacom_intuos_inout(struct wacom_wac *wacom) wacom->tool[idx] = BTN_TOOL_PEN; break; } + wacom->shared->stylus_in_proximity = true; return 1; } - wacom->shared->stylus_in_proximity = true; - if (wacom->shared->touch_down) - return 1; + /* in Range */ + if ((data[1] & 0xfe) == 0x20) { + wacom->shared->stylus_in_proximity = true; - /* in Range while exiting */ - if (((data[1] & 0xfe) == 0x20) && 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; + /* in Range while exiting */ + 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 */ @@ -867,6 +870,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 */