Testing experimental KMS/DRM backend - no keyboard events

Hi,
I’m trying to use the new experimental KMS/DRM backend on a Debian/Linux system with i915 graphics.
So far I managed to get some graphics on the screen but I was not able to get keyboard events.
When I start my pllication, the keyboard becomes completely unresponsive, not even the caps-lock or num-lock lights are working. When I kill my program (via ssh), the keyboard stays in this state.
To demonstrate the problem I’ve written a small test program:

#include "SDL.h"
#include 

int main(int argc, char* argv[]) {

    SDL_Window *window;

    SDL_Init(SDL_INIT_VIDEO);

    window = SDL_CreateWindow("An SDL2 window",
        SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
        1920, 1080,
        SDL_WINDOW_OPENGL|SDL_WINDOW_FULLSCREEN);

    if (window == NULL) {
        printf("Could not create window: %s\n", SDL_GetError());
        return 1;
    }

    /* try if we get some events */
    for (int i=0; i<100; ++i)
    {
        SDL_Event event;
        printf("wait event\n");
        SDL_WaitEvent(&event);
        printf("got event 0x%x\n", event.type);
    }


    SDL_DestroyWindow(window);

    SDL_Quit();
    return 0;
}

When I execute the compiled code I get:

wait event
got event 0x200
wait event
got event 0x200
wait event
got event 0x200
wait event
got event 0x200
wait even

and then it stops and doesn’t react to any key press.

Is this not working because the code is still experimental? (Using latest development version of SDL via mercurial).
Any ideas what I can try to get keyboard events and/or how to debug this?

Best regards,
-Rainer

Make sure you’ve built SDL with evdev support. That’s how it gets the keyboard events. Then you need to give the user access to the input devices. Try adding the user to the input group, that usually works.

The keyboard locks up because SDL suppresses the key events for the terminal by setting it into an off mode. SDL_Quit would turn it on again, but killing the application leaves the terminal stuck in that mode.

1 Like

Evdev supoort was indeed the problem. I was missing libevdev-dev. After installing the package and rebuilding SDL2, the keyboard works as expected. Thank you for the hint!