Ensure that report 06 command reads normally
Ensure that report 06 command reads normally
This commit is contained in:
@@ -172,11 +172,20 @@ static bool HIDAPI_Driver8BitDo_InitDevice(SDL_HIDAPI_Device *device)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Uint8 data[USB_PACKET_LENGTH];
|
Uint8 data[USB_PACKET_LENGTH];
|
||||||
int size = ReadFeatureReport(device->dev, SDL_8BITDO_FEATURE_REPORTID_ENABLE_SDL_REPORTID, data, sizeof(data));
|
const int MAX_ATTEMPTS = 5;
|
||||||
if (size > 0) {
|
for (int attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) {
|
||||||
ctx->sensors_supported = true;
|
int size = ReadFeatureReport(device->dev, SDL_8BITDO_FEATURE_REPORTID_ENABLE_SDL_REPORTID, data, sizeof(data));
|
||||||
ctx->rumble_supported = true;
|
if (size <= 0) {
|
||||||
ctx->powerstate_supported = true;
|
SDL_Delay(10);
|
||||||
|
// Try again
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (size > 0) {
|
||||||
|
ctx->sensors_supported = true;
|
||||||
|
ctx->rumble_supported = true;
|
||||||
|
ctx->powerstate_supported = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user