summaryrefslogtreecommitdiffstats
path: root/drivers/hid/wacom_wac.c
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2021-07-19 22:55:30 +0200
committerJiri Kosina <jkosina@suse.cz>2021-07-28 11:45:40 +0200
commit5bed0128868ce0e71f243973b3fc7b3bfca902b5 (patch)
tree4769cb8a78e2d86e88851f825cffcf78ef01eb8b /drivers/hid/wacom_wac.c
parentHID: wacom: set initial hardware touch switch state to 'off' (diff)
downloadlinux-5bed0128868ce0e71f243973b3fc7b3bfca902b5.tar.xz
linux-5bed0128868ce0e71f243973b3fc7b3bfca902b5.zip
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 <ping.cheng@wacom.com> Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/wacom_wac.c')
-rw-r--r--drivers/hid/wacom_wac.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index fa2b4222bcad..ce9e8e9b48b6 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2584,6 +2584,12 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
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)
return;
@@ -2633,6 +2639,12 @@ static void wacom_wac_finger_pre_report(struct hid_device *hdev,
struct hid_data* hid_data = &wacom_wac->hid_data;
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;
for (i = 0; i < report->maxfield; i++) {