Open Saroufim opened 1 year ago
We have been researching this and it turned out to be much more complex than originally thought. It's therefore put on a extremely low priority. If someone with expertise about this topic wants to help out, please do!
Here are the issues we have discovered:
/dev
on Linux. We therefore need device=all
permission which is flagged as a "dangerous permission". There's attempts to make an "inputfd" protocol for Wayland (not merged yet) and a Flatpak portal for gamepad access without such broad permission privileges, but neither of those things are created yet. Linux is years behind Windows when it comes to gamepad input./dev
, even gamepads, as root-access devices. You cannot access gamepads unless you (the user) run the app as root. Apps like Steam work around this via the steam-devices
package which you install natively on the device, which adds some host rules to allow unprivileged users to access the gamepads. Neither the native nor the Flatpak versions of Steam work without those rules. But since Cartridges is a Flatpak app, we would not be able to install such rules ourselves.These are the rules that Steam has to install to get access to gamepads:
/usr/lib/udev/rules.d/51-these-are-not-joysticks-rm.rules
/usr/lib/udev/rules.d/60-steam-input.rules
/usr/lib/udev/rules.d/60-steam-vr.rules
Those in turn are complex rules which define which devices are joysticks and which ones aren't. We would NOT be able to do something similar in Cartridges. If we implement gamepad access, it would be the user's own job to configure their host to give all non-root users access to read gamepads, and that's way out of the scope of what we'd be able to assist anyone with (just look at the rules in the files above, if you have Steam installed, they're very complex).
So if anyone's got more experience with solving Linux's gamepad situation and the issues above, then please help out! If not, we are unlikely to see gamepad support in Cartridges.
Highscore has support for gamepad navigation. I'm not sure about sandboxing, permissions, and exclusive device access, but maybe it could help a little to check out what they did.
Yeah, I've been looking into that.
@sonnyp do you by any chance happen to know how you can get libmanette working inside of Flatpak? I haven't had much luck.
Edit: Nevermind, as most things in life, it was a problem with my build configuration :) Its working now.
@kra-mo in case it's helpful: https://gitlab.gnome.org/GNOME/gnome-build-meta/-/merge_requests/2217
(you can't use libmanette from org.gnome.Sdk)
libmanette also has a working manifest example
And if you need some kind of demo, @halfmexican built one for Workbench here
If you are using Steam, you can enable Desktop Layout in controller settings.
Ah! That's neat. It is actually using libei too, which makes sense.
It would be great if the library can be navigated with a controller. Currently, it doesn't react to controller input.