diff options
Diffstat (limited to 'meta-agl-bsp/meta-ti/recipes-arago/weston-init')
3 files changed, 162 insertions, 0 deletions
diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston-init/weston-init.bbappend b/meta-agl-bsp/meta-ti/recipes-arago/weston-init/weston-init.bbappend new file mode 100644 index 000000000..041e5abe1 --- /dev/null +++ b/meta-agl-bsp/meta-ti/recipes-arago/weston-init/weston-init.bbappend @@ -0,0 +1,15 @@ +PR_append = ".arago7" + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI_append = " \ + file://runWeston \ +" + +do_install_append() { + install -d ${D}${bindir} + install -m 755 ${WORKDIR}/runWeston ${D}${bindir} + rm -rf ${D}${systemd_system_unitdir} +} + +SYSTEMD_SERVICE_${PN} = "" diff --git a/meta-agl-bsp/meta-ti/recipes-arago/weston-init/weston-init/init b/meta-agl-bsp/meta-ti/recipes-arago/weston-init/weston-init/init new file mode 100644 index 000000000..336e5af81 --- /dev/null +++ b/meta-agl-bsp/meta-ti/recipes-arago/weston-init/weston-init/init @@ -0,0 +1,108 @@ +#!/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() { + pid=`/bin/pidof $1` + [ "$pid" != "" ] && kill $pid +} + +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 + + 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 1 + 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/meta-agl-bsp/meta-ti/recipes-arago/weston-init/weston-init/runWeston b/meta-agl-bsp/meta-ti/recipes-arago/weston-init/weston-init/runWeston new file mode 100644 index 000000000..aed5d5f91 --- /dev/null +++ b/meta-agl-bsp/meta-ti/recipes-arago/weston-init/weston-init/runWeston @@ -0,0 +1,39 @@ +#!/bin/sh + +clear +cat << EOF + + + + + + + + + + + + + + + + + Please wait... + + + + + + + + + + + + + + + +EOF + +weston --idle-time=0 >> /var/log/weston.log 2>&1 |