diff --git a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/weston_profile.sh b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/weston_profile.sh index 308452ec8..5efd2b5bc 100644 --- a/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/weston_profile.sh +++ b/meta-digi-arm/dynamic-layers/stm-st-stm32mp/recipes-graphics/wayland/weston-init/weston_profile.sh @@ -8,11 +8,20 @@ if [ "$USER" == "root" ]; then export PULSE_RUNTIME_PATH=/run/user/`id -u root`/pulse export USE_PLAYBIN3=1 - if [ -e $XDG_RUNTIME_DIR/wayland-0 ]; then - export WAYLAND_DISPLAY=wayland-0 - else - if [ -e $XDG_RUNTIME_DIR/wayland-1 ]; then - export WAYLAND_DISPLAY=wayland-1 - fi + # Wait for 10 seconds until a Wayland socket is available + for i in {1..10}; do + if [ -e $XDG_RUNTIME_DIR/wayland-0 ]; then + export WAYLAND_DISPLAY=wayland-0 + break + elif [ -e $XDG_RUNTIME_DIR/wayland-1 ]; then + export WAYLAND_DISPLAY=wayland-1 + break + else + sleep 1 + fi + done + + if [ -z "$WAYLAND_DISPLAY" ]; then + echo "WARNING: No Wayland socket found" fi fi