Merge branches 'for-4.10/upstream-fixes', 'for-4.11/intel-ish', 'for-4.11/mayflash...
[platform/kernel/linux-exynos.git] / drivers / hid / hid-keytouch.c
1 /*
2  *  HID driver for Keytouch devices not fully compliant with HID standard
3  *
4  *  Copyright (c) 2011 Jiri Kosina
5  */
6
7 /*
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the Free
10  * Software Foundation; either version 2 of the License, or (at your option)
11  * any later version.
12  */
13
14 #include <linux/device.h>
15 #include <linux/hid.h>
16 #include <linux/module.h>
17
18 #include "hid-ids.h"
19
20 /* Replace the broken report descriptor of this device with rather
21  * a default one */
22 static __u8 keytouch_fixed_rdesc[] = {
23 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15,
24 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08,
25 0x81, 0x01, 0x95, 0x03, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91,
26 0x02, 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00,
27 0x26, 0xff, 0x00, 0x05, 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00, 0xc0
28 };
29
30 static __u8 *keytouch_report_fixup(struct hid_device *hdev, __u8 *rdesc,
31                 unsigned int *rsize)
32 {
33         hid_info(hdev, "fixing up Keytouch IEC report descriptor\n");
34
35         rdesc = keytouch_fixed_rdesc;
36         *rsize = sizeof(keytouch_fixed_rdesc);
37
38         return rdesc;
39 }
40
41 static const struct hid_device_id keytouch_devices[] = {
42         { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
43         { }
44 };
45 MODULE_DEVICE_TABLE(hid, keytouch_devices);
46
47 static struct hid_driver keytouch_driver = {
48         .name = "keytouch",
49         .id_table = keytouch_devices,
50         .report_fixup = keytouch_report_fixup,
51 };
52 module_hid_driver(keytouch_driver);
53
54 MODULE_LICENSE("GPL");
55 MODULE_AUTHOR("Jiri Kosina");