Commit 5bed0128 authored by Jason Gerecke's avatar Jason Gerecke Committed by Jiri Kosina

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: default avatarPing Cheng <ping.cheng@wacom.com>
Signed-off-by: default avatarJason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent dc9dc864
...@@ -2797,6 +2797,7 @@ static int wacom_probe(struct hid_device *hdev, ...@@ -2797,6 +2797,7 @@ static int wacom_probe(struct hid_device *hdev,
error); error);
} }
wacom_wac->probe_complete = true;
return 0; return 0;
} }
......
...@@ -2584,6 +2584,12 @@ static void wacom_wac_finger_event(struct hid_device *hdev, ...@@ -2584,6 +2584,12 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid); unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
struct wacom_features *features = &wacom->wacom_wac.features; struct wacom_features *features = &wacom->wacom_wac.features;
/* don't process touch events when touch is off */
if (wacom_wac->probe_complete &&
!wacom_wac->shared->is_touch_on &&
!wacom_wac->shared->touch_down)
return;
if (wacom_wac->is_invalid_bt_frame) if (wacom_wac->is_invalid_bt_frame)
return; return;
...@@ -2633,6 +2639,12 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev, ...@@ -2633,6 +2639,12 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev,
struct hid_data* hid_data = &wacom_wac->hid_data; struct hid_data* hid_data = &wacom_wac->hid_data;
int i; int i;
/* don't process touch events when touch is off */
if (wacom_wac->probe_complete &&
!wacom_wac->shared->is_touch_on &&
!wacom_wac->shared->touch_down)
return;
wacom_wac->is_invalid_bt_frame = false; wacom_wac->is_invalid_bt_frame = false;
for (i = 0; i < report->maxfield; i++) { for (i = 0; i < report->maxfield; i++) {
......
...@@ -337,6 +337,7 @@ struct wacom_wac { ...@@ -337,6 +337,7 @@ struct wacom_wac {
int tool[2]; int tool[2];
int id[2]; int id[2];
__u64 serial[2]; __u64 serial[2];
bool probe_complete;
bool reporting_data; bool reporting_data;
struct wacom_features features; struct wacom_features features;
struct wacom_shared *shared; struct wacom_shared *shared;
......
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