Simplified loop logic
This commit is contained in:
@@ -175,18 +175,16 @@ static bool HIDAPI_Driver8BitDo_InitDevice(SDL_HIDAPI_Device *device)
|
|||||||
const int MAX_ATTEMPTS = 5;
|
const int MAX_ATTEMPTS = 5;
|
||||||
for (int attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) {
|
for (int attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) {
|
||||||
int size = ReadFeatureReport(device->dev, SDL_8BITDO_FEATURE_REPORTID_ENABLE_SDL_REPORTID, data, sizeof(data));
|
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) {
|
if (size > 0) {
|
||||||
ctx->sensors_supported = true;
|
ctx->sensors_supported = true;
|
||||||
ctx->rumble_supported = true;
|
ctx->rumble_supported = true;
|
||||||
ctx->powerstate_supported = true;
|
ctx->powerstate_supported = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try again
|
||||||
|
SDL_Delay(10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->product_id == USB_PRODUCT_8BITDO_SF30_PRO || device->product_id == USB_PRODUCT_8BITDO_SF30_PRO_BT) {
|
if (device->product_id == USB_PRODUCT_8BITDO_SF30_PRO || device->product_id == USB_PRODUCT_8BITDO_SF30_PRO_BT) {
|
||||||
|
|||||||
Reference in New Issue
Block a user