Linux Audio

Check our new training course

Loading...
v4.6
 
 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		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		}
32	}
33
34	return 0;
35}
36
37static const struct hid_device_id penmount_devices[] = {
38	{ HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
39	{ }
40};
41MODULE_DEVICE_TABLE(hid, penmount_devices);
42
43static struct hid_driver penmount_driver = {
44	.name = "hid-penmount",
45	.id_table = penmount_devices,
46	.input_mapping = penmount_input_mapping,
47};
48
49module_hid_driver(penmount_driver);
50
51MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>");
52MODULE_DESCRIPTION("PenMount HID TouchScreen driver");
53MODULE_LICENSE("GPL");
v6.2
 1// SPDX-License-Identifier: GPL-2.0-or-later
 2/*
 3 *  HID driver for PenMount touchscreens
 4 *
 5 *  Copyright (c) 2014 Christian Gmeiner <christian.gmeiner <at> gmail.com>
 6 *
 7 *  based on hid-penmount copyrighted by
 8 *    PenMount Touch Solutions <penmount <at> seed.net.tw>
 9 */
10
11/*
 
 
 
 
12 */
13
14#include <linux/module.h>
15#include <linux/hid.h>
16#include "hid-ids.h"
17
18static 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)
21{
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;
28		}
29	}
30
31	return 0;
32}
33
34static const struct hid_device_id penmount_devices[] = {
35	{ HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
36	{ }
37};
38MODULE_DEVICE_TABLE(hid, penmount_devices);
39
40static struct hid_driver penmount_driver = {
41	.name = "hid-penmount",
42	.id_table = penmount_devices,
43	.input_mapping = penmount_input_mapping,
44};
45
46module_hid_driver(penmount_driver);
47
48MODULE_AUTHOR("Christian Gmeiner <christian.gmeiner@gmail.com>");
49MODULE_DESCRIPTION("PenMount HID TouchScreen driver");
50MODULE_LICENSE("GPL");