summaryrefslogtreecommitdiff
path: root/recipes/avr-evtd
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/avr-evtd
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/avr-evtd')
-rw-r--r--recipes/avr-evtd/avr-evtd_1.7.2.bb43
-rwxr-xr-xrecipes/avr-evtd/files/EventScript110
-rw-r--r--recipes/avr-evtd/files/avr_evtd.conf6
-rw-r--r--recipes/avr-evtd/files/dont-ignore-config.patch11
-rwxr-xr-xrecipes/avr-evtd/files/init124
-rw-r--r--recipes/avr-evtd/files/mipsel/avr_evtd.conf6
6 files changed, 300 insertions, 0 deletions
diff --git a/recipes/avr-evtd/avr-evtd_1.7.2.bb b/recipes/avr-evtd/avr-evtd_1.7.2.bb
new file mode 100644
index 0000000000..7d79b42467
--- /dev/null
+++ b/recipes/avr-evtd/avr-evtd_1.7.2.bb
@@ -0,0 +1,43 @@
+DESCRIPTION = "A simple and small user space interface daemon to the Linkstation/Kuro AVR micro-controller"
+HOMEPAGE = "http://sourceforge.net/projects/ppc-evtd"
+SECTION = "console/network"
+PR = "r1"
+LICENSE = "GPL"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/ppc-evtd/avr_evtd_${PV}.release.tar.gz \
+ file://dont-ignore-config.patch;patch=1 \
+ file://avr_evtd.conf \
+ file://EventScript \
+ file://init"
+S = "${WORKDIR}/usr/src/avr_evtd"
+
+inherit update-rc.d
+
+COMPATIBLE_MACHINE = "(lsppchd|lsppchg|lsmipsel)"
+INITSCRIPT_NAME = "avr-evtd"
+INITSCRIPT_PARAMS = "defaults"
+
+# This is a simple thing and we will only ever need this for powerpc and mipsel
+# on the platforms above. Pretty important though to stop death by watchdog.
+
+do_compile_powerpc() {
+ ${CC} ${CFLAGS} ${LDFLAGS} -o PPC/avr_evtd avr_evtd.c -DNO_MELCO -DUBOOT
+}
+
+do_compile_mipsel() {
+ ${CC} ${CFLAGS} ${LDFLAGS} -o MIPS/avr_evtd avr_evtd.c -DNO_MELCO -DUBOOT -DMIPS
+}
+
+do_install() {
+ install -D -m 0644 ${WORKDIR}/avr_evtd.conf ${D}${sysconfdir}/default/avr_evtd
+ install -D -m 0755 ${WORKDIR}/EventScript ${D}${sysconfdir}/avr_evtd/EventScript
+ install -D -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/avr-evtd
+}
+
+do_install_append_powerpc() {
+ install -D -m 0755 ${S}/PPC/avr_evtd ${D}${sbindir}/avr_evtd
+}
+
+do_install_append_mipsel() {
+ install -D -m 0755 ${S}/MIPS/avr_evtd ${D}${sbindir}/avr_evtd
+}
diff --git a/recipes/avr-evtd/files/EventScript b/recipes/avr-evtd/files/EventScript
new file mode 100755
index 0000000000..f9824d37c8
--- /dev/null
+++ b/recipes/avr-evtd/files/EventScript
@@ -0,0 +1,110 @@
+#!/bin/sh
+# Sample Event Script written by Bob Perry
+#
+# Enters via the avr_evtd daemon with the following command options:
+# 0 - Special event following double press of the 'red' reset button
+# 1 - AVR device has requested a halt due to error
+# 2 - Shutdown request from timed shutdown logic
+# 3 - User has released the power button
+# 4 - User has pressed the power button
+# 5 - User has released the 'red' reset button
+# 6 - User has pressed the reset button
+# 7 - User has held the power button > 3 seconds
+# 8 - User has held the reset button > 3 seconds
+# 9 - Disk used beyond DISKCHECK%
+# F - Fan failure event, fan stopped for > FANSTOP seconds
+# E - User selected EM-Mode
+# S - Five minute shutdown warning event
+# D - Error message handler
+
+DEVICE=$2
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
+tag=avr-daemon
+facility=user.info
+
+. /etc/default/avr_evtd
+
+if [ "$DEBUG" = "ON" ] && [ -d "$LOG" ]; then
+ echo "`date` command is $1[$3] for $DEVICE" >> $LOG/avr_evtd.log
+fi
+
+if [ -f "/tmp/.inst-instflashing" ] ; then
+ if [ ! -f "/tmp/.inst-instdone" ] ; then
+ NOCMD="1"
+ fi
+fi
+
+case "$1" in
+ 0) case "$3" in
+ 1) # Indicate this mode by flashing the DISK FULL LED
+ echo -n "YYYY" > $DEVICE
+ # Add an EM IP address or if no ethernet, start it up
+ FAIL=1
+ route -n | grep -q eth0 && FAIL=0
+ if [ "$FAIL" -eq 0 ]; then
+ FAIL=1
+ route -n | grep -q 192.168.11.0 && FAIL=0
+ if [ "$FAIL" -eq 1 ]; then
+ ifconfig eth0:EM 192.168.11.150 netmask 255.255.255.0 up
+ fi
+ else
+ /sbin/ifup --force -a -i /etc/avr_evtd/emergency_eth0
+ sleep 1
+ route add -net 192.168.11.0 netmask 255.255.255.255.0 eth0:EM
+ fi
+ if [ -e /sbin/utelnetd ]; then
+ utelnetd -p 1234 -l /bin/bash &
+ fi ;;
+ 3) # Flash more lights to indicate we are desperate
+ echo -n "SSSS" > $DEVICE
+ ;;
+ *) exit -2 ;;
+ esac ;;
+ 3) echo -n "[avr_evtd]: Power Button Up"
+ ;;
+ 4) echo -n "[avr_evtd]: Power Button Down"
+ ;;
+ 5) echo -n "[avr_evtd]: Reset Button Up"
+ ;;
+ 6) echo -n "[avr_evtd]: Reset Button Down"
+ ;;
+ 1|2|7) echo -n "[avr_evtd]: Shutdown"
+ if [ ! "$NOCMD" = "1" ] ; then
+ echo -n "EEEE" > $DEVICE
+ halt
+ fi ;;
+ 8) echo -n "[avr_evtd]: User demanded reset"
+ if [ ! "$NOCMD" = "1" ] ; then
+ echo -n "CCCC" > $DEVICE
+ reboot
+ fi ;;
+ 9) if [ "$3" -eq 0 ]; then
+ echo -n "[avr_evtd]: Disk usage now safe"
+ else
+ echo -n "[avr_evtd]: Disk used $3% > Monitored $DISKCHECK%"
+ fi ;;
+ E) echo -n "[avr_evtd]: EM mode selected"
+ ;;
+ F) echo -n "[avr_evtd]: Fan failure detected"
+ if [ "$3" -eq 0 ]; then
+ logger -p user.emerg 'AVR Detected fan fault'
+ fi
+ if [ "$3" -eq 4 ]; then
+ # Illuminate relevant LED and wait for AVR halt message
+ echo -n "iiii" > $DEVICE
+ fi ;;
+ S) if [ "$3" -gt 100 ]; then
+ MESSAGE="System shutdown in less than 5 minutes"
+ else
+ MESSAGE="Shutdown delayed by $3 minutes"
+ fi
+ # Produce relevant message
+ logger -p user.emerg $MESSAGE ;;
+ D) MESSAGE="[$3] Error with configuration file"
+ logger -t $tag -p $facility $MESSAGE ;;
+ *) exit 1
+ ;;
+esac
+
+exit 0
diff --git a/recipes/avr-evtd/files/avr_evtd.conf b/recipes/avr-evtd/files/avr_evtd.conf
new file mode 100644
index 0000000000..c48d28d081
--- /dev/null
+++ b/recipes/avr-evtd/files/avr_evtd.conf
@@ -0,0 +1,6 @@
+LOG=/var/log
+DEBUG=ON
+TIMER=OFF
+DISKCHECK=0
+EMMODE=NO
+REFRESH=0
diff --git a/recipes/avr-evtd/files/dont-ignore-config.patch b/recipes/avr-evtd/files/dont-ignore-config.patch
new file mode 100644
index 0000000000..77b3f92fab
--- /dev/null
+++ b/recipes/avr-evtd/files/dont-ignore-config.patch
@@ -0,0 +1,11 @@
+--- avr_evtd.old/avr_evtd.c 2006-10-29 12:27:28.000000000 -0600
++++ avr_evtd/avr_evtd.c 2007-12-11 09:38:40.000000000 -0600
+@@ -108,7 +108,7 @@
+ TIMER* poffTimer=NULL;
+ TIMER* ponTimer=NULL;
+ int i_FileDescriptor = 0;
+-time_t tt_LastMelcoAcess = 0;
++time_t tt_LastMelcoAcess = -1;
+ int i_TimerFlag = 0;
+ long l_ShutdownTimer=9999; /* Careful here */
+ char c_FirstTimeFlag=1;
diff --git a/recipes/avr-evtd/files/init b/recipes/avr-evtd/files/init
new file mode 100755
index 0000000000..34ea528926
--- /dev/null
+++ b/recipes/avr-evtd/files/init
@@ -0,0 +1,124 @@
+#!/bin/sh
+#
+# avr_evtd Linkstation/Kuro AVR daemon
+#
+# Other files used are:
+# /etc/default/avr_evtd - Optional configuration file
+# /etc/avr_evtd/EventScript - Provides user with scripted
+# AVR event points
+# Optional files:
+# /etc/melco/timer_Sleep - Standard Melco sleep settings
+#
+# Written by Bob Perry (2006) lb-source@users.sourceforge.net
+#
+
+#
+# Location of the avr watchdog daemon and the init directory
+#
+DAEMON=/usr/sbin/avr_evtd
+initdir=/etc/init.d
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
+tag=linkstation
+facility=user.info
+
+test -e $DAEMON || exit 0
+
+getDevice()
+{
+ #
+ # Load custom settings
+ #
+ MIPS=NO
+
+ #
+ # Populate the configured settings
+ #
+ [ -f /etc/default/avr_evtd ] && . /etc/default/avr_evtd > /dev/null 2>&1
+
+ # Try and determine the UART used. The MIPS only has one UART
+ # available and the process is built accordingly. To support modified
+ # kernel's/kuro systems with polled over UARTs, drill into kernel
+ # configuration for the memory configuration of the UART to determine
+ # which tty to use if not set in the configuration file
+ uname -m | grep -q mips && MIPS=YES && DEVICE=/dev/ttyS0
+
+ if [ -z "$DEVICE" ] && [ "$MIPS" = "NO" ]
+ then
+ DEVICE=/dev/ttyS0
+ # Search for valid port address
+ PORT_ADDRESS=`$DAEMON -i -d /dev/ttyS1`
+ if [ $PORT_ADDRESS -eq 80004500 ] ; then DEVICE=/dev/ttyS1 ; fi
+ fi
+}
+
+start()
+{
+ #
+ # Daemon options
+ # e.g -d /dev/ttyS1
+ #
+ daemonoptions=
+
+ CONSOLE=OFF
+
+ getDevice
+
+ # Establish daemon startup options based on configuration settings
+ if [ "$EMMODE" = "YES" ]; then daemonoptions=-e ; fi
+
+ if [ -n "$DEVICE" ] && [ "$MIPS" = "NO" ]
+ then
+ [ -n "$daemonoptions" ] && daemonoptions="$daemonoptions "
+ daemonoptions="$daemonoptions-d $DEVICE"
+ fi
+
+ # Is this a MIPSEL box?
+ if [ "$MIPS" = "YES" ]
+ then
+ if [ -e /proc/linkstation ]
+ then
+ # Determine if console ttyS0 is in-use
+ CONSOLE=`cat /proc/linkstation | grep CONSOLE | awk -F "=" '{print $2}'`
+ fi
+ fi
+
+ if [ "$CONSOLE" = "ON" ]
+ then
+ echo "[avr_evtd]: Not started services as console in-use"
+ logger -t $tag -p $facility 'Not started avr_evtd as kernel still has console'
+ else
+ echo "Start services: avr_evtd"
+ /sbin/start-stop-daemon --start --quiet --exec $DAEMON -- $daemonoptions
+ logger -t $tag -p $facility 'Started daemon avr_evtd'
+ fi
+}
+
+stop()
+{
+ echo "Stop services: avr_evtd"
+ /sbin/start-stop-daemon --stop --quiet --exec $DAEMON
+ logger -t $tag -p $facility 'Stopped daemon avr_evtd'
+}
+
+# Check request
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ sleep 1
+ start
+ ;;
+ *)
+ echo "Usage: $DAEMON {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 0
+
+
diff --git a/recipes/avr-evtd/files/mipsel/avr_evtd.conf b/recipes/avr-evtd/files/mipsel/avr_evtd.conf
new file mode 100644
index 0000000000..c48d28d081
--- /dev/null
+++ b/recipes/avr-evtd/files/mipsel/avr_evtd.conf
@@ -0,0 +1,6 @@
+LOG=/var/log
+DEBUG=ON
+TIMER=OFF
+DISKCHECK=0
+EMMODE=NO
+REFRESH=0