From 202e142d68ce77e47aa355af2eee359a23fb5ca3 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 1 May 2024 18:02:25 +0200 Subject: weston-init: generalize override from am62 to k3 Related-to: ELB-5482 Signed-off-by: Max Krummenacher --- recipes-graphics/wayland/weston-init.bbappend | 10 +- recipes-graphics/wayland/weston-init/am62xx/init | 129 --------------------- .../wayland/weston-init/am62xx/runWeston | 39 ------- .../wayland/weston-init/am62xx/wayland_env.sh | 12 -- .../wayland/weston-init/am62xx/weston.ini | 15 --- recipes-graphics/wayland/weston-init/k3/init | 129 +++++++++++++++++++++ recipes-graphics/wayland/weston-init/k3/runWeston | 39 +++++++ .../wayland/weston-init/k3/wayland_env.sh | 12 ++ recipes-graphics/wayland/weston-init/k3/weston.ini | 15 +++ 9 files changed, 200 insertions(+), 200 deletions(-) delete mode 100644 recipes-graphics/wayland/weston-init/am62xx/init delete mode 100644 recipes-graphics/wayland/weston-init/am62xx/runWeston delete mode 100644 recipes-graphics/wayland/weston-init/am62xx/wayland_env.sh delete mode 100644 recipes-graphics/wayland/weston-init/am62xx/weston.ini create mode 100644 recipes-graphics/wayland/weston-init/k3/init create mode 100644 recipes-graphics/wayland/weston-init/k3/runWeston create mode 100644 recipes-graphics/wayland/weston-init/k3/wayland_env.sh create mode 100644 recipes-graphics/wayland/weston-init/k3/weston.ini diff --git a/recipes-graphics/wayland/weston-init.bbappend b/recipes-graphics/wayland/weston-init.bbappend index 05a45eb..a280e6e 100644 --- a/recipes-graphics/wayland/weston-init.bbappend +++ b/recipes-graphics/wayland/weston-init.bbappend @@ -1,20 +1,20 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" -PR:append:am62xx = ".arago12" +PR:append:k3 = ".arago12" -PACKAGECONFIG:append:am62xx:tdx = " \ +PACKAGECONFIG:append:k3:tdx = " \ no-idle-timeout \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland','', d)} \ " PACKAGECONFIG[xwayland] = ",," -SRC_URI:append:am62xx = " \ +SRC_URI:append:k3 = " \ file://runWeston \ file://wayland_env.sh \ file://weston.ini \ " -do_install:append:am62xx () { +do_install:append:k3 () { install -d ${D}${bindir} install -m 755 ${WORKDIR}/runWeston ${D}${bindir} @@ -27,4 +27,4 @@ do_install:append:am62xx () { fi } -FILES:${PN}:append:am62xx = "${sysconfdir}/profile.d/* ${sysconfdir}/weston.ini" +FILES:${PN}:append:k3 = "${sysconfdir}/profile.d/* ${sysconfdir}/weston.ini" diff --git a/recipes-graphics/wayland/weston-init/am62xx/init b/recipes-graphics/wayland/weston-init/am62xx/init deleted file mode 100644 index fa3f037..0000000 --- a/recipes-graphics/wayland/weston-init/am62xx/init +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/sh -# -### BEGIN INIT INFO -# Provides: weston -# Required-Start: $local_fs $remote_fs -# Required-Stop: $local_fs $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -### END INIT INFO - -killproc() { - all_pids=`/bin/pidof $1` - - # busybox pidof doesn't ommit the current pid - # as this script is called weston on the target - # in thinlinux with a busybox based utility load - # later killproc operations end up killing this - # script. - for pid in $all_pids - do - if [ "$pid" != "$$" ]; then - kill_pids+=$pid - fi - done - - [ "$kill_pids" != "" ] && kill $kill_pids -} - -read CMDLINE < /proc/cmdline -for x in $CMDLINE; do - case $x in - weston=false) - echo "Weston disabled" - exit 0; - ;; - esac -done - -case "$1" in - start) - . /etc/profile - - # Weston for some reason dies if these environment variables are set - unset WAYLAND_DISPLAY - - # This is all a nasty hack - if test -z "$XDG_RUNTIME_DIR"; then - export XDG_RUNTIME_DIR=/run/user/root - fi - - if [ ! -d "$XDG_RUNTIME_DIR" ] ; then - mkdir --parents $XDG_RUNTIME_DIR - chmod 0700 $XDG_RUNTIME_DIR - fi - - echo "Starting Weston" - - if [ ! -d "/dev/input" ]; then - echo "Waiting for input device..." - killproc weston - sleep 3 - fi - - openvt -c 4 -f runWeston - - # If there's no touchscreen device available, done - if [ ! -e /dev/input/touchscreen0 ] ; then - exit 0 - fi - - # If it was already calibrated, done - if [ -f "$WS_CALUDEV_FILE" ] ; then - exit 0 - fi - - # Check if SD card is mounted - mount | grep /run/media/mmcblk0p1 | grep vfat > /dev/null 2>&1 - if [ "$?" = "0" ] ; then - SD_MOUNTED="1" - else - SD_MOUNTED="0" - fi - - # Check if SD card has a calibration rules file - SD_CALUDEV_FILE=/run/media/mmcblk0p1/ws-calibrate.rules - if [ "$SD_MOUNTED" = "1" -a -f "$SD_CALUDEV_FILE" ] ; then - # Copy it over to udev location - cp "$SD_CALUDEV_FILE" "$WS_CALUDEV_FILE" - else - # Run a calibration app and save output to udev rules - echo "Calibrating touchscreen (first time only)" - echo - echo "*** To continue, please complete the touchscreen calibration" - echo -n "*** by touching the crosshairs on the LCD screen" - sleep 2 - CAL_VALUES=`weston-calibrator|cut -c21-` - echo 'SUBSYSTEM=="input", ENV{WL_CALIBRATION}="'$CAL_VALUES'"' > $WS_CALUDEV_FILE - echo "." - # Copy it back to SD - if [ "$SD_MOUNTED" = "1" ] ; then - cp "$WS_CALUDEV_FILE" "$SD_CALUDEV_FILE" - fi - fi - - # Reload and re-run udev rules and restart weston - udevadm control --reload - udevadm trigger - killproc weston - sleep 2 - openvt -c 4 -f runWeston - ;; - - stop) - echo "Stopping Weston" - killproc weston - ;; - - restart) - $0 stop - sleep 2 - $0 start - ;; - - *) - echo "usage: $0 { start | stop | restart }" - ;; -esac - -exit 0 diff --git a/recipes-graphics/wayland/weston-init/am62xx/runWeston b/recipes-graphics/wayland/weston-init/am62xx/runWeston deleted file mode 100644 index 2751352..0000000 --- a/recipes-graphics/wayland/weston-init/am62xx/runWeston +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh - -clear -cat << EOF - - - - - - - - - - - - - - - - - Please wait... - - - - - - - - - - - - - - - -EOF - -weston --idle-time=0 --backend=drm-backend.so >> /var/log/weston.log 2>&1 diff --git a/recipes-graphics/wayland/weston-init/am62xx/wayland_env.sh b/recipes-graphics/wayland/weston-init/am62xx/wayland_env.sh deleted file mode 100644 index 50979b3..0000000 --- a/recipes-graphics/wayland/weston-init/am62xx/wayland_env.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -### Wayland Environment Variables ### - -export XDG_CONFIG_HOME=/etc/ -export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir -export WS_CALUDEV_FILE=/etc/udev/rules.d/ws-calibrate.rules - -if ! test -d "${XDG_RUNTIME_DIR}"; then - mkdir -p "${XDG_RUNTIME_DIR}" - chmod 0700 "${XDG_RUNTIME_DIR}" -fi diff --git a/recipes-graphics/wayland/weston-init/am62xx/weston.ini b/recipes-graphics/wayland/weston-init/am62xx/weston.ini deleted file mode 100644 index 1b52125..0000000 --- a/recipes-graphics/wayland/weston-init/am62xx/weston.ini +++ /dev/null @@ -1,15 +0,0 @@ -[core] -require-input=false - -[shell] -locking=false -animation=zoom -panel-position=top -startup-animation=fade - -#[libinput] -#enable_tap=true - -[screensaver] -# Uncomment path to disable screensaver -#path=@libexecdir@/weston-screensaver diff --git a/recipes-graphics/wayland/weston-init/k3/init b/recipes-graphics/wayland/weston-init/k3/init new file mode 100644 index 0000000..fa3f037 --- /dev/null +++ b/recipes-graphics/wayland/weston-init/k3/init @@ -0,0 +1,129 @@ +#!/bin/sh +# +### BEGIN INIT INFO +# Provides: weston +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +### END INIT INFO + +killproc() { + all_pids=`/bin/pidof $1` + + # busybox pidof doesn't ommit the current pid + # as this script is called weston on the target + # in thinlinux with a busybox based utility load + # later killproc operations end up killing this + # script. + for pid in $all_pids + do + if [ "$pid" != "$$" ]; then + kill_pids+=$pid + fi + done + + [ "$kill_pids" != "" ] && kill $kill_pids +} + +read CMDLINE < /proc/cmdline +for x in $CMDLINE; do + case $x in + weston=false) + echo "Weston disabled" + exit 0; + ;; + esac +done + +case "$1" in + start) + . /etc/profile + + # Weston for some reason dies if these environment variables are set + unset WAYLAND_DISPLAY + + # This is all a nasty hack + if test -z "$XDG_RUNTIME_DIR"; then + export XDG_RUNTIME_DIR=/run/user/root + fi + + if [ ! -d "$XDG_RUNTIME_DIR" ] ; then + mkdir --parents $XDG_RUNTIME_DIR + chmod 0700 $XDG_RUNTIME_DIR + fi + + echo "Starting Weston" + + if [ ! -d "/dev/input" ]; then + echo "Waiting for input device..." + killproc weston + sleep 3 + fi + + openvt -c 4 -f runWeston + + # If there's no touchscreen device available, done + if [ ! -e /dev/input/touchscreen0 ] ; then + exit 0 + fi + + # If it was already calibrated, done + if [ -f "$WS_CALUDEV_FILE" ] ; then + exit 0 + fi + + # Check if SD card is mounted + mount | grep /run/media/mmcblk0p1 | grep vfat > /dev/null 2>&1 + if [ "$?" = "0" ] ; then + SD_MOUNTED="1" + else + SD_MOUNTED="0" + fi + + # Check if SD card has a calibration rules file + SD_CALUDEV_FILE=/run/media/mmcblk0p1/ws-calibrate.rules + if [ "$SD_MOUNTED" = "1" -a -f "$SD_CALUDEV_FILE" ] ; then + # Copy it over to udev location + cp "$SD_CALUDEV_FILE" "$WS_CALUDEV_FILE" + else + # Run a calibration app and save output to udev rules + echo "Calibrating touchscreen (first time only)" + echo + echo "*** To continue, please complete the touchscreen calibration" + echo -n "*** by touching the crosshairs on the LCD screen" + sleep 2 + CAL_VALUES=`weston-calibrator|cut -c21-` + echo 'SUBSYSTEM=="input", ENV{WL_CALIBRATION}="'$CAL_VALUES'"' > $WS_CALUDEV_FILE + echo "." + # Copy it back to SD + if [ "$SD_MOUNTED" = "1" ] ; then + cp "$WS_CALUDEV_FILE" "$SD_CALUDEV_FILE" + fi + fi + + # Reload and re-run udev rules and restart weston + udevadm control --reload + udevadm trigger + killproc weston + sleep 2 + openvt -c 4 -f runWeston + ;; + + stop) + echo "Stopping Weston" + killproc weston + ;; + + restart) + $0 stop + sleep 2 + $0 start + ;; + + *) + echo "usage: $0 { start | stop | restart }" + ;; +esac + +exit 0 diff --git a/recipes-graphics/wayland/weston-init/k3/runWeston b/recipes-graphics/wayland/weston-init/k3/runWeston new file mode 100644 index 0000000..2751352 --- /dev/null +++ b/recipes-graphics/wayland/weston-init/k3/runWeston @@ -0,0 +1,39 @@ +#!/bin/sh + +clear +cat << EOF + + + + + + + + + + + + + + + + + Please wait... + + + + + + + + + + + + + + + +EOF + +weston --idle-time=0 --backend=drm-backend.so >> /var/log/weston.log 2>&1 diff --git a/recipes-graphics/wayland/weston-init/k3/wayland_env.sh b/recipes-graphics/wayland/weston-init/k3/wayland_env.sh new file mode 100644 index 0000000..50979b3 --- /dev/null +++ b/recipes-graphics/wayland/weston-init/k3/wayland_env.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +### Wayland Environment Variables ### + +export XDG_CONFIG_HOME=/etc/ +export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir +export WS_CALUDEV_FILE=/etc/udev/rules.d/ws-calibrate.rules + +if ! test -d "${XDG_RUNTIME_DIR}"; then + mkdir -p "${XDG_RUNTIME_DIR}" + chmod 0700 "${XDG_RUNTIME_DIR}" +fi diff --git a/recipes-graphics/wayland/weston-init/k3/weston.ini b/recipes-graphics/wayland/weston-init/k3/weston.ini new file mode 100644 index 0000000..1b52125 --- /dev/null +++ b/recipes-graphics/wayland/weston-init/k3/weston.ini @@ -0,0 +1,15 @@ +[core] +require-input=false + +[shell] +locking=false +animation=zoom +panel-position=top +startup-animation=fade + +#[libinput] +#enable_tap=true + +[screensaver] +# Uncomment path to disable screensaver +#path=@libexecdir@/weston-screensaver -- cgit v1.2.3