Skip to content

Add joystick access to the sandbox #7

Description

@alexlarsson

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

Activity

  1. alexlarsson commented on May 19, 2016

    @alexlarsson
    MemberAuthor

    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.

  2. alexlarsson commented on May 19, 2016

    @alexlarsson
    MemberAuthor

    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.

  3. alexlarsson commented on May 19, 2016

    @alexlarsson
    MemberAuthor

    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?

  4. alexlarsson commented on May 19, 2016

    @alexlarsson
    MemberAuthor

    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.

  5. alexlarsson commented on May 19, 2016

    @alexlarsson
    MemberAuthor

    From @hadess on May 12, 2016 17:21

    Then that means we can't implement this feature without patching ugly things into SDL :(

  6. alexlarsson commented on May 19, 2016

    @alexlarsson
    MemberAuthor

    From @hadess on May 12, 2016 17:26

    Is it feasible to have the whole of /dev/input exported, even if devices other than the joysticks we want to access will be there, but protected through permissions?

    This wouldn't fix hotplugging though.

  7. matthiasclasen commented on Apr 30, 2017

    @matthiasclasen
    Collaborator

    Is this taken care of with the new wayland protocol that is being discussed ?

  8. hadess commented on Apr 30, 2017

    @hadess
    Contributor

    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.

  9. prcastro commented on Nov 22, 2017

    @prcastro

    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.

  10. hadess commented on Nov 22, 2017

    @hadess
    Contributor

    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.

  11. prcastro commented on Nov 22, 2017

    @prcastro

    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.

  12. hadess commented on Nov 22, 2017

    @hadess
    Contributor

    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.

  13. prcastro commented on Nov 22, 2017

    @prcastro

    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.

  14. prcastro commented on Nov 22, 2017

    @prcastro

    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?

  15. 7 remaining items

  16. hholst80 commented on Sep 17, 2022

    @hholst80

    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.

  17. hadess commented on Sep 17, 2022

    @hadess
    Contributor

    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=all until something else comes along.

    There's js-test if you want to test your hardware by the way.

  18. added a commit that references this issue on Jun 18, 2023
  19. please-be-nice commented on Sep 29, 2023

    @please-be-nice

    has anything changed that would finally allow hotswapping with flatpaks or is it still at an impasse?

  20. smcv commented on Sep 29, 2023

    @smcv
    Collaborator

    Either --device=input (new in the 1.15.x development branch, I'm not sure whether it exists in a release yet) or --device=all gives you access to /dev/input/, including any evdev joysticks that were accessible to you outside the sandbox.

    --device=all also 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 /sys and /dev directly, 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 /dev directly when a Flatpak or Steam Linux Runtime sandbox is detected.

  21. added a commit that references this issue on Jan 7, 2024
  22. added a commit that references this issue on Feb 1, 2024
  23. added a commit that references this issue on Feb 10, 2024
  24. hfiguiere commented on Feb 11, 2024

    @hfiguiere
    Collaborator

    I think it's done with #5481

  25. added a commit that references this issue on Jun 18, 2026
    346eaf6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions