Make sure Switch controller initialization is synchronous and start the input timeout then

main
Sam Lantinga 2022-08-09 17:58:42 -07:00
parent b4660e9d8b
commit eab27b9049
1 changed files with 5 additions and 0 deletions

View File

@ -1230,6 +1230,7 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti
goto error;
}
ctx->m_nMaxWriteAttempts = GetMaxWriteAttempts(device);
ctx->m_bSyncWrite = SDL_TRUE;
/* Find out whether or not we can send output reports */
ctx->m_bInputOnly = SDL_IsJoystickNintendoSwitchProInputOnly(device->vendor_id, device->product_id);
@ -1366,6 +1367,10 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti
joystick->naxes = SDL_CONTROLLER_AXIS_MAX;
joystick->epowerlevel = ctx->m_bUsingBluetooth ? SDL_JOYSTICK_POWER_UNKNOWN : SDL_JOYSTICK_POWER_WIRED;
/* Set up for input */
ctx->m_bSyncWrite = SDL_FALSE;
ctx->m_unLastInput = SDL_GetTicks();
return SDL_TRUE;
error: