aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-09-18 13:43:32 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:51:00 -0400
commit5f022298aab58ddff9bccdb28b82a59109789da9 (patch)
tree08d87903b7a15c465a0b21cb7bdb7a30e9226cf3 /drivers/hid/usbhid
parent2b107d629dc0c35de606bb7b010b829cd247a93a (diff)
HID: move pantherlord FF processing
Move the force feedback processing into a separate module. [jkosina@suse.cz: fix Kconfig texts a little bit] Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r--drivers/hid/usbhid/Kconfig8
-rw-r--r--drivers/hid/usbhid/Makefile3
-rw-r--r--drivers/hid/usbhid/hid-ff.c4
-rw-r--r--drivers/hid/usbhid/hid-plff.c139
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
5 files changed, 0 insertions, 155 deletions
diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig
index 0e7e2e6d975e..02c8228ed7ee 100644
--- a/drivers/hid/usbhid/Kconfig
+++ b/drivers/hid/usbhid/Kconfig
@@ -44,14 +44,6 @@ config HID_PID
44 feedback for it. Microsoft Sidewinder Force Feedback 2 is one of such 44 feedback for it. Microsoft Sidewinder Force Feedback 2 is one of such
45 devices. 45 devices.
46 46
47config PANTHERLORD_FF
48 bool "PantherLord/GreenAsia based device support"
49 depends on HID_FF
50 select INPUT_FF_MEMLESS if USB_HID
51 help
52 Say Y here if you have a PantherLord/GreenAsia based game controller
53 or adapter and want to enable force feedback support for it.
54
55config THRUSTMASTER_FF 47config THRUSTMASTER_FF
56 bool "ThrustMaster devices support" 48 bool "ThrustMaster devices support"
57 depends on HID_FF 49 depends on HID_FF
diff --git a/drivers/hid/usbhid/Makefile b/drivers/hid/usbhid/Makefile
index 224c62dc6a32..0ee4803375b2 100644
--- a/drivers/hid/usbhid/Makefile
+++ b/drivers/hid/usbhid/Makefile
@@ -13,9 +13,6 @@ endif
13ifeq ($(CONFIG_HID_PID),y) 13ifeq ($(CONFIG_HID_PID),y)
14 usbhid-objs += hid-pidff.o 14 usbhid-objs += hid-pidff.o
15endif 15endif
16ifeq ($(CONFIG_PANTHERLORD_FF),y)
17 usbhid-objs += hid-plff.o
18endif
19ifeq ($(CONFIG_THRUSTMASTER_FF),y) 16ifeq ($(CONFIG_THRUSTMASTER_FF),y)
20 usbhid-objs += hid-tmff.o 17 usbhid-objs += hid-tmff.o
21endif 18endif
diff --git a/drivers/hid/usbhid/hid-ff.c b/drivers/hid/usbhid/hid-ff.c
index 8891f60d3beb..a868eef06189 100644
--- a/drivers/hid/usbhid/hid-ff.c
+++ b/drivers/hid/usbhid/hid-ff.c
@@ -50,10 +50,6 @@ struct hid_ff_initializer {
50 * be a PID device 50 * be a PID device
51 */ 51 */
52static struct hid_ff_initializer inits[] = { 52static struct hid_ff_initializer inits[] = {
53#ifdef CONFIG_PANTHERLORD_FF
54 { 0x810, 0x0001, hid_plff_init }, /* "Twin USB Joystick" */
55 { 0xe8f, 0x0003, hid_plff_init }, /* "GreenAsia Inc. USB Joystick " */
56#endif
57#ifdef CONFIG_THRUSTMASTER_FF 53#ifdef CONFIG_THRUSTMASTER_FF
58 { 0x44f, 0xb300, hid_tmff_init }, 54 { 0x44f, 0xb300, hid_tmff_init },
59 { 0x44f, 0xb304, hid_tmff_init }, 55 { 0x44f, 0xb304, hid_tmff_init },
diff --git a/drivers/hid/usbhid/hid-plff.c b/drivers/hid/usbhid/hid-plff.c
deleted file mode 100644
index 9eb83cf9d22b..000000000000
--- a/drivers/hid/usbhid/hid-plff.c
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 * Force feedback support for PantherLord/GreenAsia based devices
3 *
4 * The devices are distributed under various names and the same USB device ID
5 * can be used in both adapters and actual game controllers.
6 *
7 * 0810:0001 "Twin USB Joystick"
8 * - tested with PantherLord USB/PS2 2in1 Adapter
9 * - contains two reports, one for each port (HID_QUIRK_MULTI_INPUT)
10 *
11 * 0e8f:0003 "GreenAsia Inc. USB Joystick "
12 * - tested with Köng Gaming gamepad
13 *
14 * Copyright (c) 2007 Anssi Hannula <anssi.hannula@gmail.com>
15 */
16
17/*
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 */
32
33
34/* #define DEBUG */
35
36#define debug(format, arg...) pr_debug("hid-plff: " format "\n" , ## arg)
37
38#include <linux/input.h>
39#include <linux/usb.h>
40#include <linux/hid.h>
41#include "usbhid.h"
42
43struct plff_device {
44 struct hid_report *report;
45};
46
47static int hid_plff_play(struct input_dev *dev, void *data,
48 struct ff_effect *effect)
49{
50 struct hid_device *hid = input_get_drvdata(dev);
51 struct plff_device *plff = data;
52 int left, right;
53
54 left = effect->u.rumble.strong_magnitude;
55 right = effect->u.rumble.weak_magnitude;
56 debug("called with 0x%04x 0x%04x", left, right);
57
58 left = left * 0x7f / 0xffff;
59 right = right * 0x7f / 0xffff;
60
61 plff->report->field[0]->value[2] = left;
62 plff->report->field[0]->value[3] = right;
63 debug("running with 0x%02x 0x%02x", left, right);
64 usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
65
66 return 0;
67}
68
69int hid_plff_init(struct hid_device *hid)
70{
71 struct plff_device *plff;
72 struct hid_report *report;
73 struct hid_input *hidinput;
74 struct list_head *report_list =
75 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
76 struct list_head *report_ptr = report_list;
77 struct input_dev *dev;
78 int error;
79
80 /* The device contains one output report per physical device, all
81 containing 1 field, which contains 4 ff00.0002 usages and 4 16bit
82 absolute values.
83
84 The input reports also contain a field which contains
85 8 ff00.0001 usages and 8 boolean values. Their meaning is
86 currently unknown. */
87
88 if (list_empty(report_list)) {
89 printk(KERN_ERR "hid-plff: no output reports found\n");
90 return -ENODEV;
91 }
92
93 list_for_each_entry(hidinput, &hid->inputs, list) {
94
95 report_ptr = report_ptr->next;
96
97 if (report_ptr == report_list) {
98 printk(KERN_ERR "hid-plff: required output report is missing\n");
99 return -ENODEV;
100 }
101
102 report = list_entry(report_ptr, struct hid_report, list);
103 if (report->maxfield < 1) {
104 printk(KERN_ERR "hid-plff: no fields in the report\n");
105 return -ENODEV;
106 }
107
108 if (report->field[0]->report_count < 4) {
109 printk(KERN_ERR "hid-plff: not enough values in the field\n");
110 return -ENODEV;
111 }
112
113 plff = kzalloc(sizeof(struct plff_device), GFP_KERNEL);
114 if (!plff)
115 return -ENOMEM;
116
117 dev = hidinput->input;
118
119 set_bit(FF_RUMBLE, dev->ffbit);
120
121 error = input_ff_create_memless(dev, plff, hid_plff_play);
122 if (error) {
123 kfree(plff);
124 return error;
125 }
126
127 plff->report = report;
128 plff->report->field[0]->value[0] = 0x00;
129 plff->report->field[0]->value[1] = 0x00;
130 plff->report->field[0]->value[2] = 0x00;
131 plff->report->field[0]->value[3] = 0x00;
132 usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
133 }
134
135 printk(KERN_INFO "hid-plff: Force feedback for PantherLord/GreenAsia "
136 "devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
137
138 return 0;
139}
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index d40f00904c5e..47ebe045f9b5 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -32,7 +32,6 @@ static const struct hid_blacklist {
32 { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, 32 { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD },
33 { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, 33 { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD },
34 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, 34 { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD },
35 { USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR, HID_QUIRK_MULTI_INPUT },
36 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, 35 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
37 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, 36 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
38 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, 37 { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FIGHTING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },