Description
Hi everyone.
I have recently designed my project for Raspberry Pi Zero 2W + 3.5" SPI TFT Touch Display using fbdef and evdev.
Then I decided to switch to Rasoberry Pi 4 Model B with official RPI Touch Display 2. Here I decided to use drm and libinput. For drm mode everything was pretty straightforward:
- install libdrm:
sudo apt-get install libdrm-dev
- switch do drm in config:
#define LV_USE_LINUX_FBDEV 0
#define LV_USE_LINUX_DRM 1
- disable X server if it is active before you start your app (only one master may present for drm):
sudo systemctl stop lightdm
Unfortunately I had to spend some time before I figured out how I can enable libinput. Here (https://forum.lvgl.io/t/what-drm-and-libinput-library-versions-is-lvgl-expecting/18426) someone described such problem and provided solution, but for me it was much easier:
- install libinput
sudo apt-get install libinput-dev
- switch to libinput in config:
#define LV_USE_EVDEV 0
#define LV_USE_LIBINPUT 1
- link
libinput
in CMakeLists.txt:
pkg_check_modules(LIBINPUT REQUIRED libinput)
target_include_directories(lvgl PUBLIC ${LIBINPUT_INCLUDE_DIRS})
target_link_libraries(....... ${LIBDRM_LIBRARIES} ${LIBINPUT_LIBRARIES} .......)
- add its support to your code too as described here https://docs.lvgl.io/master/details/integration/driver/libinput.html
I hope it will help to some newbies like me. And I think it would be a great idea to add libinput linking to CMakeLists.txt in that repo and additional instructions for that.
Thank you!