mirror of https://github.com/encounter/SDL.git
joystick: Don't use udev in Flatpak or pressure-vessel container
Flatpak[1] and pressure-vessel[2] are known to use user namespaces, therefore udev event notification via netlink won't work reliably. Both frameworks provide a filesystem API that libraries can use to detect them. Do that, and automatically fall back from udev-based device discovery to the inotify-based fallback introduced in Bug #5337. [1] <https://flatpak.org/> [2] <https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/tree/master/pressure-vessel> Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
e9869e07bf
commit
8e2746cfb6
|
@ -635,9 +635,19 @@ LINUX_JoystickInit(void)
|
|||
#if SDL_USE_LIBUDEV
|
||||
if (enumeration_method == ENUMERATION_UNSET) {
|
||||
if (SDL_getenv("SDL_JOYSTICK_DISABLE_UDEV") != NULL) {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
|
||||
"udev disabled by SDL_JOYSTICK_DISABLE_UDEV");
|
||||
enumeration_method = ENUMERATION_FALLBACK;
|
||||
}
|
||||
else if (access("/.flatpak-info", F_OK) == 0
|
||||
|| access("/run/pressure-vessel", F_OK) == 0) {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
|
||||
"Container detected, disabling udev integration");
|
||||
enumeration_method = ENUMERATION_FALLBACK;
|
||||
}
|
||||
else {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
|
||||
"Using udev for joystick device discovery");
|
||||
enumeration_method = ENUMERATION_LIBUDEV;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue