Message ID | 1396962367-6469-1-git-send-email-elias.vds@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Jiri Kosina |
Headers | show |
Since this patch haven't been applied yet, I withdraw this patch for the following reason: It will get in as a part of the move to ff-memless-next. Elias -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 9 Apr 2014, Elias Vanderstuyft wrote: > Since this patch haven't been applied yet, I withdraw this patch for > the following reason: > It will get in as a part of the move to ff-memless-next. Okay, I am ignoring it for now. Thanks,
diff --git a/drivers/hid/hid-lg2ff.c b/drivers/hid/hid-lg2ff.c index 0e3fb1a..e180e1e 100644 --- a/drivers/hid/hid-lg2ff.c +++ b/drivers/hid/hid-lg2ff.c @@ -38,12 +38,17 @@ static int play_effect(struct input_dev *dev, void *data, struct lg2ff_device *lg2ff = data; int weak, strong; +#define CLAMP_QUIRK(x) do { if (x < 2) x = 2; else if (x > 0xfd) x = 0xfd; } \ + while (0) + strong = effect->u.rumble.strong_magnitude; weak = effect->u.rumble.weak_magnitude; if (weak || strong) { weak = weak * 0xff / 0xffff; strong = strong * 0xff / 0xffff; + CLAMP_QUIRK(weak); + CLAMP_QUIRK(strong); lg2ff->report->field[0]->value[0] = 0x51; lg2ff->report->field[0]->value[2] = weak;