I have a slight problem with the mouse after updating to v6 of littlevgl. I used the /dev/input/mice before and in v6 the support for that is gone. How do I use the mouse via /dev/input/event1 in my case.
I do not want to use SDL!
The defines USE_EVDEV and EVDEV_NAME “/dev/input/event1” are used.
Not really sure, but something seems to be wrong here. The mouse is showing up but its not moving at all.
When using evtest the output is the following:
Here is the main that I am experimenting with:
#include "lvgl/lvgl.h"
#include "lv_drivers/display/fbdev.h"
#include <unistd.h>
#include <pthread.h>
#include <time.h>
#include <sys/time.h>
#include "lv_drivers/indev/evdev.h"
#include "MasterSurface.h"
#define DISP_BUF_SIZE (80*LV_HOR_RES_MAX)
LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image file.*/
int main(void) {
/*LittlevGL init*/
lv_init();
/*Linux frame buffer device init*/
fbdev_init();
/*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_buf_t disp_buf;
lv_disp_buf_init(&disp_buf, buf, NULL, DISP_BUF_SIZE);
/*Initialize and register a display driver*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.buffer = &disp_buf;
disp_drv.flush_cb = fbdev_flush;
lv_disp_drv_register(&disp_drv);
// enable event input
evdev_init();
// get mouse as an input
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = evdev_read;
lv_indev_t * mouse_indev = lv_indev_drv_register(&indev_drv);
lv_obj_t * cursor_obj = lv_img_create(lv_scr_act(), NULL); //Create an image for the cursor
lv_img_set_src(cursor_obj, &mouse_cursor_icon); //For simlicity add a built in symbol not an image
lv_indev_set_cursor(mouse_indev, cursor_obj); // connect the object to the driver
//inits surface
lv_master_surface_init();
/*Handle LitlevGL tasks (tickless mode)*/
while (1) {
lv_task_handler();
usleep(5000);
}
return 0;
}