aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-kye.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2009-03-11 06:43:27 -0400
committerJiri Kosina <jkosina@suse.cz>2009-03-30 09:12:54 -0400
commit794227415f8f5f395a9ed4269a4ee7a3c34f66a5 (patch)
tree9c0a7f22ceb0c2b940eb80d33b5f792e70dd48a9 /drivers/hid/hid-kye.c
parentfef3f571ecc2a82395c531d97b3f71a59e04e946 (diff)
HID: add support for Kye/Genius Ergo 525V
This device sends several buttons in a separate field, which is wrongly described in the report descriptor. Fix it in the following way: - change led usage page to button - report size 8 count 1 becomes report size 1 count 8 - the button usage range changed to 4-7 (the mouse has three buttons in a different field already). Reported-by: Tomas Hanak <tomas.hanak@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-kye.c')
-rw-r--r--drivers/hid/hid-kye.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c
new file mode 100644
index 000000000000..ea7f412e31a9
--- /dev/null
+++ b/drivers/hid/hid-kye.c
@@ -0,0 +1,71 @@
1/*
2 * HID driver for Kye/Genius devices not fully compliant with HID standard
3 *
4 * Copyright (c) 2009 Jiri Kosina
5 * Copyright (c) 2009 Tomas Hanak
6 */
7
8/*
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 */
14
15#include <linux/device.h>
16#include <linux/hid.h>
17#include <linux/module.h>
18
19#include "hid-ids.h"
20
21/* the fixups that need to be done:
22 * - change led usage page to button for extra buttons
23 * - report size 8 count 1 must be size 1 count 8 for button bitfield
24 * - change the button usage range to 4-7 for the extra buttons
25 */
26static void kye_report_fixup(struct hid_device *hdev, __u8 *rdesc,
27 unsigned int rsize)
28{
29 if (rsize >= 74 &&
30 rdesc[61] == 0x05 && rdesc[62] == 0x08 &&
31 rdesc[63] == 0x19 && rdesc[64] == 0x08 &&
32 rdesc[65] == 0x29 && rdesc[66] == 0x0f &&
33 rdesc[71] == 0x75 && rdesc[72] == 0x08 &&
34 rdesc[73] == 0x95 && rdesc[74] == 0x01) {
35 dev_info(&hdev->dev, "fixing up Kye/Genius Ergo Mouse report "
36 "descriptor\n");
37 rdesc[62] = 0x09;
38 rdesc[64] = 0x04;
39 rdesc[66] = 0x07;
40 rdesc[72] = 0x01;
41 rdesc[74] = 0x08;
42 }
43}
44
45static const struct hid_device_id kye_devices[] = {
46 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
47 { }
48};
49MODULE_DEVICE_TABLE(hid, kye_devices);
50
51static struct hid_driver kye_driver = {
52 .name = "kye",
53 .id_table = kye_devices,
54 .report_fixup = kye_report_fixup,
55};
56
57static int kye_init(void)
58{
59 return hid_register_driver(&kye_driver);
60}
61
62static void kye_exit(void)
63{
64 hid_unregister_driver(&kye_driver);
65}
66
67module_init(kye_init);
68module_exit(kye_exit);
69MODULE_LICENSE("GPL");
70
71HID_COMPAT_LOAD_DRIVER(kye);