Patchwork HID: hid-input: Add eraser usage to hidinput_configure_usage

login
register
mail settings
Submitter Ping Cheng
Date Oct. 3, 2017, 10:05 p.m.
Message ID <20171003220541.3333-1-ping.cheng@wacom.com>
Download mbox | patch
Permalink /patch/9983579/
State New
Headers show

Comments

Ping Cheng - Oct. 3, 2017, 10:05 p.m.
Some tablets report eraser usage to indicate the eraser tool tip
is touching the surface. But, hidinput_configure_usage didn't
support the usage, which led it falls into default as ABS_MISC.

Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
---
 drivers/hid/hid-input.c | 9 +++++++++
 1 file changed, 9 insertions(+)
Jiri Kosina - Oct. 5, 2017, 9:20 a.m.
On Tue, 3 Oct 2017, Ping Cheng wrote:

> Some tablets report eraser usage to indicate the eraser tool tip
> is touching the surface. But, hidinput_configure_usage didn't
> support the usage, which led it falls into default as ABS_MISC.

Applied to for-4.15/upstream. Thanks,

Patch

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 199f6a01fc62..04d01b57d94c 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -797,6 +797,15 @@  static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 			map_key_clear(BTN_STYLUS);
 			break;
 
+		case 0x45: /* ERASER */
+			/*
+			 * This event is reported when eraser tip touches the surface.
+			 * Actual eraser (BTN_TOOL_RUBBER) is set by Invert usage when
+			 * tool gets in proximity.
+			 */
+			map_key_clear(BTN_TOUCH);
+			break;
+
 		case 0x46: /* TabletPick */
 		case 0x5a: /* SecondaryBarrelSwitch */
 			map_key_clear(BTN_STYLUS2);