From: Ping Cheng <pinglinux@gmail.com>
To: linux-input@vger.kernel.org
Cc: jkosina@suse.cz, benjamin.tissoires@gmail.com, skomra@gmail.com,
killertofu@gmail.com, Ping Cheng <ping.cheng@wacom.com>
Subject: [PATCH] HID: wacom: generic: sync pad events only for actual packets
Date: Mon, 3 Apr 2017 17:57:41 -0700 [thread overview]
Message-ID: <1491267461-25416-1-git-send-email-ping.cheng@wacom.com> (raw)
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 <ping.cheng@wacom.com>
---
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 {
--
2.7.4
next reply other threads:[~2017-04-04 0:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 0:57 Ping Cheng [this message]
2017-04-04 8:15 ` [PATCH] HID: wacom: generic: sync pad events only for actual packets Benjamin Tissoires
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491267461-25416-1-git-send-email-ping.cheng@wacom.com \
--to=pinglinux@gmail.com \
--cc=benjamin.tissoires@gmail.com \
--cc=jkosina@suse.cz \
--cc=killertofu@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=ping.cheng@wacom.com \
--cc=skomra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.