diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 12eb59f24..e3f99bc98 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -442,10 +442,13 @@ HIDAPI_UpdateDiscovery() break; } - SDL_HIDAPI_discovery.m_bHaveDevicesChanged = SDL_TRUE; - pUdevDevice = usyms->udev_monitor_receive_device(SDL_HIDAPI_discovery.m_pUdevMonitor); if (pUdevDevice) { + const char *action = NULL; + action = usyms->udev_device_get_action(pUdevDevice); + if (!action || SDL_strcmp(action, "add") == 0 || SDL_strcmp(action, "remove") == 0) { + SDL_HIDAPI_discovery.m_bHaveDevicesChanged = SDL_TRUE; + } usyms->udev_device_unref(pUdevDevice); } }