Input: hid-lgff - treat devices as joysticks unless told otherwise
By default threat devices as joysticks with constant force-feedback
effect.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
diff --git a/drivers/usb/input/hid-lgff.c b/drivers/usb/input/hid-lgff.c
index d1a4dff..e6f3af3 100644
--- a/drivers/usb/input/hid-lgff.c
+++ b/drivers/usb/input/hid-lgff.c
@@ -55,7 +55,6 @@
{ 0x046d, 0xc294, ff_joystick },
{ 0x046d, 0xc295, ff_joystick },
{ 0x046d, 0xca03, ff_joystick },
- { 0x0000, 0x0000, ff_joystick }
};
static int hid_lgff_play(struct input_dev *dev, void *data, struct ff_effect *effect)
@@ -107,8 +106,9 @@
struct input_dev *dev = hidinput->input;
struct hid_report *report;
struct hid_field *field;
+ const signed short *ff_bits = ff_joystick;
int error;
- int i, j;
+ int i;
/* Find the report to use */
if (list_empty(report_list)) {
@@ -132,12 +132,14 @@
for (i = 0; i < ARRAY_SIZE(devices); i++) {
if (dev->id.vendor == devices[i].idVendor &&
dev->id.product == devices[i].idProduct) {
- for (j = 0; devices[i].ff[j] >= 0; j++)
- set_bit(devices[i].ff[j], dev->ffbit);
+ ff_bits = devices[i].ff;
break;
}
}
+ for (i = 0; ff_bits[i] >= 0; i++)
+ set_bit(ff_bits[i], dev->ffbit);
+
error = input_ff_create_memless(dev, NULL, hid_lgff_play);
if (error)
return error;