Skip to content

Commit 2933aa8

Browse files
Max StaudtJiri Kosina
authored andcommitted
HID: hid-playstation: DS4: Update rumble and lightbar together
Some 3rd party gamepads expect updates to rumble and lightbar together, and setting one may cancel the other. Let's maximise compatibility by always sending rumble and lightbar updates together, even when only one has been scheduled. Further background reading: - Apparently the PS4 always sends rumble and lightbar updates together: https://eleccelerator.com/wiki/index.php?title=DualShock_4#0x11_2 - 3rd party gamepads may not implement lightbar_blink, and may simply ignore updates with 0x07 set, according to: Ryochan7/DS4Windows#1839 [[email protected]: fix shortlog] Acked-by: Roderick Colenbrander <[email protected]> Signed-off-by: Max Staudt <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 6e44365 commit 2933aa8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/hid/hid-playstation.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,26 @@ static void dualshock4_output_worker(struct work_struct *work)
21432143

21442144
spin_lock_irqsave(&ds4->base.lock, flags);
21452145

2146+
/*
2147+
* Some 3rd party gamepads expect updates to rumble and lightbar
2148+
* together, and setting one may cancel the other.
2149+
*
2150+
* Let's maximise compatibility by always sending rumble and lightbar
2151+
* updates together, even when only one has been scheduled, resulting
2152+
* in:
2153+
*
2154+
* ds4->valid_flag0 >= 0x03
2155+
*
2156+
* Hopefully this will maximise compatibility with third-party pads.
2157+
*
2158+
* Any further update bits, such as 0x04 for lightbar blinking, will
2159+
* be or'd on top of this like before.
2160+
*/
2161+
if (ds4->update_rumble || ds4->update_lightbar) {
2162+
ds4->update_rumble = true; /* 0x01 */
2163+
ds4->update_lightbar = true; /* 0x02 */
2164+
}
2165+
21462166
if (ds4->update_rumble) {
21472167
/* Select classic rumble style haptics and enable it. */
21482168
common->valid_flag0 |= DS4_OUTPUT_VALID_FLAG0_MOTOR;

0 commit comments

Comments
 (0)