39 #define debug(format, arg...) pr_debug("hid-plff: " format "\n" , ## arg)
41 #include <linux/input.h>
42 #include <linux/slab.h>
43 #include <linux/module.h>
45 #include <linux/hid.h>
49 #ifdef CONFIG_PANTHERLORD_FF
58 static int hid_plff_play(
struct input_dev *
dev,
void *
data,
61 struct hid_device *hid = input_get_drvdata(dev);
62 struct plff_device *plff =
data;
65 left = effect->
u.
rumble.strong_magnitude;
66 right = effect->
u.
rumble.weak_magnitude;
67 debug(
"called with 0x%04x 0x%04x", left, right);
69 left = left * 0x7f / 0xffff;
70 right = right * 0x7f / 0xffff;
74 debug(
"running with 0x%02x 0x%02x", left, right);
82 struct plff_device *plff;
87 struct list_head *report_ptr = report_list;
88 struct input_dev *
dev;
106 if (list_empty(report_list)) {
107 hid_err(hid,
"no output reports found\n");
113 report_ptr = report_ptr->
next;
115 if (report_ptr == report_list) {
116 hid_err(hid,
"required output report is missing\n");
122 hid_err(hid,
"no fields in the report\n");
126 if (report->
field[0]->report_count >= 4) {
127 report->
field[0]->value[0] = 0x00;
128 report->
field[0]->value[1] = 0x00;
129 strong = &report->
field[0]->value[2];
130 weak = &report->
field[0]->value[3];
131 debug(
"detected single-field device");
132 }
else if (report->
maxfield >= 4 && report->
field[0]->maxusage == 1 &&
134 report->
field[0]->value[0] = 0x00;
135 report->
field[1]->value[0] = 0x00;
136 strong = &report->
field[2]->value[0];
137 weak = &report->
field[3]->value[0];
138 debug(
"detected 4-field device");
140 hid_err(hid,
"not enough fields or values\n");
144 plff = kzalloc(
sizeof(
struct plff_device),
GFP_KERNEL);
148 dev = hidinput->
input;
159 plff->strong = strong;
172 static inline int plff_init(
struct hid_device *hid)
185 ret = hid_parse(hdev);
187 hid_err(hdev,
"parse failed\n");
193 hid_err(hdev,
"hw start failed\n");
215 .name =
"pantherlord",
216 .id_table = pl_devices,
220 static int __init pl_init(
void)
225 static void __exit pl_exit(
void)