From 8a2e2e75d1102c93a2cba272f1a6a7540fdd57fe Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 27 May 2025 08:47:32 -0700
Subject: [PATCH] Simplified loop logic
---
src/joystick/hidapi/SDL_hidapi_8bitdo.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_8bitdo.c b/src/joystick/hidapi/SDL_hidapi_8bitdo.c
index 3004006b60b9e..6ad96a178a962 100644
--- a/src/joystick/hidapi/SDL_hidapi_8bitdo.c
+++ b/src/joystick/hidapi/SDL_hidapi_8bitdo.c
@@ -175,17 +175,15 @@ static bool HIDAPI_Driver8BitDo_InitDevice(SDL_HIDAPI_Device *device)
const int MAX_ATTEMPTS = 5;
for (int attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) {
int size = ReadFeatureReport(device->dev, SDL_8BITDO_FEATURE_REPORTID_ENABLE_SDL_REPORTID, data, sizeof(data));
- if (size <= 0) {
- SDL_Delay(10);
- // Try again
- continue;
- }
if (size > 0) {
ctx->sensors_supported = true;
ctx->rumble_supported = true;
ctx->powerstate_supported = true;
+ break;
}
- break;
+
+ // Try again
+ SDL_Delay(10);
}
}