Idea for joystick support in sandbox/SDL
Alexander Larsson
alexl at redhat.com
Mon Jun 20 20:16:06 UTC 2016
On mån, 2016-06-20 at 17:39 +0200, Bastien Nocera wrote:
> Hey,
>
> I've been looking at how we can support joysticks in flatpak, inside
> the sandbox[1]. As udev's API is a private/system API, and not one
> stable enough for sandboxed applications to use, and the fact that
> even
> though they're input devices their events don't go through the
> compositor itself, we need to find a way to enumerate joysticks,
> signal
> additions and removals, and proxy opening them.
>
> My idea was for the compositor offering this D-Bus API:
>
> - Method:
> ao ListJoysticks()
>
> - Signals
> JoystickAdded(o)
> JoystickRemoved(o)
>
> And on the object path for each joystick:
>
> - Method:
> fd OpenJoystick()
>
> Signal:
> JoystickRemoved()
>
> Properties:
> s HapticsFeatures [2]
The way I understand thing there are two kinds of joystick devices,
some supporting the "old" jsN API, and some supporting a more modern
generic input device API. Is that true, and if so, which fd:s are
these?
Also, one option we considered at the hackfest was to create a fuse
filesystem with files in them that "look like" device nodes (but are
regular files). Operations on these then cause the same operation on
the backing device node. That way you can emulate the ABI and run games
unchanged. On the other hand, that adds a context switch to every js
operation, which is not ideal. And also, forwarding ioctls needs
device-type specific code.
> To avoid one application taking the joystick and doing things with it
> (rumble to death?), we'd revoke the fd given to an application when
> the
> application loses focus.
Do we support revoke for this? Also, how would we track focus?
> Is this doable? Is this good API?
Probably doable, except maybe revoke.
> [2]: As used in src/haptic/linux/SDL_syshaptic.c in SDL. Maybe a
> string
> list might be better, or a bitmask?
array of strings is the more dbus/extensible thing to do.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl at redhat.com alexander.larsson at gmail.com
He's a bookish flyboy hairdresser in a wheelchair. She's a cosmopolitan
Bolivian mechanic from aristocratic European stock. They fight crime!
More information about the xdg-app
mailing list