30 #include <linux/input.h>
31 #include <linux/slab.h>
33 #include <linux/hid.h>
34 #include <linux/module.h>
37 #ifdef CONFIG_GREENASIA_FF
44 static int hid_gaff_play(
struct input_dev *
dev,
void *
data,
47 struct hid_device *hid = input_get_drvdata(dev);
48 struct gaff_device *gaff =
data;
51 left = effect->
u.
rumble.strong_magnitude;
52 right = effect->
u.
rumble.weak_magnitude;
54 dbg_hid(
"called with 0x%04x 0x%04x", left, right);
56 left = left * 0xfe / 0xffff;
57 right = right * 0xfe / 0xffff;
59 gaff->report->field[0]->value[0] = 0x51;
60 gaff->report->field[0]->value[1] = 0x0;
61 gaff->report->field[0]->value[2] =
right;
62 gaff->report->field[0]->value[3] = 0;
63 gaff->report->field[0]->value[4] =
left;
64 gaff->report->field[0]->value[5] = 0;
65 dbg_hid(
"running with 0x%02x 0x%02x", left, right);
68 gaff->report->field[0]->value[0] = 0xfa;
69 gaff->report->field[0]->value[1] = 0xfe;
70 gaff->report->field[0]->value[2] = 0x0;
71 gaff->report->field[0]->value[4] = 0x0;
80 struct gaff_device *gaff;
86 struct list_head *report_ptr = report_list;
87 struct input_dev *
dev = hidinput->
input;
90 if (list_empty(report_list)) {
91 hid_err(hid,
"no output reports found\n");
95 report_ptr = report_ptr->
next;
99 hid_err(hid,
"no fields in the report\n");
103 if (report->
field[0]->report_count < 6) {
104 hid_err(hid,
"not enough values in the field\n");
108 gaff = kzalloc(
sizeof(
struct gaff_device),
GFP_KERNEL);
121 gaff->report->field[0]->value[0] = 0x51;
122 gaff->report->field[0]->value[1] = 0x00;
123 gaff->report->field[0]->value[2] = 0x00;
124 gaff->report->field[0]->value[3] = 0x00;
127 gaff->report->field[0]->value[0] = 0xfa;
128 gaff->report->field[0]->value[1] = 0xfe;
137 static inline int gaff_init(
struct hid_device *hdev)
147 dev_dbg(&hdev->
dev,
"Greenasia HID hardware probe...");
149 ret = hid_parse(hdev);
151 hid_err(hdev,
"parse failed\n");
157 hid_err(hdev,
"hw start failed\n");
176 .id_table = ga_devices,
180 static int __init ga_init(
void)
185 static void __exit ga_exit(
void)