diff options
author | Jiri Kosina <jkosina@suse.cz> | 2011-02-17 09:12:45 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-02-17 09:12:45 -0500 |
commit | 177900e8c9ab28cdf097314fe7dd3877774df97d (patch) | |
tree | 1936e26251316bdbaebdd07f2f3ede2d1cc9e976 /drivers/hid/hid-keytouch.c | |
parent | 6d3bfb74341c2c1454fcf5ec9c4dd707011f78e5 (diff) |
HID: add support for Keytouch IEC 60945
The keyboard has several bugs in its report descriptor, most
importantly the Logical Min/Max are completely off.
Replace it with simplified descriptor which describes it properly.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-keytouch.c')
-rw-r--r-- | drivers/hid/hid-keytouch.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/hid/hid-keytouch.c b/drivers/hid/hid-keytouch.c new file mode 100644 index 000000000000..07cd825f6f01 --- /dev/null +++ b/drivers/hid/hid-keytouch.c | |||
@@ -0,0 +1,66 @@ | |||
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 | |||
53 | static int __init keytouch_init(void) | ||
54 | { | ||
55 | return hid_register_driver(&keytouch_driver); | ||
56 | } | ||
57 | |||
58 | static void __exit keytouch_exit(void) | ||
59 | { | ||
60 | hid_unregister_driver(&keytouch_driver); | ||
61 | } | ||
62 | |||
63 | module_init(keytouch_init); | ||
64 | module_exit(keytouch_exit); | ||
65 | MODULE_LICENSE("GPL"); | ||
66 | MODULE_AUTHOR("Jiri Kosina"); | ||