Make sure we synchronously re-enable USB reporting mode for Switch controllers (thanks @SortaCore!)

Fixes https://github.com/libsdl-org/SDL/issues/3450
This commit is contained in:
Sam Lantinga 2023-02-08 14:22:39 -08:00
parent 50575ed223
commit b7c6fec10a

View file

@ -2161,7 +2161,11 @@ static SDL_bool HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device)
const int INPUT_WAIT_TIMEOUT_MS = 100;
if (now >= (ctx->m_ulLastInput + INPUT_WAIT_TIMEOUT_MS)) {
/* Steam may have put the controller back into non-reporting mode */
SDL_bool wasSyncWrite = ctx->m_bSyncWrite;
ctx->m_bSyncWrite = SDL_TRUE;
WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_ForceUSB, NULL, 0, SDL_FALSE);
ctx->m_bSyncWrite = wasSyncWrite;
}
} else if (device->is_bluetooth) {
const int INPUT_WAIT_TIMEOUT_MS = 3000;