From c3ecb9d099738e4e9e8bc09583e9debfb91018c5 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 2 Sep 2022 08:48:36 -0700
Subject: [PATCH] Wii: re-request the status if we get a communication error
---
src/joystick/hidapi/SDL_hidapi_wii.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_wii.c b/src/joystick/hidapi/SDL_hidapi_wii.c
index 3f286e704ba..45d2fadce19 100644
--- a/src/joystick/hidapi/SDL_hidapi_wii.c
+++ b/src/joystick/hidapi/SDL_hidapi_wii.c
@@ -1163,7 +1163,9 @@ HIDAPI_DriverWii_UpdateDevice(SDL_HIDAPI_Device *device)
}
/* Request a status update periodically to make sure our battery value is up to date */
- if (!ctx->m_unLastStatus || SDL_TICKS_PASSED(now, ctx->m_unLastStatus + FIFTEEN_MINUTES_IN_MS)) {
+ if (!ctx->m_unLastStatus ||
+ SDL_TICKS_PASSED(now, ctx->m_unLastStatus + FIFTEEN_MINUTES_IN_MS) ||
+ ctx->m_eCommState == k_eWiiCommunicationState_Error) {
Uint8 data[2];
data[0] = k_eWiiOutputReportIDs_StatusRequest;