Mouse and touch pad at the same time

Hi,

I have a working application where i can use the mouse OR the touch screen on my raspberry PI4.
But how i can let works the mouse and the touch screen at the same time?

Hi @GOnkelinx ,

Not knowing the port you are using etc. makes it hard to give a detailed answer, but you should just be able to initialise both (indev devices in LVGL) peripherals and they should coexist happily.

If you can not get it to work you will need to post your indev code or point us to the port you are using for your project so someone can take a look.

I hope that helps.

Kind Regards,

Pete

Dear,

I have use the “lv_port_linux_frame_buffer” GitHub - lvgl/lv_port_linux_frame_buffer: LVGL configured to work with a standard Linux framebuffer.
In that project i used the evdev.h

At startup i had used the follow code:

/LittlevGL init/
lv_init();

/Linux frame buffer device init/
fbdev_init();

#define DISP_BUF_SIZE (128 * 1024)
/A small buffer for LittlevGL to draw the screen’s content/
static lv_color_t buf[DISP_BUF_SIZE];

/Initialize a descriptor for the buffer/
static lv_disp_draw_buf_t disp_buf;
lv_disp_draw_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE);

/Initialize and register a display driver/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.draw_buf = &disp_buf;
disp_drv.flush_cb = fbdev_flush;
disp_drv.hor_res = LV_HOR_RES_MAX;
disp_drv.ver_res = LV_VER_RES_MAX;
lv_disp_drv_register(&disp_drv);

evdev_init();
static lv_indev_drv_t indev_drv_1;
lv_indev_drv_init(&indev_drv_1); /Basic initialization/
indev_drv_1.type = LV_INDEV_TYPE_POINTER;
/This function will be called periodically (by the library) to get the mouse position and state/
indev_drv_1.read_cb = evdev_read;
lv_indev_t *mouse_indev = lv_indev_drv_register(&indev_drv_1);

/Set a cursor for the mouse/
LV_IMG_DECLARE(mouse_cursor_icon)
lv_obj_t *cursor_obj = lv_img_create(lv_scr_act()); /*Create an image object for the cursor */
lv_img_set_src(cursor_obj, &mouse_cursor_icon); /Set the image source/
lv_indev_set_cursor(mouse_indev, cursor_obj); /Connect the image object to the driver/

ui_init();

/Handle LitlevGL tasks (tickless mode)/
while (1)
{
//lv_tick_inc(5);
lv_timer_handler();
usleep(5000);
}


lv_conf.h (24.7 KB)
lv_drv_conf.h (14.8 KB)