Skip to content

Commit

Permalink
HID: wacom: generic: Reset events back to zero when pen leaves
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jason Gerecke authored and Jiri Kosina committed Sep 13, 2017
1 parent 3e70969 commit 5b40104
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/hid/wacom_wac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5b40104

Please sign in to comment.