From patchwork Fri Sep 8 00:49:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 9943027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 383F7600CB for ; Fri, 8 Sep 2017 00:50:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 221CB27F8C for ; Fri, 8 Sep 2017 00:50:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 124B327F8F; Fri, 8 Sep 2017 00:50:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 609B927F8C for ; Fri, 8 Sep 2017 00:50:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752948AbdIHAuE (ORCPT ); Thu, 7 Sep 2017 20:50:04 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34562 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752766AbdIHAuE (ORCPT ); Thu, 7 Sep 2017 20:50:04 -0400 Received: by mail-pf0-f194.google.com with SMTP id g65so402141pfe.1 for ; Thu, 07 Sep 2017 17:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=M7yMIutr8CoD7q8nG5+jMCr4MfQPakAEp+qY/PuuLc4=; b=Lika1eWKafxK3f3g16X85aCejqbpdxOXph6+jlAemspY1Ugc8dVsGs4GhcX+2R493i pDeUrRqa+kSYfXoq91OLTmIe4Xc+B0bRYh9MteLhUkNJUiMj5ypDnI/TZra2l91VTgvL cnqqclFn0X4R/93QvNDrpM/znZc7NeHGSEPvIGy7snTn277nXUNNg67q1T+8iWXVXauu tMrSt6ZBJL6KgAloWQiUZ5IK42pM8orVlxWa3Nh9BwMO1ICBm9HsNwqkOHrs7nZMCr2K y6pVz3B36DvxuTa0sedUAWRahrcCnvZ4Qufj538ixveFqRUHYEqcvDxvd79jqoEjUZHZ oj3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=M7yMIutr8CoD7q8nG5+jMCr4MfQPakAEp+qY/PuuLc4=; b=FVhbhV0hAftV6kUL4yffmRQ84jWEfVE7U/OQejJru5FAyCX5RX7pKtPBUcZdK/Q0Bq CxC6sccvMAk1YZbo2WtwVSbZZ+BObOvciC5T4jESI7x0fDEUJyRFZObsyXWAsMNo7QrI IkUSSEkEZv3HTKHT4LX14JRtpUMcFT1PYTrPTW+cQ1wlP3RFzGMa1ezOuob7COy9zi6x RG1zniXN6QBlV1HVYIPr8Exs2r7odnYz7siwCRH/6a2iYurHv7xXIajFfiKi8p0Ci8nW q9eZa0gLJRNjk63Z0ND5GEBOrErAm7I2u0MCT3vfM6JRe87A4+vbTE1ILNZqc6E5Goru 2AOA== X-Gm-Message-State: AHPjjUjQszRsbl6DA17LL8eYtLBSoUFJEiwcL1Qf7PMxBmx0Funjyp3g HddHlvvftgGlkA== X-Google-Smtp-Source: ADKCNb7G2HZmatRZ6t4z9kS8XYEsWtcr8yvpVO+juer5neaR9jvW1cKxEiOv5B8GlTADQl295JDspw== X-Received: by 10.99.63.194 with SMTP id m185mr1293008pga.364.1504831803770; Thu, 07 Sep 2017 17:50:03 -0700 (PDT) Received: from localhost.localdomain (mobile-166-176-185-67.mycingular.net. [166.176.185.67]) by smtp.gmail.com with ESMTPSA id p12sm783910pgd.0.2017.09.07.17.50.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 17:50:03 -0700 (PDT) From: Ping Cheng X-Google-Original-From: Ping Cheng To: jikos@kernel.org Cc: linux-input@vger.kernel.org, Jason Gerecke , Jason Gerecke Subject: [PATCH 4/6] HID: wacom: generic: Leave tool in prox until it completely leaves sense Date: Thu, 7 Sep 2017 17:49:50 -0700 Message-Id: <20170908004950.3034-1-ping.cheng@wacom.com> X-Mailer: git-send-email 2.9.5 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gerecke The legacy Intuos codepath and tablet behavior (e.g. the 1st-gen Intuos Pro, Cintiq 27, etc.) would result in a BTN_TOOL_* event not being cleared to zero until the tool had completely left the sensing range of the tablet. Before the final "out of prox" packet would be sent, zero or more "in range" packets could be sent to indicate that a pen was still detectable but not within a useful distance. These "in range" packets were used by the driver to keep touch input disabled at greater pen distances. In addition to keeping the `stylus_in_proximity` flag set, the driver would leave the current BTN_TOOL_* marked as being in proximity as well. The new HID codepath also sets `stylus_in_proximity` based on the "sense" flag, but does not leave the current BTN_TOOL_* marked as being in prox. This information is potentially useful to for a future userspace-based palm rejection, so this patch modifies the driver to continue sending it. Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng --- drivers/hid/wacom_wac.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index cdf95e1..9b3a247 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2217,8 +2217,8 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field if (!usage->type || delay_pen_events(wacom_wac)) return; - /* send pen events only when the pen is in/entering/leaving range */ - if (!wacom_wac->hid_data.inrange_state && !wacom_wac->tool[0]) + /* send pen events only when the pen is in range */ + if (!wacom_wac->hid_data.inrange_state) return; input_event(input, usage->type, usage->code, value); @@ -2269,10 +2269,10 @@ static void wacom_wac_pen_report(struct hid_device *hdev, */ input_report_key(input, BTN_TOUCH, wacom_wac->hid_data.tipswitch); - input_report_key(input, wacom_wac->tool[0], range); + input_report_key(input, wacom_wac->tool[0], sense); if (wacom_wac->serial[0]) { input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); - input_report_abs(input, ABS_MISC, range ? id : 0); + input_report_abs(input, ABS_MISC, sense ? id : 0); } wacom_wac->hid_data.tipswitch = false; @@ -2280,7 +2280,7 @@ static void wacom_wac_pen_report(struct hid_device *hdev, input_sync(input); } - if (!range) { + if (!sense) { wacom_wac->tool[0] = 0; wacom_wac->id[0] = 0; wacom_wac->serial[0] = 0;