30 #include <linux/input.h>
31 #include <linux/slab.h>
33 #include <linux/hid.h>
34 #include <linux/module.h>
38 #ifdef CONFIG_HID_ACRUX_FF
45 static int axff_play(
struct input_dev *
dev,
void *
data,
struct ff_effect *effect)
47 struct hid_device *hid = input_get_drvdata(dev);
48 struct axff_device *axff =
data;
54 left = effect->
u.
rumble.strong_magnitude;
55 right = effect->
u.
rumble.weak_magnitude;
57 dbg_hid(
"called with 0x%04x 0x%04x", left, right);
59 left = left * 0xff / 0xffff;
60 right = right * 0xff / 0xffff;
62 for (i = 0; i < report->
maxfield; i++) {
63 for (j = 0; j < report->
field[
i]->report_count; j++) {
65 field_count % 2 ? right :
left;
70 dbg_hid(
"running with 0x%02x 0x%02x", left, right);
78 struct axff_device *axff;
82 struct input_dev *dev = hidinput->
input;
87 if (list_empty(report_list)) {
88 hid_err(hid,
"no output reports found\n");
93 for (i = 0; i < report->
maxfield; i++) {
94 for (j = 0; j < report->
field[
i]->report_count; j++) {
95 report->
field[
i]->value[
j] = 0x00;
100 if (field_count < 4) {
101 hid_err(hid,
"not enough fields in the report: %d\n",
106 axff = kzalloc(
sizeof(
struct axff_device),
GFP_KERNEL);
128 static inline int axff_init(
struct hid_device *hid)
138 dev_dbg(&hdev->
dev,
"ACRUX HID hardware probe...\n");
140 error = hid_parse(hdev);
142 hid_err(hdev,
"parse failed\n");
148 hid_err(hdev,
"hw start failed\n");
152 error = axff_init(hdev);
159 "Failed to enable force feedback support, error: %d\n",
167 error = hid_hw_open(hdev);
177 static void ax_remove(
struct hid_device *hdev)
191 .id_table = ax_devices,
196 static int __init ax_init(
void)
201 static void __exit ax_exit(
void)