Touchscreen is ok and can print coordinate,but no responds when click the button

Important: my board is linux system ,use the samsung screen and gslx680 touch ic. LVGL9.0

Description

What MCU/Processor/Board and compiler are you using?

imx6ull

What LVGL version are you using?

LVGL9.0.0

What do you want to achieve?

my button can capture the touch event

What have you tried so far?

my touchscreen can print the touch coordinate

Code to reproduce

/*-----------------------------------------

  • Linux frame buffer device (/dev/fbx)
    -----------------------------------------/
    #ifndef USE_FBDEV

define USE_FBDEV 1

#endif

#if USE_FBDEV

define FBDEV_PATH “/dev/fb0”

#endif

/*-----------------------------------------

  • FreeBSD frame buffer device (/dev/fbx)
    /
    #ifndef USE_BSD_FBDEV

define USE_BSD_FBDEV 0

#endif

#if USE_BSD_FBDEV

define FBDEV_PATH “/dev/fb0”

#endif

/*-----------------------------------------

  • DRM/KMS device (/dev/dri/cardX)
    -----------------------------------------/
    #ifndef USE_DRM

define USE_DRM 0

#endif

#if USE_DRM

define DRM_CARD “/dev/dri/card0”

define DRM_CONNECTOR_ID -1 /* -1 for the first connected one */

#endif

/*********************

  • INPUT DEVICES
    *********************/

/*--------------

  • XPT2046
    --------------/
    #ifndef USE_XPT2046

define USE_XPT2046 0

#endif

#if USE_XPT2046

define XPT2046_HOR_RES 480

define XPT2046_VER_RES 320

define XPT2046_X_MIN 200

define XPT2046_Y_MIN 200

define XPT2046_X_MAX 3800

define XPT2046_Y_MAX 3800

define XPT2046_AVG 4

define XPT2046_X_INV 0

define XPT2046_Y_INV 0

define XPT2046_XY_SWAP 0

#endif

/*-----------------

  • FT5406EE8
    -----------------/
    #ifndef USE_FT5406EE8

define USE_FT5406EE8 0

#endif

#if USE_FT5406EE8

define FT5406EE8_I2C_ADR 0x38 /7 bit address/

#endif

/*---------------

  • AD TOUCH
    --------------/
    #ifndef USE_AD_TOUCH

define USE_AD_TOUCH 0

#endif

#if USE_AD_TOUCH
/No settings/
#endif

/*---------------------------------------

  • Mouse or touchpad on PC (using SDL)
    -------------------------------------/
    /*DEPRECATED: Use the SDL driver instead. */
    #ifndef USE_MOUSE

define USE_MOUSE 0

#endif

#if USE_MOUSE
/No settings/
#endif

/*-------------------------------------------

  • Mousewheel as encoder on PC (using SDL)
    ------------------------------------------/
    /*DEPRECATED: Use the SDL driver instead. */
    #ifndef USE_MOUSEWHEEL

define USE_MOUSEWHEEL 0

#endif

#if USE_MOUSEWHEEL
/No settings/
#endif

#if 0
/*-------------------------------------------------

  • Touchscreen, mouse/touchpad or keyboard as libinput interface (for Linux based systems)
    ------------------------------------------------/
    #ifndef USE_LIBINPUT

define USE_LIBINPUT 0

#endif

#ifndef USE_BSD_LIBINPUT

define USE_BSD_LIBINPUT 0

#endif

#if USE_LIBINPUT || USE_BSD_LIBINPUT
/*If only a single device of the same type is connected, you can also auto detect it, e.g.:
#define LIBINPUT_NAME libinput_find_dev(LIBINPUT_CAPABILITY_TOUCH, false)/

define LIBINPUT_NAME “/dev/input/event0” /You can use the “evtest” Linux tool to get the list of devices and test them/

#endif /USE_LIBINPUT || USE_BSD_LIBINPUT/

#endif
/*-------------------------------------------------

  • Mouse or touchpad as evdev interface (for Linux based systems)
    ------------------------------------------------/
    #ifndef USE_EVDEV

define USE_EVDEV 1

#endif

#ifndef USE_BSD_EVDEV

define USE_BSD_EVDEV 0

#endif

#if USE_EVDEV || USE_BSD_EVDEV

define EVDEV_NAME “/dev/input/event0” /You can use the “evtest” Linux tool to get the list of devices and test them/

define EVDEV_SWAP_AXES 1 /Swap the x and y axes of the touchscreen/

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 0 /to invert axis swap EVDEV_XXX_MIN by EVDEV_XXX_MAX/

define EVDEV_HOR_MAX 1280 /“evtest” Linux tool can help to get the correct calibraion values>/

define EVDEV_VER_MIN 0

define EVDEV_VER_MAX 800

endif /EVDEV_CALIBRATE/

#endif /USE_EVDEV/

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_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_drv1;

/*注册屏幕驱动*/
lv_disp_drv_init(&disp_drv1);
disp_drv1.draw_buf	= &disp_buf;
disp_drv1.flush_cb	= fbdev_flush;
disp_drv1.hor_res	= LCD_DISPLAY_WIDTH;
disp_drv1.ver_res	= LCD_DISPLAY_HEIGHT;
disp_drv1.sw_rotate = 2;   // add for rotation
disp_drv1.screen_transp = 1;
disp_drv1.rotated = LV_DISP_ROT_270;
lv_disp_drv_register(&disp_drv1); 
lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_TRANSP,0);

evdev_init();
lv_indev_drv_t indev_drv_1;
lv_indev_drv_init(&indev_drv_1);
indev_drv_1.type =LV_INDEV_TYPE_POINTER;
indev_drv_1.read_cb =evdev_read;
lv_indev_drv_register(&indev_drv_1);

lv_example_style_back(1);
lv_style_button();
    lvgl_clock_start();

while(1) {
    lv_timer_handler();
    usleep(5000);
}

return 0;

}

void lv_style_button(void)
{
static lv_style_t style_label;
static lv_style_t style_btn;
lv_style_init(&style_btn);
lv_style_init(&style_label);

lv_obj_t * btn1 = lv_btn_create(lv_scr_act());
lv_obj_add_event_cb(btn1, event_handler_1, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_set_size(btn1, 100, 50); 
lv_obj_set_pos(btn1, 200,600); 
//lv_obj_align_to(btn1, lv_layer_top(), LV_ALIGN_BOTTOM_LEFT, 0, 0); 
lv_style_set_radius(&style_btn,  20);
//lv_style_set_shadow_opa(&style_btn,  LV_OPA_30);	
lv_style_set_bg_opa(&style_btn,  255);	
lv_obj_add_flag(btn1, LV_OBJ_FLAG_CHECKABLE);
lv_style_set_bg_color( &style_btn, lv_color_white());
lv_obj_add_style(btn1, &style_btn, 0); 

}

static void event_handler_1(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t *sw = lv_event_get_target(e);

    if(code == LV_EVENT_VALUE_CHANGED) {
    if (lv_obj_has_state(sw, LV_STATE_CHECKED))
{
	printf("IPC ON WORKING\n");
	lv_example_style_back(0);
}
else
{
	lv_example_style_back(1);
}
}

}

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.