How to auto-detect Touch Event Device?


Raspberry Pi 4, genuine Raspberry 7" Touch Display attached (as “DSI-1”).
My Raspberry Pi app is Touch-operated (Display = “Touch Event Device”).
7" Display rotated 180 degrees. The app works fine but . . .
lv_drv_conf.h needs modifications depending on attached USB KB and Mouse.

  • No USB KB + MS attached, use: #define EVDEV_NAME “/dev/input/event2”
  • I F USB KB + MS attached, use: #define EVDEV_NAME “/dev/input/event6”
    So, if app compiled for no KB + MS boots with KB+MS attached, it gets no touch events.
    This creates a lot of hassle when testing with/without KB + MS.

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

Raspberry Pi 4.
Windows 10 + MinGW64 Cross Compile setup using GCC compiler.

What LVGL version are you using?

v. 8.3.0

What do you want to achieve?

To have the App auto-detect and use the Touch Event Device regardless attached USB -devices.

What have you tried so far?

Not tried but noticed in lv_drv_conf.h:

   /*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*/


  1. Can this LIBINPUT stuff be used for auto-detecting the current Touch Event Device?
  2. If so, how to enable, supporting the 180 degrees rotated display (no documentation found)?


Anyone ?

you might consider using the SDL drivers that are built in LVGL.