diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 25eb7b6dc..899da9ee2 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -740,6 +740,14 @@ HIDAPI_JoystickInit(void) SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "udev disabled by SDL_HIDAPI_JOYSTICK_DISABLE_UDEV"); linux_enumeration_method = ENUMERATION_FALLBACK; + } else if (access("/.flatpak-info", F_OK) == 0 + || access("/run/host/container-manager", F_OK) == 0) { + /* Explicitly check `/.flatpak-info` because, for old versions of + * Flatpak, this was the only available way to tell if we were in + * a Flatpak container. */ + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "Container detected, disabling HIDAPI udev integration"); + linux_enumeration_method = ENUMERATION_FALLBACK; } else { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Using udev for HIDAPI joystick device discovery"); diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 5b013019b..466cee6da 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -658,7 +658,10 @@ LINUX_JoystickInit(void) enumeration_method = ENUMERATION_FALLBACK; } else if (access("/.flatpak-info", F_OK) == 0 - || access("/run/pressure-vessel", F_OK) == 0) { + || access("/run/host/container-manager", F_OK) == 0) { + /* Explicitly check `/.flatpak-info` because, for old versions of + * Flatpak, this was the only available way to tell if we were in + * a Flatpak container. */ SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Container detected, disabling udev integration"); enumeration_method = ENUMERATION_FALLBACK;