summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCameron Gutman <aicommander@gmail.com>2016-11-27 20:37:56 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-01 09:44:22 +0100
commitcf82f5ff44828f5bf8ec808962130600e00f5117 (patch)
tree6dd7e8f897ed903c350ab361acdc3e78945e7cc4
parentd6418e12132768320ed571b1f3e47cd8d8ae466b (diff)
downloadlinux-stable-cf82f5ff44828f5bf8ec808962130600e00f5117.tar.gz
linux-stable-cf82f5ff44828f5bf8ec808962130600e00f5117.tar.bz2
linux-stable-cf82f5ff44828f5bf8ec808962130600e00f5117.zip
Input: xpad - fix Xbox One rumble stopping after 2.5 secs
[ Upstream commit ae3b4469dbcd3b842a9fd20940946e4d092d8731 ] Unlike previous Xbox pads, the Xbox One pad doesn't have "sticky" rumble packets. The duration is encoded into the command and expiration is handled by the pad firmware. ff-memless needs pseudo-sticky behavior for rumble effects to behave properly for long duration effects. We already specify the maximum rumble on duration in the command packets, but it's still only good for about 2.5 seconds of rumble. This is easily reproducible running fftest's sine vibration test. It turns out there's a repeat count encoded in the rumble command. We can abuse that to get the pseudo-sticky behavior needed for rumble to behave as expected for effects with long duration. By my math, this change should allow a single ff_effect to rumble for 10 minutes straight, which should be more than enough for most needs. Signed-off-by: Cameron Gutman <aicommander@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/input/joystick/xpad.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 4dc8befc92e4..b9f48d4e155a 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -1047,9 +1047,9 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
packet->data[7] = 0x00;
packet->data[8] = strong / 512; /* left actuator */
packet->data[9] = weak / 512; /* right actuator */
- packet->data[10] = 0xFF;
- packet->data[11] = 0x00;
- packet->data[12] = 0x00;
+ packet->data[10] = 0xFF; /* on period */
+ packet->data[11] = 0x00; /* off period */
+ packet->data[12] = 0xFF; /* repeat count */
packet->len = 13;
packet->pending = true;
break;