diff options
Diffstat (limited to 'recipes/piccontrol')
-rw-r--r-- | recipes/piccontrol/files/configlocation.patch | 13 | ||||
-rw-r--r-- | recipes/piccontrol/files/init | 37 | ||||
-rw-r--r-- | recipes/piccontrol/files/luafix-0.4.patch | 20 | ||||
-rw-r--r-- | recipes/piccontrol/files/piccontrol-0.4.conf | 45 | ||||
-rw-r--r-- | recipes/piccontrol/piccontrol_0.4.bb | 27 |
5 files changed, 142 insertions, 0 deletions
diff --git a/recipes/piccontrol/files/configlocation.patch b/recipes/piccontrol/files/configlocation.patch new file mode 100644 index 0000000000..08cb60096b --- /dev/null +++ b/recipes/piccontrol/files/configlocation.patch @@ -0,0 +1,13 @@ +diff --git a/piccontrol.c.orig b/piccontrol.c +index 6c2fba3..e29eb33 100644 +--- a/piccontrol.c.orig ++++ b/piccontrol.c +@@ -231,7 +231,7 @@ static int pic_lua_setup() + lua_register(lua, "register", register_module); + lua_register(lua, "piccmd", run_command_lua); + +- luaL_dofile(lua, "config.lua"); ++ luaL_dofile(lua, "/etc/piccontrol.conf"); + + return 0; + } diff --git a/recipes/piccontrol/files/init b/recipes/piccontrol/files/init new file mode 100644 index 0000000000..3f2e511183 --- /dev/null +++ b/recipes/piccontrol/files/init @@ -0,0 +1,37 @@ +#! /bin/sh +# piccontrol - simple init.d piccontrol script - tim.ellis@foonas.org +set -e + +if [ ! -f /usr/sbin/piccontrol ]; then + echo -n "Warning: piccontrol binary not found. Shutting down" + shutdown -h now + exit -1 +fi + +case "$1" in + start) + echo -n "Starting piccontrol: " + rm -f /var/run/piccontrol.sock + start-stop-daemon -S -b -n piccontrol -a /usr/sbin/piccontrol -- -d + sleep 1 + piccontrol statusled greenon + piccontrol powerled on + piccontrol buzzer short + echo "done" + ;; + stop) + echo -n "Stopping piccontrol: " + start-stop-daemon -K -n piccontrol >&- 2>&- & + echo "done" + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage: piccontrol { start | stop | restart }" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/recipes/piccontrol/files/luafix-0.4.patch b/recipes/piccontrol/files/luafix-0.4.patch new file mode 100644 index 0000000000..453582cad9 --- /dev/null +++ b/recipes/piccontrol/files/luafix-0.4.patch @@ -0,0 +1,20 @@ +diff -urN qcontrol-0.4.old//Makefile qcontrol-0.4//Makefile +--- qcontrol-0.4.old//Makefile 2008-05-11 23:32:11.000000000 +0100 ++++ qcontrol-0.4//Makefile 2008-10-25 23:53:15.820091908 +0100 +@@ -1,5 +1,5 @@ +-CFLAGS=-Os -Wall -I /usr/include/lua5.1 +-LDFLAGS=-llua5.1 -lpthread ++CFLAGS=-Os -Wall ++LDFLAGS=-lpthread -lm -ldl + SOURCES=piccontrol.c ts209.c evdev.c + OBJECTS=$(SOURCES:.c=.o) + EXECUTABLE=piccontrol +@@ -7,7 +7,7 @@ + all: $(SOURCES) $(EXECUTABLE) + + $(EXECUTABLE): $(OBJECTS) +- $(CC) $(LDFLAGS) $(OBJECTS) -o $@ ++ $(CC) -o $@ $(OBJECTS) $(LDFLAGS) + + .cpp.o: + $(CC) $(CFLAGS) $< -o $@ diff --git a/recipes/piccontrol/files/piccontrol-0.4.conf b/recipes/piccontrol/files/piccontrol-0.4.conf new file mode 100644 index 0000000000..9d8bf31826 --- /dev/null +++ b/recipes/piccontrol/files/piccontrol-0.4.conf @@ -0,0 +1,45 @@ +register("ts209") + +register("evdev", "/dev/input/event0", + 116, "restart_button", + 408, "media_button") + +function power_button( time ) + os.execute("poweroff") +end + +fanfail = 0 + +function fan_error( ) + fanfail = fanfail + 1 + if fanfail == 3 then + print("ts209: fan error") + piccmd("statusled", "red2hz") + piccmd("buzzer", "long") + else + if fanfail == 10 then + fanfail = 0 + end + end +end + +function fan_normal( ) + piccmd("statusled", "greenon") + fanfail = 0 +end + +function temp_low( ) + piccmd("fanspeed", "silence") +end + +function temp_high( ) + piccmd("fanspeed", "full") +end + +function restart_button( time ) + os.execute("reboot") +end + +function media_button( time ) + piccmd("usbled", "8hz") +end diff --git a/recipes/piccontrol/piccontrol_0.4.bb b/recipes/piccontrol/piccontrol_0.4.bb new file mode 100644 index 0000000000..cfdef98b3c --- /dev/null +++ b/recipes/piccontrol/piccontrol_0.4.bb @@ -0,0 +1,27 @@ +DESCRIPTION = "Microcontroller utility for ARM turbostations by Byron Bradley" +SECTION = "console/network" +DEPENDS = "lua5.1" +PR = "r1" +LICENSE = "GPL" +COMPATIBLE_MACHINE = "tsx09" + +SRC_URI = "http://byronbradley.co.uk/piccontrol/qcontrol-0.4.tar.gz \ + file://luafix-0.4.patch;patch=0 \ + file://configlocation.patch;patch=1 \ + file://piccontrol-0.4.conf \ + file://init" +S = "${WORKDIR}/qcontrol-${PV}" + +inherit update-rc.d + +INITSCRIPT_NAME = "piccontrol" +INITSCRIPT_PARAMS = "defaults" + +LDFLAGS += " ${STAGING_LIBDIR}/liblua5.1.a -lpthread -lm -ldl " +CFLAGS += " -I${STAGING_INCDIR}/lua5.1 " + +do_install() { + install -D -m 0755 ${S}/piccontrol ${D}${sbindir}/piccontrol + install -D -m 0644 ${WORKDIR}/piccontrol-0.4.conf ${D}${sysconfdir}/piccontrol.conf + install -D -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/piccontrol +} |