Jiri Kosina | 7942274 | 2009-03-11 11:43:27 +0100 | [diff] [blame] | 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 | */ |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 26 | static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
| 27 | unsigned int *rsize) |
Jiri Kosina | 7942274 | 2009-03-11 11:43:27 +0100 | [diff] [blame] | 28 | { |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 29 | if (*rsize >= 74 && |
Jiri Kosina | 7942274 | 2009-03-11 11:43:27 +0100 | [diff] [blame] | 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) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 35 | hid_info(hdev, |
| 36 | "fixing up Kye/Genius Ergo Mouse report descriptor\n"); |
Jiri Kosina | 7942274 | 2009-03-11 11:43:27 +0100 | [diff] [blame] | 37 | rdesc[62] = 0x09; |
| 38 | rdesc[64] = 0x04; |
| 39 | rdesc[66] = 0x07; |
| 40 | rdesc[72] = 0x01; |
| 41 | rdesc[74] = 0x08; |
| 42 | } |
Nikolai Kondrashov | 73e4008 | 2010-08-06 23:03:06 +0400 | [diff] [blame] | 43 | return rdesc; |
Jiri Kosina | 7942274 | 2009-03-11 11:43:27 +0100 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | static const struct hid_device_id kye_devices[] = { |
| 47 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, |
| 48 | { } |
| 49 | }; |
| 50 | MODULE_DEVICE_TABLE(hid, kye_devices); |
| 51 | |
| 52 | static struct hid_driver kye_driver = { |
| 53 | .name = "kye", |
| 54 | .id_table = kye_devices, |
| 55 | .report_fixup = kye_report_fixup, |
| 56 | }; |
| 57 | |
Peter Huewe | a24f423b | 2009-07-02 19:08:38 +0200 | [diff] [blame] | 58 | static int __init kye_init(void) |
Jiri Kosina | 7942274 | 2009-03-11 11:43:27 +0100 | [diff] [blame] | 59 | { |
| 60 | return hid_register_driver(&kye_driver); |
| 61 | } |
| 62 | |
Peter Huewe | a24f423b | 2009-07-02 19:08:38 +0200 | [diff] [blame] | 63 | static void __exit kye_exit(void) |
Jiri Kosina | 7942274 | 2009-03-11 11:43:27 +0100 | [diff] [blame] | 64 | { |
| 65 | hid_unregister_driver(&kye_driver); |
| 66 | } |
| 67 | |
| 68 | module_init(kye_init); |
| 69 | module_exit(kye_exit); |
| 70 | MODULE_LICENSE("GPL"); |