Repository navigation
Add joystick access to the sandbox #7
Description
Activity
From @hadess on May 4, 2016 23:19
I looked at the new bubblewrap-using code. Does:
add_args (argv_array, "--dev-bind", "/dev/input/js0", "/dev/input/js0", NULL);work if the device in question appears after the application has started? For joysticks, we really want to be able to use them even if the app is already started.
No. In fact, there is no great way to handle that at all, because to create bind mount such as those you need increased privileges, which we have only on startup.
The nicest approach is if we could grant access to an entier directory with only those devices, because then it could later be changed on the host side.From @hadess on May 12, 2016 16:35
Good thing is that SDL, I'm guessing the primary "legacy" user for this feature, uses udev to discover devices, so we could put it anywhere we wanted in the /dev tree.
We do compile SDL with udev support in the fd.o framework, right?
No, we don't have udev in the runtime, because it needs the database created by udevd, and the udev people (kay) said it is not ABI stable across different versions.
From @hadess on May 12, 2016 17:21
Then that means we can't implement this feature without patching ugly things into SDL :(
From @hadess on May 12, 2016 17:26
Is it feasible to have the whole of
/dev/inputexported, even if devices other than the joysticks we want to access will be there, but protected through permissions?This wouldn't fix hotplugging though.
Is this taken care of with the new wayland protocol that is being discussed ?
Is this taken care of with the new wayland protocol that is being discussed ?
Yes, though there is a long tail of X11 games that'd want joystick support out there. We can revisit whether a better solution that at least allows hotplug can be made to work for X11.
Any news on this? I am playing a Flatpak + Wine game (Cuphead) and the lack of joystick seems to be one of the only issues with this approach. This prevents DRM free distributors (like Humble Bundle and GOG) to even think about distributing games using flatpak.
It would eventually be fixed by a new Wayland protocol. I don't have any news on this though, best look at the wayland-devel list for updates.
If the protocol you mentioned was inputfd, it hasn't seen activity since March. What confuses me a little is that keyboard and mice work very well, even inside the sandbox. Does wayland protocol for them already exists? I tought Wayland compositor sent input to the client, no matter the source.
If the protocol you mentioned was inputfd, it hasn't seen activity since March.
It is inputfd.
Does wayland protocol for them already exists?
Yes, those are baked into the first set of protocols that Wayland used. They were later extended with touchscreen and drawing tablets support, which are, again, similar but different enough to warrant additional layers.
Thanks for the explanation. BTW I was wrong. There is a RFC v3 of inputfd from August, with discussions about it going into September. So it's only two/three months without an update.
After inputfd is implemented, XWayland clients could use joystick input? If not, how could games relying on X (e.g. all of them) use joysticks?
7 remaining items
I was going to play a game with my son and we spent a good 10 minutes trying to figure out why the joystick did not work. dmesg printed out all fine the gamepad was detected all good. The Gnome desktop didn't really have a tool to test the joystick but I had a non flatpak game and there the joystick worked just fine. So I searched on github and I found this issue.. From 2016, that had a workaround.
I think it is quite reasonable that a flatpak game has the same access to game controllers as the user has because games is a really good use-case for flatpaks. It's like the steam of OSS and a great way to get users of flatpak. I don't need flatpaks at all for most of my own tooling but the games, there I kinda see the point of the paks'.
I hope you can give this some new priory and consider the video game aspects of flatpak. There joysticks are really important feature, as important as sound and 3d acceleration, both works with flatpak already.
I hope you can give this some new priory and consider the video game aspects of flatpak. There joysticks are really important feature, as important as sound and 3d acceleration, both works with flatpak already.
File a bug against the game in question, it should use
--device=alluntil something else comes along.There's js-test if you want to test your hardware by the way.
- added a commit that references this issue
on Mar 1, 2023 - added 2 commits that reference this issue
on Mar 20, 2023 - added a commit that references this issue
on Jun 18, 2023 has anything changed that would finally allow hotswapping with flatpaks or is it still at an impasse?
Either
--device=input(new in the 1.15.x development branch, I'm not sure whether it exists in a release yet) or--device=allgives you access to/dev/input/, including any evdev joysticks that were accessible to you outside the sandbox.--device=allalso gives you raw HID access to any HID joysticks that were accessible to you outside the sandbox. This requires special udev rules on the host system.Hotplugging joysticks requires using a library or game engine that will detect that it's inside a Flatpak sandbox and monitor
/sysand/devdirectly, instead of relying on libudev. Recent-ish versions of SDL, libmanette and Proton are known to be able to do this.If your library or game engine relies on libudev, then it cannot work reliably with hotplug inside a Flatpak sandbox: this is a udev limitation, and Flatpak cannot fix it. The solution is to do what SDL does: use libudev when not in a sandbox, but fall back to using inotify to monitor
/devdirectly when a Flatpak or Steam Linux Runtime sandbox is detected.Reacted by please-be-nice, martyfuhry and mwaitzman- added a commit that references this issue
on Nov 14, 2023 - added a commit that references this issue
on Jan 7, 2024 - added a commit that references this issue
on Feb 1, 2024 - added a commit that references this issue
on Feb 10, 2024 I think it's done with #5481
Reacted by Mr Beedell, Roke Julian Lockhart- added a commit that references this issue
on Jun 18, 2026
From @hadess on April 29, 2016 10:31
As done in this patch:
0001-Add-support-for-accessing-joysticks.txt
Copied from original issue: alexlarsson/xdg-app#149