Skip to content

evdev open is delayed #13142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
stsp opened this issue May 28, 2025 · 7 comments
Open

evdev open is delayed #13142

stsp opened this issue May 28, 2025 · 7 comments
Milestone

Comments

@stsp
Copy link

stsp commented May 28, 2025

It seems, evdev is being
opened not when SdlInitSubsystem()
is called, but much later, eg
when the window is created.
Its a bit difficult to obtain a
stack trace under kmsdrm,
so I am just guessing.

The actual problem is that
the access restrictions are
enforced by an app after the
init stage (eg landlock), and
then sdl fails to open evdev.

Would it be possible to open
evdev in the init function?

@slouken
Copy link
Collaborator

slouken commented May 29, 2025

Can you add logging to the init? It should be initialized at startup, SDL_EVDEV_Init() is called within the video initialization routine.

@slouken slouken added this to the 3.x milestone May 29, 2025
@stsp
Copy link
Author

stsp commented May 29, 2025

Can it be that udev is trying
to open things in a background
until succeeds? This may also
explain the missing error msg.

@stsp
Copy link
Author

stsp commented May 29, 2025

Quick look into SDL_udev.c
suggests sdl fully relies on the
hotplug. However, IMHO it
should quit if some essential
devs (like kbd) are missing at
startup.

@stsp
Copy link
Author

stsp commented May 29, 2025

Or probably UDEV doesn't
distinguish between no device
and -EPERM? In which case
its not an sdl fault?

@stsp
Copy link
Author

stsp commented May 29, 2025

From a quick look to udev
code, it seems like errors are
not propagated to udev monitor.
So I suppose sdl can neither
"undelay" the opening, nor
detect the permission problem. :(

@stsp
Copy link
Author

stsp commented May 29, 2025

Ok, it seems the problem is
much depper. I noticed that
logind doesn't add ACLs to
/dev/input/*, even though
it is configured to, having
DeviceAllow=char-input rw
in /lib/systemd/system/systemd-logind.service

Google pointed to this thread:
https://bbs.archlinux.org/viewtopic.php?pid=2015685#p2015685
Which points here:
https://github.com/KillingSpark/HowLogindWorks
This doc has a very detailed
description of how to access
the input devices, and it seems
the mechanism that should
now be used, is via the special
logind API TakeDevice().
They suggest to use libinput,
which allows the user (in this
case sdl) to provide the custom
open() call-back, that needs
to get an fd from logind.

So I'd say sdl CAN actually fix
this problem, but its not easy. :)
It needs to adapt to the recent
changes that deprecate the
direct use of input nodes. And
start using the libinput+logind
APIs instead.

@stsp
Copy link
Author

stsp commented May 29, 2025

Please note that the current
situation is actually quite bad:

  • user needs to add himself to
    group input or he won't get
    keyboard
  • when he doesn't, he also
    doesn't see any error, or any
    hint about what's going on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants