Skip to content

Commit 5bed012

Browse files
jigpuJiri Kosina
authored andcommitted
HID: wacom: Short-circuit processing of touch when it is disabled
Avoid doing unnecessary work when touch is disabled by detecting this condition and returning early. Note that the probe process sends GET FEATURE requests to discover e.g. HID_DG_CONTACTMAX, so we can't start ignoring touch reports until probe finishes. Signed-off-by: Ping Cheng <[email protected]> Signed-off-by: Jason Gerecke <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent dc9dc86 commit 5bed012

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

drivers/hid/wacom_sys.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2797,6 +2797,7 @@ static int wacom_probe(struct hid_device *hdev,
27972797
error);
27982798
}
27992799

2800+
wacom_wac->probe_complete = true;
28002801
return 0;
28012802
}
28022803

drivers/hid/wacom_wac.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,6 +2584,12 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
25842584
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
25852585
struct wacom_features *features = &wacom->wacom_wac.features;
25862586

2587+
/* don't process touch events when touch is off */
2588+
if (wacom_wac->probe_complete &&
2589+
!wacom_wac->shared->is_touch_on &&
2590+
!wacom_wac->shared->touch_down)
2591+
return;
2592+
25872593
if (wacom_wac->is_invalid_bt_frame)
25882594
return;
25892595

@@ -2633,6 +2639,12 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev,
26332639
struct hid_data* hid_data = &wacom_wac->hid_data;
26342640
int i;
26352641

2642+
/* don't process touch events when touch is off */
2643+
if (wacom_wac->probe_complete &&
2644+
!wacom_wac->shared->is_touch_on &&
2645+
!wacom_wac->shared->touch_down)
2646+
return;
2647+
26362648
wacom_wac->is_invalid_bt_frame = false;
26372649

26382650
for (i = 0; i < report->maxfield; i++) {

drivers/hid/wacom_wac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ struct wacom_wac {
337337
int tool[2];
338338
int id[2];
339339
__u64 serial[2];
340+
bool probe_complete;
340341
bool reporting_data;
341342
struct wacom_features features;
342343
struct wacom_shared *shared;

0 commit comments

Comments
 (0)