Discussion:
[Linuxwacom-devel] [PATCH] backport: HID: wacom: generic: sync pad events only for actual packets
Aaron Armstrong Skomra
2017-04-06 23:21:35 UTC
Permalink
From: Ping Cheng <***@gmail.com>

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 <***@wacom.com>
[***@wacom.com: Imported into input-wacom repository (ed1fa736839e)]
Signed-off-by: Aaron Armstrong Skomra <***@wacom.com>
[***@wacom.com: Backported to input-wacom repository (e085d82)]
Signed-off-by: Aaron Armstrong Skomra <***@wacom.com>
---
3.17/wacom_wac.c | 7 ++++++-
3.17/wacom_wac.h | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index ddea3b2..422b3cd 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -1890,6 +1890,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;
}
}
@@ -1930,9 +1932,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/3.17/wacom_wac.h b/3.17/wacom_wac.h
index 19117b9..e7dcb0b 100644
--- a/3.17/wacom_wac.h
+++ b/3.17/wacom_wac.h
@@ -317,6 +317,7 @@ struct hid_data {
int bat_charging;
int bat_connected;
int ps_connected;
+ bool pad_input_event_flag;
};

struct wacom_remote_data {
--
2.7.4
Aaron Armstrong Skomra
2017-04-06 23:21:36 UTC
Permalink
From: Ping Cheng <***@gmail.com>

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 <***@wacom.com>
[***@wacom.com: Imported into input-wacom repository (ed1fa736839e)]
Signed-off-by: Aaron Armstrong Skomra <***@wacom.com>
---
4.5/wacom_wac.c | 7 ++++++-
4.5/wacom_wac.h | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/4.5/wacom_wac.c b/4.5/wacom_wac.c
index c7199c5..611d0d5 100644
--- a/4.5/wacom_wac.c
+++ b/4.5/wacom_wac.c
@@ -1890,6 +1890,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;
}
}
@@ -1930,9 +1932,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/4.5/wacom_wac.h b/4.5/wacom_wac.h
index b2092fc..176e1e0 100644
--- a/4.5/wacom_wac.h
+++ b/4.5/wacom_wac.h
@@ -317,6 +317,7 @@ struct hid_data {
int bat_charging;
int bat_connected;
int ps_connected;
+ bool pad_input_event_flag;
};

struct wacom_remote_data {
--
2.7.4
Loading...