From b321eae51a64fece5e8978edab081c4dfea422f3 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 11 Jul 2022 19:43:25 -0500 Subject: [PATCH] joystick: Fix spurious battery empty events when opening a Shield controller --- src/joystick/hidapi/SDL_hidapi_shield.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/joystick/hidapi/SDL_hidapi_shield.c b/src/joystick/hidapi/SDL_hidapi_shield.c index ef27cb9f8..c6d77de53 100644 --- a/src/joystick/hidapi/SDL_hidapi_shield.c +++ b/src/joystick/hidapi/SDL_hidapi_shield.c @@ -155,6 +155,7 @@ HIDAPI_DriverShield_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; /* Request battery and charging info */ + ctx->battery_level = SDL_JOYSTICK_POWER_UNKNOWN; ctx->last_battery_query_time = SDL_GetTicks(); HIDAPI_DriverShield_SendCommand(device, CMD_CHARGE_STATE, NULL, 0); HIDAPI_DriverShield_SendCommand(device, CMD_BATTERY_STATE, NULL, 0);