Building SDL3 for getting input with KMSDRM display

While working on the port of the game Unvanquished from SDL2 to SDL3 I toyed with the KMSDRM display, and yeah the game renders without any X11 or Wayland running, that’s very cool. But then I don’t get any input.

I verified my user is in the input group. I also tried adding read and write permissions to everyone on /dev/input/event* and also tried to run the game engine as root, just to be sure it’s not a matter of missing permission. I never got any input working.

So I guess I likely missed to enable something when building SDL3. Am I right? If yes, what that could be?

1 Like

I’m currently building and running SDL 3.2.20, I just noticed SDL 3.2.22 was released some days ago, so I’ll try that as well.

Edit: Same with 3.2.22.

Also, maybe my problem isn’t about building SDL3 correctly, as I’m not finding any option I would have forgotten to turn on.
If by any luck SDL3 is built correctly, is there something I actually need to do in game for keyboard/mouse input to work when rendering on KMSDRM?
Also, maybe there is a library I need?

Here is output of libinput list-devices:

$ libinput list-devices
Device:           vc4-hdmi
Kernel:           /dev/input/event0
Group:            1
Seat:             seat0, default
Capabilities:     keyboard pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   *button
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   flat *adaptive
Rotation:         n/a

Device:           Lenovo ThinkPad Compact USB Keyboard with TrackPoint
Kernel:           /dev/input/event2
Group:            2
Seat:             seat0, default
Capabilities:     keyboard pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         n/a

Device:           Lenovo ThinkPad Compact USB Keyboard with TrackPoint Mouse
Kernel:           /dev/input/event3
Group:            2
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *button
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   flat *adaptive
Rotation:         n/a

Device:           Lenovo ThinkPad Compact USB Keyboard with TrackPoint Consumer Control
Kernel:           /dev/input/event4
Group:            2
Seat:             seat0, default
Capabilities:     keyboard pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         n/a

Device:           Lenovo ThinkPad Compact USB Keyboard with TrackPoint
Kernel:           /dev/input/event5
Group:            2
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         n/a

Device:           Lenovo ThinkPad Compact USB Keyboard with TrackPoint
Kernel:           /dev/input/event6
Group:            2
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         n/a

Device:           Lenovo ThinkPad Compact USB Keyboard with TrackPoint
Kernel:           /dev/input/event7
Group:            2
Seat:             seat0, default
Capabilities:     pointer 
Tap-to-click:     n/a
Tap-and-drag:     n/a
Tap drag lock:    n/a
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: n/a
Calibration:      n/a
Scroll methods:   none
Click methods:    none
Disable-w-typing: n/a
Disable-w-trackpointing: n/a
Accel profiles:   n/a
Rotation:         n/a

Can my problem comes from the fact there is an unused input devices listed first?

I noticed that evtest /dev/input/event2 reports events for the keyboard and evtest /dev/input/event3 reports events for the mouse, so the inputs are actually working, but not in the SDL application.

Do you have to run the configuration tool to configure it to use SDL_INPUT_LINUXEV?

libsdl2_2.30.0+dfsg.orig/SDL2-2.30.0/src/video/kmsdrm/SDL_kmsdrmevents.c

#ifdef SDL_INPUT_LINUXEV
#include “../../core/linux/SDL_evdev.h”
#elif defined SDL_INPUT_WSCONS
#include “../../core/openbsd/SDL_wscons.h”
#endif

void KMSDRM_PumpEvents(_THIS)
{
#ifdef SDL_INPUT_LINUXEV
SDL_EVDEV_Poll();
#elif defined SDL_INPUT_WSCONS
SDL_WSCONS_PumpEvents();
#endif
}