Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / hid / hid-penmount.c
blobb9edc8e758fde13860fd5e1c58e0c755773ac0a7
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * HID driver for PenMount touchscreens
5 * Copyright (c) 2014 Christian Gmeiner <christian.gmeiner <at> gmail.com>
7 * based on hid-penmount copyrighted by
8 * PenMount Touch Solutions <penmount <at> seed.net.tw>
9 */
14 #include <linux/module.h>
15 #include <linux/hid.h>
16 #include "hid-ids.h"
18 static int penmount_input_mapping(struct hid_device *hdev,
19 struct hid_input *hi, struct hid_field *field,
20 struct hid_usage *usage, unsigned long **bit, int *max)
22 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
23 if (((usage->hid - 1) & HID_USAGE) == 0) {
24 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
25 return 1;
26 } else {
27 return -1;
31 return 0;
34 static const struct hid_device_id penmount_devices[] = {
35 { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
36 { }
38 MODULE_DEVICE_TABLE(hid, penmount_devices);
40 static struct hid_driver penmount_driver = {
41 .name = "hid-penmount",
42 .id_table = penmount_devices,
43 .input_mapping = penmount_input_mapping,
46 module_hid_driver(penmount_driver);
48 MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>");
49 MODULE_DESCRIPTION("PenMount HID TouchScreen driver");
50 MODULE_LICENSE("GPL");