Commit d4b8efeb authored by Aaron Armstrong Skomra's avatar Aaron Armstrong Skomra Committed by Jiri Kosina

HID: wacom: generic: Correct pad syncing

Only sync the pad once per report, not once per collection.
Also avoid syncing the pad on battery reports.

Fixes: f8b6a747 ("HID: wacom: generic: Support multiple tools per report")
Cc: <stable@vger.kernel.org> # v4.17+
Signed-off-by: default avatarAaron Armstrong Skomra <aaron.skomra@wacom.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent d8e98060
...@@ -2097,14 +2097,12 @@ static void wacom_wac_pad_report(struct hid_device *hdev, ...@@ -2097,14 +2097,12 @@ static void wacom_wac_pad_report(struct hid_device *hdev,
bool active = wacom_wac->hid_data.inrange_state != 0; bool active = wacom_wac->hid_data.inrange_state != 0;
/* report prox for expresskey events */ /* report prox for expresskey events */
if ((wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) && if (wacom_wac->hid_data.pad_input_event_flag) {
wacom_wac->hid_data.pad_input_event_flag) {
input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0); input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0);
input_sync(input); input_sync(input);
if (!active) if (!active)
wacom_wac->hid_data.pad_input_event_flag = false; wacom_wac->hid_data.pad_input_event_flag = false;
} }
} }
static void wacom_wac_pen_usage_mapping(struct hid_device *hdev, static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
...@@ -2680,9 +2678,7 @@ static int wacom_wac_collection(struct hid_device *hdev, struct hid_report *repo ...@@ -2680,9 +2678,7 @@ static int wacom_wac_collection(struct hid_device *hdev, struct hid_report *repo
if (report->type != HID_INPUT_REPORT) if (report->type != HID_INPUT_REPORT)
return -1; return -1;
if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input) if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
wacom_wac_pad_report(hdev, report, field);
else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
wacom_wac_pen_report(hdev, report); wacom_wac_pen_report(hdev, report);
else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input) else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
wacom_wac_finger_report(hdev, report); wacom_wac_finger_report(hdev, report);
...@@ -2696,7 +2692,7 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) ...@@ -2696,7 +2692,7 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report)
struct wacom_wac *wacom_wac = &wacom->wacom_wac; struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct hid_field *field; struct hid_field *field;
bool pad_in_hid_field = false, pen_in_hid_field = false, bool pad_in_hid_field = false, pen_in_hid_field = false,
finger_in_hid_field = false; finger_in_hid_field = false, true_pad = false;
int r; int r;
int prev_collection = -1; int prev_collection = -1;
...@@ -2712,6 +2708,8 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) ...@@ -2712,6 +2708,8 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report)
pen_in_hid_field = true; pen_in_hid_field = true;
if (WACOM_FINGER_FIELD(field)) if (WACOM_FINGER_FIELD(field))
finger_in_hid_field = true; finger_in_hid_field = true;
if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY)
true_pad = true;
} }
wacom_wac_battery_pre_report(hdev, report); wacom_wac_battery_pre_report(hdev, report);
...@@ -2735,6 +2733,9 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) ...@@ -2735,6 +2733,9 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report)
} }
wacom_wac_battery_report(hdev, report); wacom_wac_battery_report(hdev, report);
if (true_pad && wacom->wacom_wac.pad_input)
wacom_wac_pad_report(hdev, report, field);
} }
static int wacom_bpt_touch(struct wacom_wac *wacom) static int wacom_bpt_touch(struct wacom_wac *wacom)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment