Calibrating mouse input

Hello,

I have two button sample application below on my raspberry pi. I don’t see any mouse pointer when I run application. I can’t get any result while moving mouse clicking around. I did some changes in lv_drv_conf.h.
I enabled EVDEV_SCALE and EVDEV_CALIBRATE and also have changed and changed resolution and offset. As result I still don’t see mouse pointer, but clicking around very seldom gives me click action. But looks like it is not possible to reproduce another click in the same place.
How to fix my mouse input?

lv_drv_conf.h

#ifndef USE_LIBINPUT
#  define USE_LIBINPUT           0
#endif

#if USE_LIBINPUT
#  define LIBINPUT_NAME   "/dev/input/event1"        /*You can use the "evtest" Linux tool to get the list of devices and test them*/
#endif  /*USE_LIBINPUT*/

/*-------------------------------------------------
 * Mouse or touchpad as evdev interface (for Linux based systems)
 *------------------------------------------------*/
#ifndef USE_EVDEV
#  define USE_EVDEV           1
#endif

// sudo evtest /dev/input/event2

#if USE_EVDEV
#  define EVDEV_NAME   "/dev/input/event2"        /*You can use the "evtest" Linux tool to get the list of devices and test them*/
#  define EVDEV_SWAP_AXES         0               /*Swap the x and y axes of the touchscreen*/

#  define EVDEV_SCALE             1               /* Scale input, e.g. if touchscreen resolution does not match display resolution */
#  if EVDEV_SCALE
#define EVDEV_SCALE_HOR_RES		65494 //(4096)          /* Horizontal resolution of touchscreen */
#define EVDEV_SCALE_VER_RES		65480 //(4096)          /* Vertical resolution of touchscreen */
#  endif  /*EVDEV_SCALE*/



#  define EVDEV_CALIBRATE         1               /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
#  if EVDEV_CALIBRATE
#    define EVDEV_HOR_MIN   (40)//3800                    /*If EVDEV_XXX_MIN > EVDEV_XXX_MAX the XXX axis is automatically inverted*/
#define EVDEV_HOR_MAX		(65490)//200
#    define EVDEV_VER_MIN   (40)//200
#	define EVDEV_VER_MAX	(65490)//3800
#  endif  /*EVDEV_SCALE*/
#endif  /*USE_EVDEV*/

main.c

#include "lvgl/lvgl.h"
#include "lv_drivers/display/fbdev.h"
#include "lv_drivers/indev/evdev.h"
#include <stdio.h>
#include <unistd.h>

#include "lv_examples/lv_examples.h"

//#include <pthread.h>
#include <time.h>
#include <sys/time.h>

#define DISP_BUF_SIZE 800 * 480 * 4UL // If smaller than screen memory, draw will occur in chunks

static void event_handler(lv_obj_t * obj, lv_event_t event)
{
    if(event == LV_EVENT_CLICKED) {
        printf("Clicked\n");
    } else if(event == LV_EVENT_VALUE_CHANGED) {
        printf("Toggled\n");
    }
}

void lv_ex_btn_1(void)
{
    lv_obj_t * label;

    lv_obj_t * btn1 = lv_btn_create(lv_scr_act(), NULL);
    lv_obj_set_event_cb(btn1, event_handler);
    lv_obj_align(btn1, NULL, LV_ALIGN_CENTER, 0, -40);

    label = lv_label_create(btn1, NULL);
    lv_label_set_text(label, "Button");

    lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), NULL);
    lv_obj_set_event_cb(btn2, event_handler);
    lv_obj_align(btn2, NULL, LV_ALIGN_CENTER, 0, 40);
    lv_btn_set_checkable(btn2, true);
    lv_btn_toggle(btn2);
    lv_btn_set_fit2(btn2, LV_FIT_NONE, LV_FIT_TIGHT);

    label = lv_label_create(btn2, NULL);
    lv_label_set_text(label, "Toggled");
}


int main(void)
{
    /*LittlevGL init*/
    lv_init();
    /*Linux frame buffer device init*/
    fbdev_init();
    /*Small buffers for LittlevGL to draw the screen's content with double-buffering*/
    static lv_color_t buf1[DISP_BUF_SIZE];
    static lv_color_t buf2[DISP_BUF_SIZE];

    /*Initialize a descriptor for the buffer, with double buffering*/
    static lv_disp_buf_t disp_buf;
    lv_disp_buf_init(&disp_buf, buf1, buf2, DISP_BUF_SIZE);
    /*Initialize and register a display driver*/
    // Here we use the special callback function specific for the Linux Framebuffer 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);

    // Initialize EVDEV input for the 52pi touchscreen,
    // which luckily is supported as an "event input device" by the kernel
    evdev_init();
    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_drv_register(&indev_drv);

    // Create a label. Style is NULL by default for labels
    lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL);
    lv_label_set_text(label1, "Function 1");
    lv_obj_t * label2 = lv_label_create(lv_scr_act(), NULL);
    lv_label_set_text(label2, "Section A");

    // Alignment
    // NULL = align on parent (the screen)
    lv_obj_align(label1, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
    lv_obj_align(label2, NULL, LV_ALIGN_IN_TOP_MID, 0, 0);

    // Add a button
    lv_ex_btn_1();

    /*Handle LitlevGL tasks (tickless mode)*/
    // Mandatory, otherwise nothing will be displayed
    // It allows the callback functions to operate (for example to actually transfer bytes to screen framebuffer)
    while(1) {
        lv_tick_inc(5);
        lv_task_handler();
        usleep(5000);
    }

    return 0;
}

uint32_t custom_tick_get(void)
{
    static uint64_t start_ms = 0;
    if(start_ms == 0) {
        struct timeval tv_start;
        gettimeofday(&tv_start, NULL);
        start_ms = (tv_start.tv_sec * 1000000 + tv_start.tv_usec) / 1000;
    }

    struct timeval tv_now;
    gettimeofday(&tv_now, NULL);
    uint64_t now_ms;
    now_ms = (tv_now.tv_sec * 1000000 + tv_now.tv_usec) / 1000;

    uint32_t time_ms = now_ms - start_ms;
    return time_ms;
}