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 commit6ec8b1a173
) (cherry picked from commit656b599828
)
This commit is contained in:
parent
5e90dd3507
commit
b6535836aa
2 changed files with 2 additions and 0 deletions
|
@ -1208,6 +1208,7 @@ static SDL_bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device)
|
||||||
if (SDL_TICKS_PASSED(now, ctx->last_packet + BLUETOOTH_DISCONNECT_TIMEOUT_MS)) {
|
if (SDL_TICKS_PASSED(now, ctx->last_packet + BLUETOOTH_DISCONNECT_TIMEOUT_MS)) {
|
||||||
/* Send an empty output report to tickle the Bluetooth stack */
|
/* Send an empty output report to tickle the Bluetooth stack */
|
||||||
HIDAPI_DriverPS4_TickleBluetooth(device);
|
HIDAPI_DriverPS4_TickleBluetooth(device);
|
||||||
|
ctx->last_packet = now;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Reconnect the Bluetooth device once the USB device is gone */
|
/* Reconnect the Bluetooth device once the USB device is gone */
|
||||||
|
|
|
@ -1500,6 +1500,7 @@ static SDL_bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
|
||||||
if (SDL_TICKS_PASSED(now, ctx->last_packet + BLUETOOTH_DISCONNECT_TIMEOUT_MS)) {
|
if (SDL_TICKS_PASSED(now, ctx->last_packet + BLUETOOTH_DISCONNECT_TIMEOUT_MS)) {
|
||||||
/* Send an empty output report to tickle the Bluetooth stack */
|
/* Send an empty output report to tickle the Bluetooth stack */
|
||||||
HIDAPI_DriverPS5_TickleBluetooth(device);
|
HIDAPI_DriverPS5_TickleBluetooth(device);
|
||||||
|
ctx->last_packet = now;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Reconnect the Bluetooth device once the USB device is gone */
|
/* Reconnect the Bluetooth device once the USB device is gone */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue