# SDL: Joystick: Add trigger rumble resend (3a8f1)

**URL:** <https://discourse.libsdl.org/t/sdl-joystick-add-trigger-rumble-resend-3a8f1/59351>\
**Category:** SDL Commits\
**Created:** [April 24, 2025, 3:49pm UTC](https://discourse.libsdl.org/t/sdl-joystick-add-trigger-rumble-resend-3a8f1/59351 "2025-04-24T15:49:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [April 24, 2025, 3:49pm UTC](https://discourse.libsdl.org/t/sdl-joystick-add-trigger-rumble-resend-3a8f1/59351/1 "2025-04-24T15:49:55Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/3a8f1cb7c5f3b83252b4a68533e5652e1d7cb507>
>
> This was already present for regular rumble to ensure that controllers would
> con…tinue rumbling for extended periods, but was missing for trigger rumble. I
> don't know if this affects any controllers at the moment, but it's helpful for
> future-proofing.
> 
> (cherry picked from commit ceb9fecfc1c52f53cbf7d1c0f97dde9a949878c7)

```diff
From 3a8f1cb7c5f3b83252b4a68533e5652e1d7cb507 Mon Sep 17 00:00:00 2001
From: Vicki Pfau <[EMAIL REDACTED]>
Date: Wed, 23 Apr 2025 17:20:05 -0700
Subject: [PATCH] Joystick: Add trigger rumble resend

This was already present for regular rumble to ensure that controllers would
continue rumbling for extended periods, but was missing for trigger rumble. I
don't know if this affects any controllers at the moment, but it's helpful for
future-proofing.

(cherry picked from commit ceb9fecfc1c52f53cbf7d1c0f97dde9a949878c7)
---
 src/joystick/SDL_joystick.c | 18 ++++++++++++++++++
 src/joystick/SDL_sysjoystick.h | 1 +
 2 files changed, 19 insertions(+)

diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index c4599717f4f34..853f25b66ae79 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -1817,6 +1817,14 @@ bool SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint
             result = true;
         } else {
             result = joystick->driver->RumbleTriggers(joystick, left_rumble, right_rumble);
+ if (result) {
+ joystick->trigger_rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS;
+ if (joystick->trigger_rumble_resend == 0) {
+ joystick->trigger_rumble_resend = 1;
+ }
+ } else {
+ joystick->trigger_rumble_resend = 0;
+ }
         }
 
         if (result) {
@@ -1827,6 +1835,7 @@ bool SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint
                 joystick->trigger_rumble_expiration = SDL_GetTicks() + SDL_min(duration_ms, SDL_MAX_RUMBLE_DURATION_MS);
             } else {
                 joystick->trigger_rumble_expiration = 0;
+ joystick->trigger_rumble_resend = 0;
             }
         }
     }
@@ -2481,6 +2490,15 @@ void SDL_UpdateJoysticks(void)
 
         if (joystick->trigger_rumble_expiration && now >= joystick->trigger_rumble_expiration) {
             SDL_RumbleJoystickTriggers(joystick, 0, 0, 0);
+ joystick->trigger_rumble_resend = 0;
+ }
+
+ if (joystick->trigger_rumble_resend && now >= joystick->trigger_rumble_resend) {
+ joystick->driver->RumbleTriggers(joystick, joystick->left_trigger_rumble, joystick->right_trigger_rumble);
+ joystick->trigger_rumble_resend = now + SDL_RUMBLE_RESEND_MS;
+ if (joystick->trigger_rumble_resend == 0) {
+ joystick->trigger_rumble_resend = 1;
+ }
         }
     }
 
diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h
index f8f2d1af842ce..041ebc3b50903 100644
--- a/src/joystick/SDL_sysjoystick.h
+++ b/src/joystick/SDL_sysjoystick.h
@@ -113,6 +113,7 @@ struct SDL_Joystick
     Uint16 left_trigger_rumble _guarded;
     Uint16 right_trigger_rumble _guarded;
     Uint64 trigger_rumble_expiration _guarded;
+ Uint64 trigger_rumble_resend _guarded;
 
     Uint8 led_red _guarded;
     Uint8 led_green _guarded;

```
