diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -668,7 +668,10 @@ SDL_SYS_JoystickUpdate(joystick); - if (joystick->closed && joystick->uncentered) { + /* if the joystick's hwdata is invalid and it is uncentered, it means the device + * was removed but maybe it is not closed + */ + if ((joystick->closed || joystick->hwdata == NULL) && joystick->uncentered) { int i; /* Tell the app that everything is centered/unpressed... */ diff --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/joystick/darwin/SDL_sysjoystick.c @@ -705,7 +705,6 @@ } if (device->removed) { /* device was unplugged; ignore it. */ - joystick->closed = 1; joystick->uncentered = 1; joystick->hwdata = NULL; return;