29 #include <linux/input.h>
30 #include <linux/slab.h>
32 #include <linux/hid.h>
33 #include <linux/module.h>
36 #ifdef CONFIG_SMARTJOYPLUS_FF
39 struct sjoyff_device {
43 static int hid_sjoyff_play(
struct input_dev *
dev,
void *
data,
46 struct hid_device *hid = input_get_drvdata(dev);
47 struct sjoyff_device *sjoyff =
data;
50 left = effect->
u.
rumble.strong_magnitude;
51 right = effect->
u.
rumble.weak_magnitude;
52 dev_dbg(&dev->dev,
"called with 0x%08x 0x%08x\n", left, right);
54 left = left * 0xff / 0xffff;
57 sjoyff->report->field[0]->value[1] =
right;
58 sjoyff->report->field[0]->value[2] =
left;
59 dev_dbg(&dev->dev,
"running with 0x%02x 0x%02x\n", left, right);
67 struct sjoyff_device *sjoyff;
72 struct list_head *report_ptr = report_list;
73 struct input_dev *
dev;
76 if (list_empty(report_list)) {
77 hid_err(hid,
"no output reports found\n");
82 report_ptr = report_ptr->
next;
84 if (report_ptr == report_list) {
85 hid_err(hid,
"required output report is missing\n");
91 hid_err(hid,
"no fields in the report\n");
95 if (report->
field[0]->report_count < 3) {
96 hid_err(hid,
"not enough values in the field\n");
100 sjoyff = kzalloc(
sizeof(
struct sjoyff_device),
GFP_KERNEL);
104 dev = hidinput->
input;
115 sjoyff->report->field[0]->value[0] = 0x01;
116 sjoyff->report->field[0]->value[1] = 0x00;
117 sjoyff->report->field[0]->value[2] = 0x00;
121 hid_info(hid,
"Force feedback for SmartJoy PLUS PS2/USB adapter\n");
126 static inline int sjoyff_init(
struct hid_device *hid)
136 hdev->
quirks |=
id->driver_data;
138 ret = hid_parse(hdev);
140 hid_err(hdev,
"parse failed\n");
146 hid_err(hdev,
"hw start failed\n");
176 .name =
"smartjoyplus",
177 .id_table = sjoy_devices,
181 static int __init sjoy_init(
void)
186 static void __exit sjoy_exit(
void)