Source
22
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
23
* GNU General Public License for more details.
24
24
*
25
25
* You should have received a copy of the GNU General Public License
26
26
* along with this program; if not, write to the Free Software
27
27
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
28
*/
29
29
30
30
#include <linux/input.h>
31
31
#include <linux/slab.h>
32
-
#include <linux/usb.h>
33
32
#include <linux/hid.h>
34
33
#include <linux/module.h>
35
34
#include "hid-ids.h"
36
35
37
36
#ifdef CONFIG_GREENASIA_FF
38
-
#include "usbhid/usbhid.h"
39
37
40
38
struct gaff_device {
41
39
struct hid_report *report;
42
40
};
43
41
44
42
static int hid_gaff_play(struct input_dev *dev, void *data,
45
43
struct ff_effect *effect)
46
44
{
47
45
struct hid_device *hid = input_get_drvdata(dev);
48
46
struct gaff_device *gaff = data;
56
54
left = left * 0xfe / 0xffff;
57
55
right = right * 0xfe / 0xffff;
58
56
59
57
gaff->report->field[0]->value[0] = 0x51;
60
58
gaff->report->field[0]->value[1] = 0x0;
61
59
gaff->report->field[0]->value[2] = right;
62
60
gaff->report->field[0]->value[3] = 0;
63
61
gaff->report->field[0]->value[4] = left;
64
62
gaff->report->field[0]->value[5] = 0;
65
63
dbg_hid("running with 0x%02x 0x%02x", left, right);
66
-
usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
64
+
hid_hw_request(hid, gaff->report, HID_REQ_SET_REPORT);
67
65
68
66
gaff->report->field[0]->value[0] = 0xfa;
69
67
gaff->report->field[0]->value[1] = 0xfe;
70
68
gaff->report->field[0]->value[2] = 0x0;
71
69
gaff->report->field[0]->value[4] = 0x0;
72
70
73
-
usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
71
+
hid_hw_request(hid, gaff->report, HID_REQ_SET_REPORT);
74
72
75
73
return 0;
76
74
}
77
75
78
76
static int gaff_init(struct hid_device *hid)
79
77
{
80
78
struct gaff_device *gaff;
81
79
struct hid_report *report;
82
80
struct hid_input *hidinput = list_entry(hid->inputs.next,
83
81
struct hid_input, list);
115
113
if (error) {
116
114
kfree(gaff);
117
115
return error;
118
116
}
119
117
120
118
gaff->report = report;
121
119
gaff->report->field[0]->value[0] = 0x51;
122
120
gaff->report->field[0]->value[1] = 0x00;
123
121
gaff->report->field[0]->value[2] = 0x00;
124
122
gaff->report->field[0]->value[3] = 0x00;
125
-
usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
123
+
hid_hw_request(hid, gaff->report, HID_REQ_SET_REPORT);
126
124
127
125
gaff->report->field[0]->value[0] = 0xfa;
128
126
gaff->report->field[0]->value[1] = 0xfe;
129
127
130
-
usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
128
+
hid_hw_request(hid, gaff->report, HID_REQ_SET_REPORT);
131
129
132
130
hid_info(hid, "Force Feedback for GreenAsia 0x12 devices by Lukasz Lubojanski <lukasz@lubojanski.info>\n");
133
131
134
132
return 0;
135
133
}
136
134
#else
137
135
static inline int gaff_init(struct hid_device *hdev)
138
136
{
139
137
return 0;
140
138
}