Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: penmount: report only one button for PenMount 6000 USB touchscreen controller

PenMount 6000 USB resistive touchscreen controller reports it has three
buttons, while in reality it doesn't have any and doesn't support active
styli, and only generates touch events.

In penmount_input_mapping(), map only the first button (with code 0),
ignore the rest.

Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>
Tested-by: Christian Gmeiner <c.gmeiner@bachmann.info
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Andrew Shadura and committed by
Jiri Kosina
5f66872c c2848f2e

+6 -2
+6 -2
drivers/hid/hid-penmount.c
··· 23 23 struct hid_usage *usage, unsigned long **bit, int *max) 24 24 { 25 25 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) { 26 - hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); 27 - return 1; 26 + if (((usage->hid - 1) & HID_USAGE) == 0) { 27 + hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); 28 + return 1; 29 + } else { 30 + return -1; 31 + } 28 32 } 29 33 30 34 return 0;