From: Ping Cheng <pingli...@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 <ping.ch...@wacom.com>
[aaron.sko...@wacom.com: Imported into input-wacom repository (ed1fa736839e)]
Signed-off-by: Aaron Armstrong Skomra <aaron.sko...@wacom.com>
[aaron.sko...@wacom.com: Backported to input-wacom repository (e085d82)]
Signed-off-by: Aaron Armstrong Skomra <aaron.sko...@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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to