From 322e18e05b983231ea766f567ab2bf8e662de987 Mon Sep 17 00:00:00 2001 From: Liam Howatt <30486941+liamHowatt@users.noreply.github.com> Date: Thu, 29 May 2025 10:49:18 +0200 Subject: [PATCH] fix(evdev): calibrate pointer device for touch screen device (#8282) (#8325) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: André Costa Co-authored-by: zhut --- .github/workflows/check_conf.yml | 2 +- src/drivers/evdev/lv_evdev.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check_conf.yml b/.github/workflows/check_conf.yml index c680efac97..7c21cf65f3 100644 --- a/.github/workflows/check_conf.yml +++ b/.github/workflows/check_conf.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.12 - name: Generate lv_conf_internal.h run: python lv_conf_internal_gen.py working-directory: scripts diff --git a/src/drivers/evdev/lv_evdev.c b/src/drivers/evdev/lv_evdev.c index 010ad42740..55c45a9038 100644 --- a/src/drivers/evdev/lv_evdev.c +++ b/src/drivers/evdev/lv_evdev.c @@ -179,6 +179,25 @@ lv_indev_t * lv_evdev_create(lv_indev_type_t indev_type, const char * dev_path) goto err_after_open; } + /* Detect the minimum and maximum values of the input device for calibration. */ + if(indev_type == LV_INDEV_TYPE_POINTER) { + struct input_absinfo absinfo; + if(ioctl(dsc->fd, EVIOCGABS(ABS_X), &absinfo) == 0) { + dsc->min_x = absinfo.minimum; + dsc->max_x = absinfo.maximum; + } + else { + LV_LOG_ERROR("ioctl EVIOCGABS(ABS_X) failed: %s", strerror(errno)); + } + if(ioctl(dsc->fd, EVIOCGABS(ABS_Y), &absinfo) == 0) { + dsc->min_y = absinfo.minimum; + dsc->max_y = absinfo.maximum; + } + else { + LV_LOG_ERROR("ioctl EVIOCGABS(ABS_Y) failed: %s", strerror(errno)); + } + } + lv_indev_t * indev = lv_indev_create(); if(indev == NULL) goto err_after_open; lv_indev_set_type(indev, indev_type);