* [PATCH v2] HID: wacom: generic: sync pad events only for actual packets
@ 2017-04-04 19:31 Ping Cheng
2017-04-05 9:01 ` Benjamin Tissoires
2017-04-06 18:34 ` Jiri Kosina
0 siblings, 2 replies; 3+ messages in thread
From: Ping Cheng @ 2017-04-04 19:31 UTC (permalink / raw)
To: linux-input; +Cc: jikos, benjamin.tissoires, Ping Cheng
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>
---
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 {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] HID: wacom: generic: sync pad events only for actual packets
2017-04-04 19:31 [PATCH v2] HID: wacom: generic: sync pad events only for actual packets Ping Cheng
@ 2017-04-05 9:01 ` Benjamin Tissoires
2017-04-06 18:34 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2017-04-05 9:01 UTC (permalink / raw)
To: Ping Cheng; +Cc: linux-input, Jiri Kosina, Ping Cheng
On Tue, Apr 4, 2017 at 9:31 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> 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>
> ---
> v2: updated as Benjamin suggested
>
> The patch is based on for-4.12/wacom
Looks good to me:
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cheers,
Benjamin
> ---
> 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 {
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] HID: wacom: generic: sync pad events only for actual packets
2017-04-04 19:31 [PATCH v2] HID: wacom: generic: sync pad events only for actual packets Ping Cheng
2017-04-05 9:01 ` Benjamin Tissoires
@ 2017-04-06 18:34 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2017-04-06 18:34 UTC (permalink / raw)
To: Ping Cheng; +Cc: linux-input, benjamin.tissoires, Ping Cheng
On Tue, 4 Apr 2017, Ping Cheng wrote:
> 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>
Applied to for-4.12/wacom.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-06 18:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 19:31 [PATCH v2] HID: wacom: generic: sync pad events only for actual packets Ping Cheng
2017-04-05 9:01 ` Benjamin Tissoires
2017-04-06 18:34 ` Jiri Kosina
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.