Skip to content

Commit b653583

Browse files
cgutmanslouken
authored andcommitted
Throttle tickle reports to PS4/PS5 controllers
UpdateDevice() can be called at an arbitrary rate, so we need to pace ourselves to avoid filling up the rumble queue with these. (cherry picked from commit 6ec8b1a) (cherry picked from commit 656b599)
1 parent 5e90dd3 commit b653583

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/joystick/hidapi/SDL_hidapi_ps4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,7 @@ static SDL_bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device)
12081208
if (SDL_TICKS_PASSED(now, ctx->last_packet + BLUETOOTH_DISCONNECT_TIMEOUT_MS)) {
12091209
/* Send an empty output report to tickle the Bluetooth stack */
12101210
HIDAPI_DriverPS4_TickleBluetooth(device);
1211+
ctx->last_packet = now;
12111212
}
12121213
} else {
12131214
/* Reconnect the Bluetooth device once the USB device is gone */

src/joystick/hidapi/SDL_hidapi_ps5.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,7 @@ static SDL_bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
15001500
if (SDL_TICKS_PASSED(now, ctx->last_packet + BLUETOOTH_DISCONNECT_TIMEOUT_MS)) {
15011501
/* Send an empty output report to tickle the Bluetooth stack */
15021502
HIDAPI_DriverPS5_TickleBluetooth(device);
1503+
ctx->last_packet = now;
15031504
}
15041505
} else {
15051506
/* Reconnect the Bluetooth device once the USB device is gone */

0 commit comments

Comments
 (0)