diff options
author | Andreas Hübner <andreas@k4n.de> | 2012-02-21 20:10:06 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2012-02-22 05:30:17 -0500 |
commit | 1e93674a8ea169320950c5e6d1fa29a20b534e60 (patch) | |
tree | 79f4f684bad8bf5ff4bf31566fcc4cef5b8370b4 /drivers/hid | |
parent | 0944e964b23baee17d40abbd314695289380c2fd (diff) |
HID: add new driver for non-compliant Saitek devices
The driver currently only supports the PS1000 controller.
It fixes the report descriptor by removing a non-existing axis and
clearing the constant bit on the d-pad and button input reports.
Signed-off-by: Andreas Hübner <andreas@k4n.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/Kconfig | 9 | ||||
-rw-r--r-- | drivers/hid/Makefile | 1 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 1 | ||||
-rw-r--r-- | drivers/hid/hid-ids.h | 1 | ||||
-rw-r--r-- | drivers/hid/hid-saitek.c | 70 |
5 files changed, 82 insertions, 0 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 1e6b78ed5ac9..9398cfce80b6 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -532,6 +532,15 @@ config HID_ROCCAT_PYRA | |||
532 | ---help--- | 532 | ---help--- |
533 | Support for Roccat Pyra mouse. | 533 | Support for Roccat Pyra mouse. |
534 | 534 | ||
535 | config HID_SAITEK | ||
536 | tristate "Saitek non-fully HID-compliant devices" | ||
537 | depends on USB_HID | ||
538 | ---help--- | ||
539 | Support for Saitek devices that are not fully compliant with the | ||
540 | HID standard. | ||
541 | |||
542 | Currently only supports the PS1000 controller. | ||
543 | |||
535 | config HID_SAMSUNG | 544 | config HID_SAMSUNG |
536 | tristate "Samsung InfraRed remote control or keyboards" | 545 | tristate "Samsung InfraRed remote control or keyboards" |
537 | depends on USB_HID | 546 | depends on USB_HID |
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index c05f448f34a0..524532b49eaa 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
@@ -72,6 +72,7 @@ obj-$(CONFIG_HID_ROCCAT_KONE) += hid-roccat-kone.o | |||
72 | obj-$(CONFIG_HID_ROCCAT_KONEPLUS) += hid-roccat-koneplus.o | 72 | obj-$(CONFIG_HID_ROCCAT_KONEPLUS) += hid-roccat-koneplus.o |
73 | obj-$(CONFIG_HID_ROCCAT_KOVAPLUS) += hid-roccat-kovaplus.o | 73 | obj-$(CONFIG_HID_ROCCAT_KOVAPLUS) += hid-roccat-kovaplus.o |
74 | obj-$(CONFIG_HID_ROCCAT_PYRA) += hid-roccat-pyra.o | 74 | obj-$(CONFIG_HID_ROCCAT_PYRA) += hid-roccat-pyra.o |
75 | obj-$(CONFIG_HID_SAITEK) += hid-saitek.o | ||
75 | obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o | 76 | obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o |
76 | obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o | 77 | obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o |
77 | obj-$(CONFIG_HID_SONY) += hid-sony.o | 78 | obj-$(CONFIG_HID_SONY) += hid-sony.o |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 549c7538e57f..58d8f50649eb 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1519,6 +1519,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1519 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, | 1519 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, |
1520 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, | 1520 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, |
1521 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, | 1521 | { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) }, |
1522 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, | ||
1522 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, | 1523 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, |
1523 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, | 1524 | { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, |
1524 | { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, | 1525 | { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 6de95422586a..bc6e2b5862aa 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -615,6 +615,7 @@ | |||
615 | 615 | ||
616 | #define USB_VENDOR_ID_SAITEK 0x06a3 | 616 | #define USB_VENDOR_ID_SAITEK 0x06a3 |
617 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | 617 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 |
618 | #define USB_DEVICE_ID_SAITEK_PS1000 0xff17 | ||
618 | 619 | ||
619 | #define USB_VENDOR_ID_SAMSUNG 0x0419 | 620 | #define USB_VENDOR_ID_SAMSUNG 0x0419 |
620 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 | 621 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
diff --git a/drivers/hid/hid-saitek.c b/drivers/hid/hid-saitek.c new file mode 100644 index 000000000000..45aea77bb611 --- /dev/null +++ b/drivers/hid/hid-saitek.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * HID driver for Saitek devices, currently only the PS1000 (USB gamepad). | ||
3 | * Fixes the HID report descriptor by removing a non-existent axis and | ||
4 | * clearing the constant bit on the input reports for buttons and d-pad. | ||
5 | * (This module is based on "hid-ortek".) | ||
6 | * | ||
7 | * Copyright (c) 2012 Andreas Hübner | ||
8 | */ | ||
9 | |||
10 | /* | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the Free | ||
13 | * Software Foundation; either version 2 of the License, or (at your option) | ||
14 | * any later version. | ||
15 | */ | ||
16 | |||
17 | #include <linux/device.h> | ||
18 | #include <linux/hid.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/kernel.h> | ||
21 | |||
22 | #include "hid-ids.h" | ||
23 | |||
24 | static __u8 *saitek_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
25 | unsigned int *rsize) | ||
26 | { | ||
27 | if (*rsize == 137 && rdesc[20] == 0x09 && rdesc[21] == 0x33 | ||
28 | && rdesc[94] == 0x81 && rdesc[95] == 0x03 | ||
29 | && rdesc[110] == 0x81 && rdesc[111] == 0x03) { | ||
30 | |||
31 | hid_info(hdev, "Fixing up Saitek PS1000 report descriptor\n"); | ||
32 | |||
33 | /* convert spurious axis to a "noop" Logical Minimum (0) */ | ||
34 | rdesc[20] = 0x15; | ||
35 | rdesc[21] = 0x00; | ||
36 | |||
37 | /* clear constant bit on buttons and d-pad */ | ||
38 | rdesc[95] = 0x02; | ||
39 | rdesc[111] = 0x02; | ||
40 | |||
41 | } | ||
42 | return rdesc; | ||
43 | } | ||
44 | |||
45 | static const struct hid_device_id saitek_devices[] = { | ||
46 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000)}, | ||
47 | { } | ||
48 | }; | ||
49 | |||
50 | MODULE_DEVICE_TABLE(hid, saitek_devices); | ||
51 | |||
52 | static struct hid_driver saitek_driver = { | ||
53 | .name = "saitek", | ||
54 | .id_table = saitek_devices, | ||
55 | .report_fixup = saitek_report_fixup | ||
56 | }; | ||
57 | |||
58 | static int __init saitek_init(void) | ||
59 | { | ||
60 | return hid_register_driver(&saitek_driver); | ||
61 | } | ||
62 | |||
63 | static void __exit saitek_exit(void) | ||
64 | { | ||
65 | hid_unregister_driver(&saitek_driver); | ||
66 | } | ||
67 | |||
68 | module_init(saitek_init); | ||
69 | module_exit(saitek_exit); | ||
70 | MODULE_LICENSE("GPL"); | ||