From 414ae344afbf55d8389914402e4605c6f305b048 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 6 Sep 2025 11:52:48 -0700 Subject: [PATCH] Fixed rumble strength on DualSense Edge and Bluetooth connected controllers Fixes https://github.com/libsdl-org/SDL/issues/13771 (cherry picked from commit 25d9096d41931f67add5dceefb587a8d7e51e0a2) --- src/joystick/hidapi/SDL_hidapi_ps5.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c index 4249578e80..3c2bf96a6f 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps5.c +++ b/src/joystick/hidapi/SDL_hidapi_ps5.c @@ -251,6 +251,7 @@ typedef struct Uint64 last_packet; int player_index; bool player_lights; + bool enhanced_rumble; Uint8 rumble_left; Uint8 rumble_right; bool color_set; @@ -432,6 +433,14 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device) } } + if (device->vendor_id == USB_VENDOR_SONY) { + if (device->product_id == USB_PRODUCT_SONY_DS5_EDGE || + ctx->firmware_version == 0 || // Assume that it's updated firmware over Bluetooth + ctx->firmware_version >= 0x0224) { + ctx->enhanced_rumble = true; + } + } + // Get the device capabilities if (device->vendor_id == USB_VENDOR_SONY) { ctx->sensors_supported = true; @@ -684,17 +693,17 @@ static bool HIDAPI_DriverPS5_UpdateEffects(SDL_DriverPS5_Context *ctx, int effec if (ctx->vibration_supported) { if (ctx->rumble_left || ctx->rumble_right) { - if (ctx->firmware_version < 0x0224) { + if (ctx->enhanced_rumble) { + effects.ucEnableBits3 |= 0x04; // Enable improved rumble emulation on 2.24 firmware and newer + + effects.ucRumbleLeft = ctx->rumble_left; + effects.ucRumbleRight = ctx->rumble_right; + } else { effects.ucEnableBits1 |= 0x01; // Enable rumble emulation // Shift to reduce effective rumble strength to match Xbox controllers effects.ucRumbleLeft = ctx->rumble_left >> 1; effects.ucRumbleRight = ctx->rumble_right >> 1; - } else { - effects.ucEnableBits3 |= 0x04; // Enable improved rumble emulation on 2.24 firmware and newer - - effects.ucRumbleLeft = ctx->rumble_left; - effects.ucRumbleRight = ctx->rumble_right; } effects.ucEnableBits1 |= 0x02; // Disable audio haptics } else {