From eab27b904915a573ca789d7c7d31f2b018cd189f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 9 Aug 2022 17:58:42 -0700 Subject: [PATCH] Make sure Switch controller initialization is synchronous and start the input timeout then --- src/joystick/hidapi/SDL_hidapi_switch.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 08d3385a6..45b7bb14e 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -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: