From patchwork Tue Apr 4 19:31:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 9662495 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 A7E90602B9 for ; Tue, 4 Apr 2017 19:31:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97DBB2854E for ; Tue, 4 Apr 2017 19:31:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AC6A28556; Tue, 4 Apr 2017 19:31:22 +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 EDA9D2854E for ; Tue, 4 Apr 2017 19:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752968AbdDDTbV (ORCPT ); Tue, 4 Apr 2017 15:31:21 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33277 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752477AbdDDTbU (ORCPT ); Tue, 4 Apr 2017 15:31:20 -0400 Received: by mail-pg0-f65.google.com with SMTP id 79so39303644pgf.0 for ; Tue, 04 Apr 2017 12:31:20 -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=CDP9RJam4pRw7qg/d9ipB2vYGHHoRzmk0qb9vVRRLyE=; b=ijN9Rls4/x1LIgVwU23BUL4Ic18HDX5tUveTlchF+/pT3NfuyYernCVh8+3C4AGlOU s+rfnWUNsxq35CTsYex5pl2aWY5/xB8+ixF2rT/TV+iznIKHz7uQVf6vNlc6DwrVctYF TLUC3YZKjzG6Z7MrG8RF9E8zG9KkZ7GHaZUUcf7T/uqr7MaaoeMnOcE8GovTkAfhf77V 6HeHAq+FdCz+YJ9DHlkHcXK4vz0/YH1zr4NSU0wImj9/Q0ZgEoTN+KMsVKH39DjPILmv xO5NcoUUmBOw2f3X65HZ20AujkdgFVrmld4MpUUivUgFVgPOzI/2dUdHBCtY02vA7KVg 8eDA== 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=CDP9RJam4pRw7qg/d9ipB2vYGHHoRzmk0qb9vVRRLyE=; b=Dr3SsMHCM6s6H/AAHDxoKnTt6nH/yV3nBTh26zlFV5oTpXGWUVItQMBs9VoRj8JwVJ XT4hED3d38rOMUwXyWeLIZ9FQQ7C48plF59ZyXsehYzQcXDbIBW8qz9QqEyypS03agDB z0QHtwf9n32UEs/I7zKoun1aGKacXfiYuTg4/7eV1POO4VPnpmIQYp4s6Tj8LOyZkphd /DicVpQQhkBlS+qdddRbHAN36FU2gnfGKTWpUQb6xPjUcNHYXSY/P5E+aqgM/XTE94RC vfuLRQ2qVy3/itfRAl284WRp+kt83TUiu4zErMO6TbMcKhwC0ECeIR7BrQuYwKwZ4dXq efqQ== X-Gm-Message-State: AFeK/H1f/4h1GeVGD34/+M8tj/b/D9cZz8H4GjJ412xc1ero9xXvrZz9oWUq1lHrtow3aw== X-Received: by 10.84.229.79 with SMTP id d15mr31386099pln.49.1491334279870; Tue, 04 Apr 2017 12:31:19 -0700 (PDT) Received: from localhost.net (c-24-21-228-48.hsd1.wa.comcast.net. [24.21.228.48]) by smtp.gmail.com with ESMTPSA id h74sm33246730pfe.92.2017.04.04.12.31.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 12:31:19 -0700 (PDT) From: Ping Cheng X-Google-Original-From: Ping Cheng To: linux-input@vger.kernel.org Cc: jikos@kernel.org, benjamin.tissoires@gmail.com, Ping Cheng Subject: [PATCH v2] HID: wacom: generic: sync pad events only for actual packets Date: Tue, 4 Apr 2017 12:31:07 -0700 Message-Id: <1491334267-6442-1-git-send-email-ping.cheng@wacom.com> X-Mailer: git-send-email 1.8.3.1 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 Commits d793ff8 and 4082da8 introduced two pad usages which do not actually send pad input events. To make sure we do not post empty pad packets, pad_input_event_flag is introduced. Turn on the flag for real pad input events so we can synchronize them properly. Signed-off-by: Ping Cheng Reviewed-by: Benjamin Tissoires --- v2: updated as Benjamin suggested The patch is based on for-4.12/wacom --- drivers/hid/wacom_wac.c | 7 ++++++- drivers/hid/wacom_wac.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index f136038..037a996 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1881,6 +1881,8 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field /* fall through*/ default: input_event(input, usage->type, usage->code, value); + if (value) + wacom_wac->hid_data.pad_input_event_flag = true; break; } } @@ -1921,9 +1923,12 @@ static void wacom_wac_pad_report(struct hid_device *hdev, bool active = wacom_wac->hid_data.inrange_state != 0; /* report prox for expresskey events */ - if (wacom_equivalent_usage(report->field[0]->physical) == HID_DG_TABLETFUNCTIONKEY) { + if ((wacom_equivalent_usage(report->field[0]->physical) == HID_DG_TABLETFUNCTIONKEY) && + wacom_wac->hid_data.pad_input_event_flag) { input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); input_sync(input); + if (!active) + wacom_wac->hid_data.pad_input_event_flag = false; } } diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index 839bd4b..570d295 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -301,6 +301,7 @@ struct hid_data { int bat_charging; int bat_connected; int ps_connected; + bool pad_input_event_flag; }; struct wacom_remote_data {