From patchwork Fri Sep 8 00:52:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 9943031 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 6485E600CB for ; Fri, 8 Sep 2017 00:52:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50AD121E5A for ; Fri, 8 Sep 2017 00:52:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45A3E228C9; Fri, 8 Sep 2017 00:52:29 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 C1E9321E5A for ; Fri, 8 Sep 2017 00:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753291AbdIHAw1 (ORCPT ); Thu, 7 Sep 2017 20:52:27 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33130 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751981AbdIHAw1 (ORCPT ); Thu, 7 Sep 2017 20:52:27 -0400 Received: by mail-pf0-f195.google.com with SMTP id h4so641098pfk.0 for ; Thu, 07 Sep 2017 17:52:27 -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=nz28WljJUfYlhQ/cks0oQdV/QS9XZcMfLmYXHWxAOic=; b=SFNIRmJi3TWXawxzNW6l3YjV0kc7FwRFWfvl4AEujHmZCvdNQdxw1o9/rYyrW0VfAm Nz7vx/fhz5lTQnEY6nNBtORSrjDeMPgw5qTd0o2MTZXlxQX46jHvvPqQsX88TdZuPSKv v+D/dgqWMZrIBsAurG32pJ298Tm6JLytYi334OkLZq36WrH4cVYHNjqDHdv7ZgJKzjkg I1cVZVvUIZ0ZSA6qMuweTJNGFfDBs2/1O8NzMdWRdGvdID5kPuUPgph1s/ES7T7+ZU89 LKGyEpEWP3/jwepNE4nBruXE4hr5HI6NBHfEUVJm8Q1lu5QBAVUx4awGYMGZf1nyPoDM qPsQ== 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=nz28WljJUfYlhQ/cks0oQdV/QS9XZcMfLmYXHWxAOic=; b=E4rr5ltS1Mr5X6bMMz5r751aT6M3eC62sSe4bP3bhW8cGnBoqFNxS2a1kdamXMCGDQ h05qblMxnJEEgqfuh+FqC/zKYnyqt06g6LBEgcDUY4PzGdN0eGECBW/BI+FVVK5YiUmj LLE45mwl/EmDb2FKJcklkHsuYEN2NgcNThJI7k7ky9URrQ1O0JSADOtuiHFPgbogA40V kTRylw2LwJOyAp5m0FPFA83WIjSSl/uU1oFXFkDFcAxHhEsJSY4CetINPYC6VntzW5XY roaL0E41XnVlT9Anug3wTygCk+q/F3oo+xrrDTshLPcnV0Sf2bmrr5JJZBFeTKhJjY5Z Lm7Q== X-Gm-Message-State: AHPjjUhy5P75iJirG/ZYCOzsIQmUNAj93oV6V1MYyZFyidE0YfenplJ6 HcxzvSaehh/PCA== X-Google-Smtp-Source: ADKCNb4S7OaPtHezrEVV++TLgw3m3sn3OlhzEm5ouAmJkbX1FFP321daqM8GRCiytt6X4Z4X3cswRQ== X-Received: by 10.84.191.131 with SMTP id a3mr1360608pld.255.1504831946894; Thu, 07 Sep 2017 17:52:26 -0700 (PDT) Received: from localhost.localdomain (mobile-166-176-185-67.mycingular.net. [166.176.185.67]) by smtp.gmail.com with ESMTPSA id u186sm752906pgb.35.2017.09.07.17.52.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 17:52:26 -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 6/6] HID: wacom: generic: Reset events back to zero when pen leaves Date: Thu, 7 Sep 2017 17:52:15 -0700 Message-Id: <20170908005215.3168-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 As a pen leaves, we need to be sure to reset all events back to zero so that userspace is able to get the complete pen state when it enters proximity again. Signed-off-by: Jason Gerecke Reviewed-by: Ping Cheng --- drivers/hid/wacom_wac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 929a1ce..2926e36 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2218,10 +2218,10 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field return; /* 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); + if (wacom_wac->hid_data.inrange_state) + input_event(input, usage->type, usage->code, value); + else if (wacom_wac->shared->stylus_in_proximity && !wacom_wac->hid_data.sense_state) + input_event(input, usage->type, usage->code, 0); } static void wacom_wac_pen_pre_report(struct hid_device *hdev,