We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5361 - RFC: Automatically fall back to non-udev joystick detection in Flatpak or pressure-vessel container
Summary: RFC: Automatically fall back to non-udev joystick detection in Flatpak or pre...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-19 17:42 UTC by Simon McVittie
Modified: 2020-11-24 05:11 UTC (History)
0 users

See Also:


Attachments
joystick: Don't use udev in Flatpak or pressure-vessel container (1.91 KB, patch)
2020-11-19 17:43 UTC, Simon McVittie
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon McVittie 2020-11-19 17:42:55 UTC
Another follow-up for Bug #5337.

We can't expect udev change-notification to work reliably in containers, for the reasons discussed on Bug #5337.

Flatpak provides an official way to detect that you're inside a Flatpak container (test whether the file /.flatpak-info exists), so perhaps it would make sense for SDL to move to the inotify code path automatically in that case?

Similarly, Steam's pressure-vessel container tool, as used for the Steam Linux Runtime containers, can be detected by probing /run/pressure-vessel.
Comment 1 Simon McVittie 2020-11-19 17:43:39 UTC
Created attachment 4530 [details]
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>
Comment 2 Sam Lantinga 2020-11-24 05:11:10 UTC
Looks good, thanks!
https://hg.libsdl.org/SDL/rev/5a0fa9b6d4bf