Skip to content

Commit d4b8efe

Browse files
skomraJiri Kosina
authored andcommitted
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: f8b6a74 ("HID: wacom: generic: Support multiple tools per report") Cc: <[email protected]> # v4.17+ Signed-off-by: Aaron Armstrong Skomra <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent d8e9806 commit d4b8efe

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/hid/wacom_wac.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,14 +2097,12 @@ static void wacom_wac_pad_report(struct hid_device *hdev,
20972097
bool active = wacom_wac->hid_data.inrange_state != 0;
20982098

20992099
/* report prox for expresskey events */
2100-
if ((wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY) &&
2101-
wacom_wac->hid_data.pad_input_event_flag) {
2100+
if (wacom_wac->hid_data.pad_input_event_flag) {
21022101
input_event(input, EV_ABS, ABS_MISC, active ? PAD_DEVICE_ID : 0);
21032102
input_sync(input);
21042103
if (!active)
21052104
wacom_wac->hid_data.pad_input_event_flag = false;
21062105
}
2107-
21082106
}
21092107

21102108
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
26802678
if (report->type != HID_INPUT_REPORT)
26812679
return -1;
26822680

2683-
if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input)
2684-
wacom_wac_pad_report(hdev, report, field);
2685-
else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
2681+
if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
26862682
wacom_wac_pen_report(hdev, report);
26872683
else if (WACOM_FINGER_FIELD(field) && wacom->wacom_wac.touch_input)
26882684
wacom_wac_finger_report(hdev, report);
@@ -2696,7 +2692,7 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report)
26962692
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
26972693
struct hid_field *field;
26982694
bool pad_in_hid_field = false, pen_in_hid_field = false,
2699-
finger_in_hid_field = false;
2695+
finger_in_hid_field = false, true_pad = false;
27002696
int r;
27012697
int prev_collection = -1;
27022698

@@ -2712,6 +2708,8 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report)
27122708
pen_in_hid_field = true;
27132709
if (WACOM_FINGER_FIELD(field))
27142710
finger_in_hid_field = true;
2711+
if (wacom_equivalent_usage(field->physical) == HID_DG_TABLETFUNCTIONKEY)
2712+
true_pad = true;
27152713
}
27162714

27172715
wacom_wac_battery_pre_report(hdev, report);
@@ -2735,6 +2733,9 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report)
27352733
}
27362734

27372735
wacom_wac_battery_report(hdev, report);
2736+
2737+
if (true_pad && wacom->wacom_wac.pad_input)
2738+
wacom_wac_pad_report(hdev, report, field);
27382739
}
27392740

27402741
static int wacom_bpt_touch(struct wacom_wac *wacom)

0 commit comments

Comments
 (0)