aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorIgnaz Forster <ignaz.forster@gmx.de>2010-11-01 15:13:37 -0400
committerJiri Kosina <jkosina@suse.cz>2010-11-01 15:13:37 -0400
commit04561c5aa243c98cae93cde27e05740df787e692 (patch)
treea56fe4bb3da50b20e5724e53703c528cbf323d92 /drivers/hid
parent229aebb873e29726b91e076161649cf45154b0bf (diff)
HID: Add Force Feedback support for EMS Trio Linker Plus II
The device has connections for GameCube, PlayStation 2 and Dreamcast controllers, however Force Feedback is only supported for PS2 and GC controllers. When using a PS2 controller it may be necessary to press the "Analog" button to enable support for both motors (this behavior is identical to the Windows driver, I have found no way to avoid that). Signed-off-by: Ignaz Forster <ignaz.forster@gmx.de> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/Kconfig10
-rw-r--r--drivers/hid/Makefile1
-rw-r--r--drivers/hid/hid-core.c1
-rw-r--r--drivers/hid/hid-emsff.c162
-rw-r--r--drivers/hid/hid-ids.h3
5 files changed, 177 insertions, 0 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 3052e2969ad0..3d9a95f28aea 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -150,6 +150,16 @@ config DRAGONRISE_FF
150 Say Y here if you want to enable force feedback support for DragonRise Inc. 150 Say Y here if you want to enable force feedback support for DragonRise Inc.
151 game controllers. 151 game controllers.
152 152
153config HID_EMS_FF
154 tristate "EMS Production Inc. force feedback support"
155 depends on USB_HID
156 select INPUT_FF_MEMLESS
157 ---help---
158 Say Y here if you want to enable force feedback support for devices by
159 EMS Production Ltd.
160 Currently the following devices are known to be supported:
161 - Trio Linker Plus II
162
153config HID_EGALAX 163config HID_EGALAX
154 tristate "eGalax multi-touch panel" 164 tristate "eGalax multi-touch panel"
155 depends on USB_HID 165 depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index c335605b9200..86192f67d7c2 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
35obj-$(CONFIG_HID_CHICONY) += hid-chicony.o 35obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
36obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 36obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
37obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o 37obj-$(CONFIG_HID_DRAGONRISE) += hid-drff.o
38obj-$(CONFIG_HID_EMS_FF) += hid-emsff.o
38obj-$(CONFIG_HID_EGALAX) += hid-egalax.o 39obj-$(CONFIG_HID_EGALAX) += hid-egalax.o
39obj-$(CONFIG_HID_ELECOM) += hid-elecom.o 40obj-$(CONFIG_HID_ELECOM) += hid-elecom.o
40obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 41obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 7832b6e2478b..b3393e17b375 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1301,6 +1301,7 @@ static const struct hid_device_id hid_blacklist[] = {
1301 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, 1301 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) }, 1302 { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
1303 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, 1303 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
1304 { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) },
1304 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1305 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1305 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1306 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
1306 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, 1307 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
diff --git a/drivers/hid/hid-emsff.c b/drivers/hid/hid-emsff.c
new file mode 100644
index 000000000000..c61b192d7cff
--- /dev/null
+++ b/drivers/hid/hid-emsff.c
@@ -0,0 +1,162 @@
1/*
2 * Force feedback support for EMS Trio Linker Plus II
3 *
4 * Copyright (c) 2010 Ignaz Forster <ignaz.forster@gmx.de>
5 */
6
7/*
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23
24#include <linux/hid.h>
25#include <linux/input.h>
26#include <linux/usb.h>
27
28#include "hid-ids.h"
29#include "usbhid/usbhid.h"
30
31struct emsff_device {
32 struct hid_report *report;
33};
34
35static int emsff_play(struct input_dev *dev, void *data,
36 struct ff_effect *effect)
37{
38 struct hid_device *hid = input_get_drvdata(dev);
39 struct emsff_device *emsff = data;
40 int weak, strong;
41
42 weak = effect->u.rumble.weak_magnitude;
43 strong = effect->u.rumble.strong_magnitude;
44
45 dbg_hid("called with 0x%04x 0x%04x\n", strong, weak);
46
47 weak = weak * 0xff / 0xffff;
48 strong = strong * 0xff / 0xffff;
49
50 emsff->report->field[0]->value[1] = weak;
51 emsff->report->field[0]->value[2] = strong;
52
53 dbg_hid("running with 0x%02x 0x%02x\n", strong, weak);
54 usbhid_submit_report(hid, emsff->report, USB_DIR_OUT);
55
56 return 0;
57}
58
59static int emsff_init(struct hid_device *hid)
60{
61 struct emsff_device *emsff;
62 struct hid_report *report;
63 struct hid_input *hidinput = list_first_entry(&hid->inputs,
64 struct hid_input, list);
65 struct list_head *report_list =
66 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
67 struct input_dev *dev = hidinput->input;
68 int error;
69
70 if (list_empty(report_list)) {
71 dev_err(&hid->dev, "no output reports found\n");
72 return -ENODEV;
73 }
74
75 report = list_first_entry(report_list, struct hid_report, list);
76 if (report->maxfield < 1) {
77 dev_err(&hid->dev, "no fields in the report\n");
78 return -ENODEV;
79 }
80
81 if (report->field[0]->report_count < 7) {
82 dev_err(&hid->dev, "not enough values in the field\n");
83 return -ENODEV;
84 }
85
86 emsff = kzalloc(sizeof(struct emsff_device), GFP_KERNEL);
87 if (!emsff)
88 return -ENOMEM;
89
90 set_bit(FF_RUMBLE, dev->ffbit);
91
92 error = input_ff_create_memless(dev, emsff, emsff_play);
93 if (error) {
94 kfree(emsff);
95 return error;
96 }
97
98 emsff->report = report;
99 emsff->report->field[0]->value[0] = 0x01;
100 emsff->report->field[0]->value[1] = 0x00;
101 emsff->report->field[0]->value[2] = 0x00;
102 emsff->report->field[0]->value[3] = 0x00;
103 emsff->report->field[0]->value[4] = 0x00;
104 emsff->report->field[0]->value[5] = 0x00;
105 emsff->report->field[0]->value[6] = 0x00;
106 usbhid_submit_report(hid, emsff->report, USB_DIR_OUT);
107
108 dev_info(&hid->dev, "force feedback for EMS based devices by "
109 "Ignaz Forster <ignaz.forster@gmx.de>\n");
110
111 return 0;
112}
113
114static int ems_probe(struct hid_device *hdev, const struct hid_device_id *id)
115{
116 int ret;
117
118 ret = hid_parse(hdev);
119 if (ret) {
120 dev_err(&hdev->dev, "parse failed\n");
121 goto err;
122 }
123
124 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
125 if (ret) {
126 dev_err(&hdev->dev, "hw start failed\n");
127 goto err;
128 }
129
130 emsff_init(hdev);
131
132 return 0;
133err:
134 return ret;
135}
136
137static const struct hid_device_id ems_devices[] = {
138 { HID_USB_DEVICE(USB_VENDOR_ID_EMS, 0x118) },
139 { }
140};
141MODULE_DEVICE_TABLE(hid, ems_devices);
142
143static struct hid_driver ems_driver = {
144 .name = "hkems",
145 .id_table = ems_devices,
146 .probe = ems_probe,
147};
148
149static int ems_init(void)
150{
151 return hid_register_driver(&ems_driver);
152}
153
154static void ems_exit(void)
155{
156 hid_unregister_driver(&ems_driver);
157}
158
159module_init(ems_init);
160module_exit(ems_exit);
161MODULE_LICENSE("GPL");
162
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 3ee999d33004..68114dbcd895 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -203,6 +203,9 @@
203#define USB_VENDOR_ID_ELO 0x04E7 203#define USB_VENDOR_ID_ELO 0x04E7
204#define USB_DEVICE_ID_ELO_TS2700 0x0020 204#define USB_DEVICE_ID_ELO_TS2700 0x0020
205 205
206#define USB_VENDOR_ID_EMS 0x2006
207#define USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II 0x0118
208
206#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f 209#define USB_VENDOR_ID_ESSENTIAL_REALITY 0x0d7f
207#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100 210#define USB_DEVICE_ID_ESSENTIAL_REALITY_P5 0x0100
208 211