aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/Kconfig8
-rw-r--r--drivers/hid/Makefile1
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-drff.c190
-rw-r--r--drivers/hid/hid-dummy.c3
-rw-r--r--drivers/hid/hid-ids.h2
6 files changed, 205 insertions, 0 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 97183066a27b..9cc662c7e744 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -128,6 +128,14 @@ config HID_CYPRESS
128 ---help--- 128 ---help---
129 Support for cypress mouse and barcode readers. 129 Support for cypress mouse and barcode readers.
130 130
131config DRAGONRISE_FF
132 tristate "DragonRise Inc. force feedback support"
133 depends on USB_HID
134 select INPUT_FF_MEMLESS
135 ---help---
136 Say Y here if you want to enable force feedback support for DragonRise Inc.
137 game controllers.
138
131config HID_EZKEY 139config HID_EZKEY
132 tristate "Ezkey" if EMBEDDED 140 tristate "Ezkey" if EMBEDDED
133 depends on USB_HID 141 depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index fbd021f153f1..0fdbda697991 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
26obj-$(CONFIG_HID_CHERRY) += hid-cherry.o 26obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
27obj-$(CONFIG_HID_CHICONY) += hid-chicony.o 27obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
28obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 28obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
29obj-$(CONFIG_DRAGONRISE_FF) += hid-drff.o
29obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 30obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
30obj-$(CONFIG_HID_GYRATION) += hid-gyration.o 31obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
31obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o 32obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 1cc967448f4d..7bc2f3744e77 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1262,6 +1262,7 @@ static const struct hid_device_id hid_blacklist[] = {
1262 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1262 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
1263 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1263 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
1264 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1264 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
1265 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
1265 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1266 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1267 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
1267 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, 1268 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
diff --git a/drivers/hid/hid-drff.c b/drivers/hid/hid-drff.c
new file mode 100644
index 000000000000..785d2492b5ef
--- /dev/null
+++ b/drivers/hid/hid-drff.c
@@ -0,0 +1,190 @@
1/*
2 * Force feedback support for DragonRise Inc. game controllers
3 *
4 * From what I have gathered, these devices are mass produced in China and are
5 * distributed under several vendors. They often share the same design as
6 * the original PlayStation DualShock controller.
7 *
8 * 0079:0006 "DragonRise Inc. Generic USB Joystick "
9 * - tested with a Tesun USB-703 game controller.
10 *
11 * Copyright (c) 2009 Richard Walmsley <richwalm@gmail.com>
12 */
13
14/*
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 */
29
30#include <linux/input.h>
31#include <linux/usb.h>
32#include <linux/hid.h>
33
34#include "hid-ids.h"
35#include "usbhid/usbhid.h"
36
37struct drff_device {
38 struct hid_report *report;
39};
40
41static int drff_play(struct input_dev *dev, void *data,
42 struct ff_effect *effect)
43{
44 struct hid_device *hid = input_get_drvdata(dev);
45 struct drff_device *drff = data;
46 int strong, weak;
47
48 strong = effect->u.rumble.strong_magnitude;
49 weak = effect->u.rumble.weak_magnitude;
50
51 dbg_hid("called with 0x%04x 0x%04x", strong, weak);
52
53 if (strong || weak) {
54 strong = strong * 0xff / 0xffff;
55 weak = weak * 0xff / 0xffff;
56
57 /* While reverse engineering this device, I found that when
58 this value is set, it causes the strong rumble to function
59 at a near maximum speed, so we'll bypass it. */
60 if (weak == 0x0a)
61 weak = 0x0b;
62
63 drff->report->field[0]->value[0] = 0x51;
64 drff->report->field[0]->value[1] = 0x00;
65 drff->report->field[0]->value[2] = weak;
66 drff->report->field[0]->value[4] = strong;
67 usbhid_submit_report(hid, drff->report, USB_DIR_OUT);
68
69 drff->report->field[0]->value[0] = 0xfa;
70 drff->report->field[0]->value[1] = 0xfe;
71 } else {
72 drff->report->field[0]->value[0] = 0xf3;
73 drff->report->field[0]->value[1] = 0x00;
74 }
75
76 drff->report->field[0]->value[2] = 0x00;
77 drff->report->field[0]->value[4] = 0x00;
78 dbg_hid("running with 0x%02x 0x%02x", strong, weak);
79 usbhid_submit_report(hid, drff->report, USB_DIR_OUT);
80
81 return 0;
82}
83
84static int drff_init(struct hid_device *hid)
85{
86 struct drff_device *drff;
87 struct hid_report *report;
88 struct hid_input *hidinput = list_first_entry(&hid->inputs,
89 struct hid_input, list);
90 struct list_head *report_list =
91 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
92 struct input_dev *dev = hidinput->input;
93 int error;
94
95 if (list_empty(report_list)) {
96 dev_err(&hid->dev, "no output reports found\n");
97 return -ENODEV;
98 }
99
100 report = list_first_entry(report_list, struct hid_report, list);
101 if (report->maxfield < 1) {
102 dev_err(&hid->dev, "no fields in the report\n");
103 return -ENODEV;
104 }
105
106 if (report->field[0]->report_count < 7) {
107 dev_err(&hid->dev, "not enough values in the field\n");
108 return -ENODEV;
109 }
110
111 drff = kzalloc(sizeof(struct drff_device), GFP_KERNEL);
112 if (!drff)
113 return -ENOMEM;
114
115 set_bit(FF_RUMBLE, dev->ffbit);
116
117 error = input_ff_create_memless(dev, drff, drff_play);
118 if (error) {
119 kfree(drff);
120 return error;
121 }
122
123 drff->report = report;
124 drff->report->field[0]->value[0] = 0xf3;
125 drff->report->field[0]->value[1] = 0x00;
126 drff->report->field[0]->value[2] = 0x00;
127 drff->report->field[0]->value[3] = 0x00;
128 drff->report->field[0]->value[4] = 0x00;
129 drff->report->field[0]->value[5] = 0x00;
130 drff->report->field[0]->value[6] = 0x00;
131 usbhid_submit_report(hid, drff->report, USB_DIR_OUT);
132
133 dev_info(&hid->dev, "Force Feedback for DragonRise Inc. game "
134 "controllers by Richard Walmsley <richwalm@gmail.com>\n");
135
136 return 0;
137}
138
139static int dr_probe(struct hid_device *hdev, const struct hid_device_id *id)
140{
141 int ret;
142
143 dev_dbg(&hdev->dev, "DragonRise Inc. HID hardware probe...");
144
145 ret = hid_parse(hdev);
146 if (ret) {
147 dev_err(&hdev->dev, "parse failed\n");
148 goto err;
149 }
150
151 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
152 if (ret) {
153 dev_err(&hdev->dev, "hw start failed\n");
154 goto err;
155 }
156
157 drff_init(hdev);
158
159 return 0;
160err:
161 return ret;
162}
163
164static const struct hid_device_id dr_devices[] = {
165 { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006), },
166 { }
167};
168MODULE_DEVICE_TABLE(hid, dr_devices);
169
170static struct hid_driver dr_driver = {
171 .name = "dragonrise",
172 .id_table = dr_devices,
173 .probe = dr_probe,
174};
175
176static int __init dr_init(void)
177{
178 return hid_register_driver(&dr_driver);
179}
180
181static void __exit dr_exit(void)
182{
183 hid_unregister_driver(&dr_driver);
184}
185
186module_init(dr_init);
187module_exit(dr_exit);
188MODULE_LICENSE("GPL");
189
190HID_COMPAT_LOAD_DRIVER(dragonrise);
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
index b4cc0f743d63..536aa15af281 100644
--- a/drivers/hid/hid-dummy.c
+++ b/drivers/hid/hid-dummy.c
@@ -28,6 +28,9 @@ static int __init hid_dummy_init(void)
28#ifdef CONFIG_HID_DELL_MODULE 28#ifdef CONFIG_HID_DELL_MODULE
29 HID_COMPAT_CALL_DRIVER(dell); 29 HID_COMPAT_CALL_DRIVER(dell);
30#endif 30#endif
31#ifdef CONFIG_DRAGONRISE_FF_MODULE
32 HID_COMPAT_CALL_DRIVER(dragonrise);
33#endif
31#ifdef CONFIG_HID_EZKEY_MODULE 34#ifdef CONFIG_HID_EZKEY_MODULE
32 HID_COMPAT_CALL_DRIVER(ezkey); 35 HID_COMPAT_CALL_DRIVER(ezkey);
33#endif 36#endif
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 88511970508d..9e83ca41dd70 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -148,6 +148,8 @@
148#define USB_VENDOR_ID_DMI 0x0c0b 148#define USB_VENDOR_ID_DMI 0x0c0b
149#define USB_DEVICE_ID_DMI_ENC 0x5fab 149#define USB_DEVICE_ID_DMI_ENC 0x5fab
150 150
151#define USB_VENDOR_ID_DRAGONRISE 0x0079
152
151#define USB_VENDOR_ID_ELO 0x04E7 153#define USB_VENDOR_ID_ELO 0x04E7
152#define USB_DEVICE_ID_ELO_TS2700 0x0020 154#define USB_DEVICE_ID_ELO_TS2700 0x0020
153 155