blob: e90edfc63051bd34560c3e99d2df13308a1cb454 [file] [log] [blame]
Johnathon Harriscd9ec302010-01-21 14:36:52 +00001/*
2 * HID driver for Ortek WKB-2000 (wireless keyboard + mouse trackpad).
3 * Fixes LogicalMaximum error in USB report description, see
4 * http://bugzilla.kernel.org/show_bug.cgi?id=14787
5 *
6 * Copyright (c) 2010 Johnathon Harris <jmharris@gmail.com>
7 */
8
9/*
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
14 */
15
16#include <linux/device.h>
17#include <linux/hid.h>
18#include <linux/module.h>
19
20#include "hid-ids.h"
21
Nikolai Kondrashov73e40082010-08-06 23:03:06 +040022static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
23 unsigned int *rsize)
Johnathon Harriscd9ec302010-01-21 14:36:52 +000024{
Nikolai Kondrashov73e40082010-08-06 23:03:06 +040025 if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
Joe Perches4291ee32010-12-09 19:29:03 -080026 hid_info(hdev, "Fixing up Ortek WKB-2000 report descriptor\n");
Johnathon Harriscd9ec302010-01-21 14:36:52 +000027 rdesc[55] = 0x92;
28 }
Nikolai Kondrashov73e40082010-08-06 23:03:06 +040029 return rdesc;
Johnathon Harriscd9ec302010-01-21 14:36:52 +000030}
31
32static const struct hid_device_id ortek_devices[] = {
33 { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
34 { }
35};
36MODULE_DEVICE_TABLE(hid, ortek_devices);
37
38static struct hid_driver ortek_driver = {
39 .name = "ortek",
40 .id_table = ortek_devices,
41 .report_fixup = ortek_report_fixup
42};
43
44static int __init ortek_init(void)
45{
46 return hid_register_driver(&ortek_driver);
47}
48
49static void __exit ortek_exit(void)
50{
51 hid_unregister_driver(&ortek_driver);
52}
53
54module_init(ortek_init);
55module_exit(ortek_exit);
56MODULE_LICENSE("GPL");