summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2017-09-08 02:52:15 +0200
committerJiri Kosina <jkosina@suse.cz>2017-09-13 19:18:01 +0200
commit5b40104edfb003b1e8bae3e546771e6edb59c6b7 (patch)
tree8a0adb3649331401717c9cdb081ba97ac3e1cc79
parentHID: wacom: generic: Send BTN_TOOL_PEN in prox once the pen enters range (diff)
downloadlinux-5b40104edfb003b1e8bae3e546771e6edb59c6b7.tar.xz
linux-5b40104edfb003b1e8bae3e546771e6edb59c6b7.zip
HID: wacom: generic: Reset events back to zero when pen leaves
As a pen leaves, we need to be sure to reset all events back to zero so that userspace is able to get the complete pen state when it enters proximity again. Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com> Reviewed-by: Ping Cheng <ping.cheng@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/wacom_wac.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index 929a1ceabc21..2926e36cb684 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -2218,10 +2218,10 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field
return;
/* send pen events only when the pen is in range */
- if (!wacom_wac->hid_data.inrange_state)
- return;
-
- input_event(input, usage->type, usage->code, value);
+ if (wacom_wac->hid_data.inrange_state)
+ input_event(input, usage->type, usage->code, value);
+ else if (wacom_wac->shared->stylus_in_proximity && !wacom_wac->hid_data.sense_state)
+ input_event(input, usage->type, usage->code, 0);
}
static void wacom_wac_pen_pre_report(struct hid_device *hdev,