Keyboard Event in Simulator v9.1

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

I want to attach an event, that is fired when a key is pressed on the physical keyboard.

Code to reproduce

In the main.c I’ve added an event listener

int main(void)


  // draw();

  lv_indev_add_event_cb(getLvKeyboard(), my_event_cb, LV_EVENT_CLICKED, NULL);


It was necessary to add a getter getLvKeyboard that is returning the lv_indev_t *lvKeyboard object from the app_hal.c file.

The code block(s) should be formatted like:

/*You code here*/

The callback basically currently only logs the input

static void my_event_cb(lv_event_t *event)
  LV_LOG_USER("event code %i", event->code);

It seems, that the event is never fired.
I tried different events (key, click, all) and the only event I see, is the LV_EVENT_DELETE event, when closing the simulator.

I found this article How to detect keyboard input in lvgl simulator? , but not sure if it’s still working like this for v9.1
From what I understand, the hal_setup function already setup the sdl keyboard driver …

For some reason, attaching the event to the mouse input device, the event is fired like expected.
Any ideas, why mouse is working and keyboard is not?

Typing on the keyboard in the simulator in a textarea is working, though.
It seems a problem with my event initialisation …