Micropython unix port and keyboard driver

Hi, I have a problem with the unix port.
My application has only a text area but the PC keyboard doesn’t work.
I just want to be able to type with the PC keyboard in the textarea.

Following the examples in https://github.com/lvgl/lv_binding_micropython/tree/master/examples I have added the display driver and the mouse driver.
But there isn’t the keyboard driver.
How do I add it?

The program I used:

import lvgl as lv
import SDL


# Register SDL display driver
disp_buf1 = lv.disp_buf_t()
buf1_1 = bytearray(320*10)
disp_buf1.init(buf1_1, None, len(buf1_1) // lv.color_t.SIZE)
disp_drv = lv.disp_drv_t()
disp_drv.buffer = disp_buf1
disp_drv.flush_cb = SDL.monitor_flush
disp_drv.hor_res = 320
disp_drv.ver_res = 240

# Register SDL mouse driver
indev_drv = lv.indev_drv_t()
indev_drv.type = lv.INDEV_TYPE.POINTER
indev_drv.read_cb = SDL.mouse_read

scr = lv.scr_act()
ta = lv.textarea(scr)		

while True:

Hi @Escher!

The reason that there is no keyboard driver is that no one ever wrote a keyboard driver for lv_micropython (as far as I know).
Personally I never needed it.

But if you want - you can write a keyboard driver yourself and contribute it back to the community!

The docs explain how to register a keyboard driver in C but you can do the same thing in pure Python if you want, just like the mouse_indev is a mouse input device written in pure Python.

If you want to try, I’ll be happy to answer questions and give advice!

First step would be, regardless of LVGL and Micropython, decide how you want to read the keyboard in Linux. If you are using SDL you might want to consider enhancing the SDL driver. If you are using the Frame Buffer you could try reading from /dev/input/eventX event device file. That’s really up to you and according to your use case.

Thanks a lot amirgon, I will try to add SDL_keyboard.c in the SDL Driver.