aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristian Ohm <chr.ohm@gmx.net>2013-05-20 19:31:09 -0400
committerJiri Kosina <jkosina@suse.cz>2013-05-28 06:15:56 -0400
commitd4f5189052c68f5bae3aac62b357577ecb862fee (patch)
tree2d732da5906ea1cf135b2eb0a3034c326d902177 /drivers
parent41de326eafa6eff71c6ca00ae27c6be235c65a6d (diff)
HID: Add support for Holtek gaming mouse 04d9:a04a
This mouse is sold as Tracer Sniper TRM-503, NOVA Gaming Slider X200 and Zalman ZM-GM1, and reports too high usage maximum and logical maximum (like 04d9:a067, but its report descriptor is different). This patch adds its USB ID and fixes the report descriptor in the same way. Note: I don't actually have such a mouse to test, I took the report descriptor posted at https://bugzilla.novell.com/show_bug.cgi?id=774676, compared it to the one from 04d9:a067 and changed the offsets accordingly (all numbers minus 9, since it is 9 bytes shorter, and the difference is before the values that need changing). That Surely Works™. Signed-off-by: Christian Ohm <chr.ohm@gmx.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/Kconfig2
-rw-r--r--drivers/hid/hid-holtek-mouse.c28
-rw-r--r--drivers/hid/hid-ids.h1
3 files changed, 25 insertions, 6 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index a0e19dc69daf..79e02682b2df 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -232,6 +232,8 @@ config HID_HOLTEK
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 - Sharkoon Drakonia / Perixx MX-2000 gaming mice
235 - Tracer Sniper TRM-503 / NOVA Gaming Slider X200 /
236 Zalman ZM-GM1
235 237
236config HOLTEK_FF 238config HOLTEK_FF
237 bool "Holtek On Line Grip force feedback support" 239 bool "Holtek On Line Grip force feedback support"
diff --git a/drivers/hid/hid-holtek-mouse.c b/drivers/hid/hid-holtek-mouse.c
index f32e29aea11a..6a23ee678138 100644
--- a/drivers/hid/hid-holtek-mouse.c
+++ b/drivers/hid/hid-holtek-mouse.c
@@ -23,8 +23,10 @@
23 * excessively large number of consumer usages (2^15), which is more than 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. 24 * HID_MAX_USAGES. This prevents proper parsing of the report descriptor.
25 * 25 *
26 * This driver fixes the report descriptor for USB ID 04d9:a067, sold as 26 * This driver fixes the report descriptor for:
27 * Sharkoon Drakonia and Perixx MX-2000. 27 * - USB ID 04d9:a067, sold as Sharkoon Drakonia and Perixx MX-2000
28 * - USB ID 04d9:a04a, sold as Tracer Sniper TRM-503, NOVA Gaming Slider X200
29 * and Zalman ZM-GM1
28 */ 30 */
29 31
30static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc, 32static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
@@ -35,11 +37,23 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
35 if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { 37 if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
36 /* Change usage maximum and logical maximum from 0x7fff to 38 /* Change usage maximum and logical maximum from 0x7fff to
37 * 0x2fff, so they don't exceed HID_MAX_USAGES */ 39 * 0x2fff, so they don't exceed HID_MAX_USAGES */
38 if (*rsize >= 122 && rdesc[115] == 0xff && rdesc[116] == 0x7f 40 switch (hdev->product) {
39 && rdesc[120] == 0xff && rdesc[121] == 0x7f) { 41 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067:
40 hid_info(hdev, "Fixing up report descriptor\n"); 42 if (*rsize >= 122 && rdesc[115] == 0xff && rdesc[116] == 0x7f
41 rdesc[116] = rdesc[121] = 0x2f; 43 && rdesc[120] == 0xff && rdesc[121] == 0x7f) {
44 hid_info(hdev, "Fixing up report descriptor\n");
45 rdesc[116] = rdesc[121] = 0x2f;
46 }
47 break;
48 case USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A:
49 if (*rsize >= 113 && rdesc[106] == 0xff && rdesc[107] == 0x7f
50 && rdesc[111] == 0xff && rdesc[112] == 0x7f) {
51 hid_info(hdev, "Fixing up report descriptor\n");
52 rdesc[107] = rdesc[112] = 0x2f;
53 }
54 break;
42 } 55 }
56
43 } 57 }
44 return rdesc; 58 return rdesc;
45} 59}
@@ -47,6 +61,8 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
47static const struct hid_device_id holtek_mouse_devices[] = { 61static const struct hid_device_id holtek_mouse_devices[] = {
48 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, 62 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
49 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) }, 63 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) },
64 { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
65 USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A) },
50 { } 66 { }
51}; 67};
52MODULE_DEVICE_TABLE(hid, holtek_mouse_devices); 68MODULE_DEVICE_TABLE(hid, holtek_mouse_devices);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 59766dfdf761..a9fcb9ea6c16 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -441,6 +441,7 @@
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#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067 0xa067
444#define USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A04A 0xa04a
444 445
445#define USB_VENDOR_ID_IMATION 0x0718 446#define USB_VENDOR_ID_IMATION 0x0718
446#define USB_DEVICE_ID_DISC_STAKKA 0xd000 447#define USB_DEVICE_ID_DISC_STAKKA 0xd000