Run lv_port_linux_frame_buffer on Ubuntu 20.04

Trying to run lv_port_linux_frame_buffer project as it is from Eclipse CDT IDE in my Ubuntu 20.

I got two problems:

  1. Need perditions to get frame buffer. Temporary I solved by running Eclipse as sudo user, but how to allow regular users to get frame buffer?

  2. I found application screen in TTY console. I was expecting to find it directly on desktop. There is only counter in the right bottom corner of the screen and no buttons. How to make application to show it’s face in TTY or even on desktop?
    image

main code:

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);

    /*Create a Demo*/
    lv_demo_widgets();

    /*Handle LitlevGL tasks (tickless mode)*/
    while(1) {
        lv_task_handler();
        usleep(5000);
    }

    return 0;
}

the first question:
add user to the specific group

$ ls /dev/fb0
crw-rw---- 1 root video 29, 0 4月   8 11:53 /dev/fb0    # owner(root), group(video)

in this case, you should add your account(etc. test) to group ‘video’, when your program starting under test(user) mode, it dont’ need the root privilege

the second question, i have no idea, i just running program in widnows, if you want start program on desktop, you can refer to ’ lv_drivers/gtkdrv/gtkdrv.c’ source code. you shouldn’t operate fb directly, i remeber that, ununtu will protect the fb.

If you are trying to run LVGL within a desktop environment you should use one of the higher-level drivers (like GTK, SDL, or Wayland). The framebuffer driver is intended for setups where there is no DE and your application is the only one using the framebuffer.

I will use LVGL in system where DE is missing, but for development purposes I need to run it on frame buffer. To run it on TTY and not on DE is OK for me, but why I have just black screen with counter in the corner.