mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-04 17:06:25 +00:00
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.
This commit is contained in:

committed by
Sam Lantinga

parent
53bf2baac3
commit
6ec8b1a173
@@ -1307,6 +1307,7 @@ static bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device)
|
|||||||
if (now >= (ctx->last_packet + BLUETOOTH_DISCONNECT_TIMEOUT_MS)) {
|
if (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
|
||||||
|
@@ -1553,6 +1553,7 @@ static bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
|
|||||||
if (now >= (ctx->last_packet + BLUETOOTH_DISCONNECT_TIMEOUT_MS)) {
|
if (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
|
||||||
|
Reference in New Issue
Block a user