Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / hid / hid-keytouch.c
blob73bf8642dfe3c80c0ebe17e78c93d215115abd11
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * HID driver for Keytouch devices not fully compliant with HID standard
5 * Copyright (c) 2011 Jiri Kosina
6 */
8 /*
9 */
11 #include <linux/device.h>
12 #include <linux/hid.h>
13 #include <linux/module.h>
15 #include "hid-ids.h"
17 /* Replace the broken report descriptor of this device with rather
18 * a default one */
19 static __u8 keytouch_fixed_rdesc[] = {
20 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15,
21 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08,
22 0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91,
23 0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00,
24 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0
27 static __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
28 unsigned int *rsize)
30 hid_info(hdev, "fixing up Keytouch IEC report descriptor\n");
32 rdesc = keytouch_fixed_rdesc;
33 *rsize = sizeof(keytouch_fixed_rdesc);
35 return rdesc;
38 static const struct hid_device_id keytouch_devices[] = {
39 { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
40 { }
42 MODULE_DEVICE_TABLE(hid, keytouch_devices);
44 static struct hid_driver keytouch_driver = {
45 .name = "keytouch",
46 .id_table = keytouch_devices,
47 .report_fixup = keytouch_report_fixup,
49 module_hid_driver(keytouch_driver);
51 MODULE_LICENSE("GPL");
52 MODULE_AUTHOR("Jiri Kosina");