Permalink
Browse files

backport: HID: wacom: generic: Send BTN_TOOL_PEN in prox once the pen…

… enters range

When a pen is first able to to be sensed by the tablet, we would like
to inform userspace that a tool is nearby so that it can attempt to
perform palm rejection. Unfortunately, we don't know any information
about the tool that is nearby, so the best we can do is send a prox
event for a generic BTN_TOOL_PEN. If the pen later comes closer and
enters proximity, we can determine the actual tool type and send
BTN_TOOL_PEN out of prox if necessary.

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>
[aaron.skomra@wacom.com: Imported into input-wacom repository (3e70969e44ee)]
Signed-off-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
[aaron.skomra@wacom.com: Backported from input-wacom repository (6ee4cd1)]
Signed-off-by: Aaron Armstrong Skomra <aaron.skomra@wacom.com>
  • Loading branch information...
jigpu authored and skomra committed Sep 8, 2017
1 parent df4cb0a commit 5181a23c0c11ff59b80df06ec3e897bac660645b
Showing with 11 additions and 0 deletions.
  1. +11 −0 3.17/wacom_wac.c
View
@@ -2256,6 +2256,17 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
wacom_wac->tool[0] = wacom_intuos_get_tool_type(wacom_wac->id[0]);
else
wacom_wac->tool[0] = BTN_TOOL_PEN;
if (wacom_wac->shared->stylus_in_proximity &&
wacom_wac->tool[0] != BTN_TOOL_PEN) {
input_report_key(input, BTN_TOOL_PEN, 0);
input_sync(input);
}
}
else if (!wacom_wac->tool[0] && !range) { /* entering in sense */
input_report_key(input, BTN_TOOL_PEN, sense);
input_report_key(input, BTN_TOUCH, 0);
input_sync(input);
}
/* keep pen state for touch events */

0 comments on commit 5181a23

Please sign in to comment.