aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-penmount.c
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2014-09-03 04:33:53 -0400
committerJiri Kosina <jkosina@suse.cz>2014-09-04 05:23:51 -0400
commitffe51d0d8abce3139a970c640ed48e73e9c360bb (patch)
tree9a5d3288bf94f08765d9b1532ea104d5a93b4e1a /drivers/hid/hid-penmount.c
parent67a97845830f79584c9db8849ac723e5d2d57f65 (diff)
HID: add support for PenMount HID TouchScreen Driver
This patch adds a seperate hid-penmount driver to work around an issue with the HID report descriptor. The descriptor does not contain the ContactID usage and as result the touchscreen is represented as normal mouse to the system. This driver maps the button 0 emitted by the touchscreen to BTN_TOUCH. This makes it possible to use touch events in userspace. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-penmount.c')
-rw-r--r--drivers/hid/hid-penmount.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/hid/hid-penmount.c b/drivers/hid/hid-penmount.c
new file mode 100644
index 000000000000..c11dce85cd18
--- /dev/null
+++ b/drivers/hid/hid-penmount.c
@@ -0,0 +1,49 @@
1/*
2 * HID driver for PenMount touchscreens
3 *
4 * Copyright (c) 2014 Christian Gmeiner <christian.gmeiner <at> gmail.com>
5 *
6 * based on hid-penmount copyrighted by
7 * PenMount Touch Solutions <penmount <at> seed.net.tw>
8 */
9
10/*
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free
13 * Software Foundation; either version 2 of the License, or (at your option)
14 * any later version.
15 */
16
17#include <linux/module.h>
18#include <linux/hid.h>
19#include "hid-ids.h"
20
21static int penmount_input_mapping(struct hid_device *hdev,
22 struct hid_input *hi, struct hid_field *field,
23 struct hid_usage *usage, unsigned long **bit, int *max)
24{
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;
28 }
29
30 return 0;
31}
32
33static const struct hid_device_id penmount_devices[] = {
34 { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
35 { }
36};
37MODULE_DEVICE_TABLE(hid, penmount_devices);
38
39static struct hid_driver penmount_driver = {
40 .name = "hid-penmount",
41 .id_table = penmount_devices,
42 .input_mapping = penmount_input_mapping,
43};
44
45module_hid_driver(penmount_driver);
46
47MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>");
48MODULE_DESCRIPTION("PenMount HID TouchScreen driver");
49MODULE_LICENSE("GPL");