Skip to content

Commit 8a2e2e7

Browse files
committed
Simplified loop logic
1 parent b4f7948 commit 8a2e2e7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/joystick/hidapi/SDL_hidapi_8bitdo.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,15 @@ static bool HIDAPI_Driver8BitDo_InitDevice(SDL_HIDAPI_Device *device)
175175
const int MAX_ATTEMPTS = 5;
176176
for (int attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) {
177177
int size = ReadFeatureReport(device->dev, SDL_8BITDO_FEATURE_REPORTID_ENABLE_SDL_REPORTID, data, sizeof(data));
178-
if (size <= 0) {
179-
SDL_Delay(10);
180-
// Try again
181-
continue;
182-
}
183178
if (size > 0) {
184179
ctx->sensors_supported = true;
185180
ctx->rumble_supported = true;
186181
ctx->powerstate_supported = true;
182+
break;
187183
}
188-
break;
184+
185+
// Try again
186+
SDL_Delay(10);
189187
}
190188
}
191189

0 commit comments

Comments
 (0)