aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/Kconfig1
-rw-r--r--drivers/hid/Makefile1
-rw-r--r--drivers/hid/hid-holtek-mouse.c72
-rw-r--r--drivers/hid/hid-ids.h1
4 files changed, 75 insertions, 0 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index fb52f3f6de80..a0e19dc69daf 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -231,6 +231,7 @@ config HID_HOLTEK
231 Support for Holtek based devices: 231 Support for Holtek based devices:
232 - Holtek On Line Grip based game controller 232 - Holtek On Line Grip based game controller
233 - Trust GXT 18 Gaming Keyboard 233 - Trust GXT 18 Gaming Keyboard
234 - Sharkoon Drakonia / Perixx MX-2000 gaming mice
234 235
235config HOLTEK_FF 236config HOLTEK_FF
236 bool "Holtek On Line Grip force feedback support" 237 bool "Holtek On Line Grip force feedback support"
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 2065694f57ab..1fc048b04aaa 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
51obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 51obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
52obj-$(CONFIG_HID_GYRATION) += hid-gyration.o 52obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
53obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o 53obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o
54obj-$(CONFIG_HID_HOLTEK) += hid-holtek-mouse.o
54obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o 55obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o
55obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o 56obj-$(CONFIG_HID_HYPERV_MOUSE) += hid-hyperv.o
56obj-$(CONFIG_HID_ICADE) += hid-icade.o 57obj-$(CONFIG_HID_ICADE) += hid-icade.o
diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c
new file mode 100644
index 000000000000..f32e29aea11a
--- /dev/null
+++ b/drivers/hid/hid-holtek-mouse.c
@@ -0,0 +1,72 @@
1/*
2 * HID driver for Holtek gaming mice
3 * Copyright (c) 2013 Christian Ohm
4 * Heavily inspired by various other HID drivers that adjust the report
5 * descriptor.
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/hid.h>
16#include <linux/module.h>
17#include <linux/usb.h>
18
19#include "hid-ids.h"
20
21/*
22 * The report descriptor of some Holtek based gaming mice specifies an
23 * excessively large number of consumer usages (2^15), which is more than
24 * HID_MAX_USAGES. This prevents proper parsing of the report descriptor.
25 *
26 * This driver fixes the report descriptor for USB ID 04d9:a067, sold as
27 * Sharkoon Drakonia and Perixx MX-2000.
28 */
29
30static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
31 unsigned int *rsize)
32{
33 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
34
35 if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
36 /* Change usage maximum and logical maximum from 0x7fff to
37 * 0x2fff, so they don't exceed HID_MAX_USAGES */
38 if (*rsize >= 122 && rdesc[115] == 0xff && rdesc[116] == 0x7f
39 && rdesc[120] == 0xff && rdesc[121] == 0x7f) {
40 hid_info(hdev, "Fixing up report descriptor\n");
41 rdesc[116] = rdesc[121] = 0x2f;
42 }
43 }
44 return rdesc;
45}
46
47static const struct hid_device_id holtek_mouse_devices[] = {
48 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
49 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) },
50 { }
51};
52MODULE_DEVICE_TABLE(hid, holtek_mouse_devices);
53
54static struct hid_driver holtek_mouse_driver = {
55 .name = "holtek_mouse",
56 .id_table = holtek_mouse_devices,
57 .report_fixup = holtek_mouse_report_fixup,
58};
59
60static int __init holtek_mouse_init(void)
61{
62 return hid_register_driver(&holtek_mouse_driver);
63}
64
65static void __exit holtek_mouse_exit(void)
66{
67 hid_unregister_driver(&holtek_mouse_driver);
68}
69
70module_exit(holtek_mouse_exit);
71module_init(holtek_mouse_init);
72MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 38535c9243d5..59766dfdf761 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -440,6 +440,7 @@
440 440
441#define USB_VENDOR_ID_HOLTEK_ALT 0x04d9 441#define USB_VENDOR_ID_HOLTEK_ALT 0x04d9
442#define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055 442#define USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD 0xa055
443#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067
443 444
444#define USB_VENDOR_ID_IMATION 0x0718 445#define USB_VENDOR_ID_IMATION 0x0718
445#define USB_DEVICE_ID_DISC_STAKKA 0xd000 446#define USB_DEVICE_ID_DISC_STAKKA 0xd000