Revert "lvgl-demo: remove vestigial Wayland logic"

We're going to be adding support for LVGL's wayland backend in the following
commits, so recover the initscript logic that ties in with said backend

This reverts commit 21d9c4f17b.

https://onedigi.atlassian.net/browse/DEL-9925

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2026-02-27 14:46:44 +01:00
parent a3927c0306
commit c360c9b757
2 changed files with 30 additions and 3 deletions

View File

@ -16,6 +16,8 @@
readonly DEMO_NAME="lvgl-demo"
readonly DEMO_PATH="/usr/bin/${DEMO_NAME}"
readonly DEMO_TITLE="LVGL Demo Application"
readonly DEMO_DISPLAY="##LVGL_DEMO_DISPLAY##"
readonly DEMO_ENV="##LVGL_DEMO_ENV##"
readonly PID_FILE="/run/${DEMO_NAME}.pid"
log() {
@ -52,6 +54,21 @@ check_is_running() {
return 1
}
wait_for_wayland() {
local count=20
local wayland_socket="/run/user/0/${DEMO_DISPLAY}"
while [ ! -S "${wayland_socket}" ]; do
sleep 1
count=$((count-1))
if [ "${count}" = 0 ]; then
return 1
fi
done
sleep 1
return 0
}
stop() {
check_is_running || return
@ -72,11 +89,15 @@ stop() {
start() {
check_is_running && { log warning "start: ${DEMO_NAME} ALREADY running"; exit 0; }
# Disable the cursor when displaying at full screen on fbdev
echo "0" > /sys/class/graphics/fbcon/cursor_blink
if [ -d "/usr/share/wayland" ]; then
wait_for_wayland
else
# Disable the cursor when displaying at full screen on fbdev
echo "0" > /sys/class/graphics/fbcon/cursor_blink
fi
# Launch demo
env ${DEMO_PATH} >/dev/null 2>&1 &
env ${DEMO_ENV} ${DEMO_PATH} >/dev/null 2>&1 &
if [ $? -eq 0 ]; then
echo $! > ${PID_FILE}

View File

@ -44,6 +44,9 @@ inherit cmake systemd update-rc.d
S = "${WORKDIR}/git"
LVGL_DEMO_ENV ?= "DISPLAY=:0.0 XDG_RUNTIME_DIR=/run/user/0 WAYLAND_DISPLAY=\$\{DEMO_DISPLAY\}"
LVGL_DEMO_ENV:ccimx6ul ?= ""
do_configure:prepend() {
if [ "${LVGL_CONFIG_USE_SDL}" -eq 1 ] ; then
# Add libsdl build dependency, SDL2_image has no cmake file
@ -68,6 +71,9 @@ do_install:append() {
sed -i -e 's,##LVGL_CONFIG_DRM_CARD##,${LVGL_CONFIG_DRM_CARD},g' \
-i -e 's,##LVGL_CONFIG_FBDEV_DEVICE##,${LVGL_CONFIG_FBDEV_DEVICE},g' \
-i ${D}${sysconfdir}/lvgl-demo-init
sed -i -e "s@##LVGL_DEMO_DISPLAY##@${WAYLAND_DISPLAY}@g" \
-e "s@##LVGL_DEMO_ENV##@${LVGL_DEMO_ENV}@g" \
"${D}${sysconfdir}/lvgl-demo-init"
ln -sf ${sysconfdir}/lvgl-demo-init ${D}${sysconfdir}/init.d/lvgl-demo-init
}