summaryrefslogtreecommitdiffstats
path: root/recipes-ti/matrix/matrix-gui/init
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-ti/matrix/matrix-gui/init')
-rw-r--r--recipes-ti/matrix/matrix-gui/init63
1 files changed, 63 insertions, 0 deletions
diff --git a/recipes-ti/matrix/matrix-gui/init b/recipes-ti/matrix/matrix-gui/init
new file mode 100644
index 00000000..41f89cf2
--- /dev/null
+++ b/recipes-ti/matrix/matrix-gui/init
@@ -0,0 +1,63 @@
1#! /bin/sh
2
3matrixgui="/usr/bin/qtopia/demos/browser/browser"
4GUI_OPTS="-qws -nogui http://localhost:8080/index.html"
5PIDFILE="/var/run/matrix-gui-2.0.pid"
6
7test -x "$matrixgui" || exit 0
8
9export TSLIB_TSDEVICE=/dev/input/touchscreen0
10export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0
11
12case "$1" in
13 start)
14 chvt 4
15 if [ ! -f /etc/pointercal ] ; then
16 echo -n "Calibrating touchscreen (first time only)"
17 ts_calibrate
18 echo "."
19 fi
20
21 # Temporarily create the /dev/input/touchscreen0 symlink if it is
22 # not already present. On devices like am335x the driver does not
23 # report the right string in /sys/devices/platform/tsc/input/input0/modalias
24 # to match the regular expression in /etc/udev/rules.d/local.rules
25 # to have this symlink created automatically.
26 if [ ! -e /dev/input/touchscreen0 ]
27 then
28 # assume we are going to use event0
29 ln -s /dev/input/event0 /dev/input/touchscreen0
30 fi
31
32 if [ -e $PIDFILE ]; then
33 PIDDIR=/proc/$(cat $PIDFILE)
34 if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${matrixgui}" ]; then
35 echo "$DESC already started; not starting."
36 else
37 echo "Removing stale PID file $PIDFILE."
38 rm -f $PIDFILE
39 fi
40 fi
41
42 echo -n "Starting Matrix GUI application"
43 cd __MATRIX_BASE_DIR__
44 start-stop-daemon --start --quiet --background --exec node -- server.js
45 # Need to investigate how to make the second start-stop command wait
46 # until the start of node is done.
47 sleep 5
48 start-stop-daemon --start --quiet --background --exec $matrixgui -- $GUI_OPTS
49 pidof ${matrixgui} > $PIDFILE
50 echo "."
51 ;;
52
53 stop)
54 echo -n "Stopping Matrix GUI application"
55 start-stop-daemon --stop --quiet --pidfile /var/run/matrix-gui-2.0.pid
56 echo "."
57 ;;
58 *)
59 echo "Usage: /etc/init.d/matrix-gui-2.0 {start|stop}"
60 exit 1
61esac
62
63exit 0