24 #include <linux/hid.h>
25 #include <linux/input.h>
26 #include <linux/slab.h>
28 #include <linux/module.h>
32 #ifdef CONFIG_ZEROPLUS_FF
39 static int zpff_play(
struct input_dev *
dev,
void *
data,
42 struct hid_device *hid = input_get_drvdata(dev);
43 struct zpff_device *zpff =
data;
52 left = effect->
u.
rumble.strong_magnitude;
53 right = effect->
u.
rumble.weak_magnitude;
54 dbg_hid(
"called with 0x%04x 0x%04x\n", left, right);
56 left = left * 0x7f / 0xffff;
57 right = right * 0x7f / 0xffff;
59 zpff->report->field[2]->value[0] =
left;
60 zpff->report->field[3]->value[0] =
right;
61 dbg_hid(
"running with 0x%02x 0x%02x\n", left, right);
69 struct zpff_device *zpff;
75 struct input_dev *
dev = hidinput->
input;
78 if (list_empty(report_list)) {
79 hid_err(hid,
"no output report found\n");
86 hid_err(hid,
"not enough fields in report\n");
90 zpff = kzalloc(
sizeof(
struct zpff_device),
GFP_KERNEL);
103 zpff->report->field[0]->value[0] = 0x00;
104 zpff->report->field[1]->value[0] = 0x02;
105 zpff->report->field[2]->value[0] = 0x00;
106 zpff->report->field[3]->value[0] = 0x00;
114 static inline int zpff_init(
struct hid_device *hid)
124 ret = hid_parse(hdev);
126 hid_err(hdev,
"parse failed\n");
132 hid_err(hdev,
"hw start failed\n");
152 .id_table = zp_devices,
156 static int __init zp_init(
void)
161 static void __exit zp_exit(
void)