From patchwork Tue Apr 4 00:57:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ping Cheng X-Patchwork-Id: 9660745 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 3045060352 for ; Tue, 4 Apr 2017 00:57:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 212CC2815E for ; Tue, 4 Apr 2017 00:57:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 155B7283FD; Tue, 4 Apr 2017 00:57:57 +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 8EFBE2841E for ; Tue, 4 Apr 2017 00:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751845AbdDDA5z (ORCPT ); Mon, 3 Apr 2017 20:57:55 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:34940 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751668AbdDDA5y (ORCPT ); Mon, 3 Apr 2017 20:57:54 -0400 Received: by mail-qt0-f194.google.com with SMTP id r5so21464305qtb.2 for ; Mon, 03 Apr 2017 17:57:54 -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=MZcH4ae53YIqegrOPY/5JUawK0+Jsy/adq2r3KIN70w=; b=fHCbqIjFXJyl/rSym81E8JkWixCAoO4V+HrWbhnhEExnPubMqSR9LtYI4U4jDL6FkY E1CqR00VOScsfUzyz2GVwFD7S26TeTn1UH/lRKVbbho+854JMw5TLw81xJQIc+498jP3 liRCc9c29GPQ5EhuKRcM763tzfR8GrMuNtc394i/IwEii47FcCq/6zYi9sy/JJoOCwgM 6JjJamZjvvUvwz0nvUxDPtmoX3YLW4XmDrRqS+3Gb2CzEg5Lw23D9/8bL9pNNWDjU1wv JUL64Of/K6T4d1v1yp3LnNTu7kG9mJEeZXT9L0kall/Lh467H7UgNXK5X6dhySE9oQxt Ak9Q== 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=MZcH4ae53YIqegrOPY/5JUawK0+Jsy/adq2r3KIN70w=; b=XWQxOCEzWUUc1LDDve8Hbpt3QFqVFGXBuZAehflq20MBQv54Q6Vr2QIw48B3NxHSaD DXOdRcjCTNhju8CsgIiCaJJ2XDvxEN06QeA9Z3ygRJMJUM2YC7QU/AUAoqw4hh9elNvw BC3zyhvw4X/PUiKtu5H45kqeNG/LQSDcgbF7IA/Vu2g13R5F8XsVHKiU9PE105CxNZWU bCj+nMmxNdCvsgkjTqTtq+RZIvUSC/vXK8HFSEBeqyQTESEyOa36OOGaAzNGQfwnfgIX gIUdOH/aVarOdlJYZllNq/R4yALc+Og9jkm5+cUGm6fcpishmFzVC49ULMXW/Ry5F3B4 fo+w== X-Gm-Message-State: AFeK/H11QWjaU0Tm41eC1UhEM8ngVZR52YJ1kJHprpo/X80GfmJUKHbvp3QSle58WPih+Q== X-Received: by 10.200.38.72 with SMTP id v8mr21758966qtv.27.1491267473741; Mon, 03 Apr 2017 17:57:53 -0700 (PDT) Received: from wacom-XPS-8500.corp.onewacom.com ([50.225.60.4]) by smtp.gmail.com with ESMTPSA id 137sm10759811qkd.19.2017.04.03.17.57.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Apr 2017 17:57:53 -0700 (PDT) From: Ping Cheng X-Google-Original-From: Ping Cheng To: linux-input@vger.kernel.org Cc: jkosina@suse.cz, benjamin.tissoires@gmail.com, skomra@gmail.com, killertofu@gmail.com, Ping Cheng Subject: [PATCH] HID: wacom: generic: sync pad events only for actual packets Date: Mon, 3 Apr 2017 17:57:41 -0700 Message-Id: <1491267461-25416-1-git-send-email-ping.cheng@wacom.com> X-Mailer: git-send-email 2.7.4 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 --- Jiri: this patch is based on your for-4.12/wacom branch --- drivers/hid/wacom_wac.c | 6 +++++- drivers/hid/wacom_wac.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index f136038..ffef32a 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1881,6 +1881,7 @@ 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) features->pad_input_event_flag = true; break; } } @@ -1919,11 +1920,14 @@ static void wacom_wac_pad_report(struct hid_device *hdev, struct wacom_wac *wacom_wac = &wacom->wacom_wac; struct input_dev *input = wacom_wac->pad_input; bool active = wacom_wac->hid_data.inrange_state != 0; + struct wacom_features *features = &wacom_wac->features; /* 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) && + features->pad_input_event_flag) { input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); input_sync(input); + if (!active) features->pad_input_event_flag = false; } } diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index 839bd4b..ff09609 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -263,6 +263,7 @@ struct wacom_features { int pktlen; bool check_for_hid_type; int hid_type; + bool pad_input_event_flag; }; struct wacom_shared {