xref: /openbmc/linux/drivers/hid/hid-ortek.c (revision baa7eb025ab14f3cba2e35c0a8648f9c9f01d24f)
1 /*
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 
22 static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
23 		unsigned int *rsize)
24 {
25 	if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) {
26 		dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 "
27 				"report descriptor.\n");
28 		rdesc[55] = 0x92;
29 	}
30 	return rdesc;
31 }
32 
33 static const struct hid_device_id ortek_devices[] = {
34 	{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
35 	{ }
36 };
37 MODULE_DEVICE_TABLE(hid, ortek_devices);
38 
39 static struct hid_driver ortek_driver = {
40 	.name = "ortek",
41 	.id_table = ortek_devices,
42 	.report_fixup = ortek_report_fixup
43 };
44 
45 static int __init ortek_init(void)
46 {
47 	return hid_register_driver(&ortek_driver);
48 }
49 
50 static void __exit ortek_exit(void)
51 {
52 	hid_unregister_driver(&ortek_driver);
53 }
54 
55 module_init(ortek_init);
56 module_exit(ortek_exit);
57 MODULE_LICENSE("GPL");
58