summaryrefslogtreecommitdiff
path: root/openwrt
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2010-01-10 19:50:44 (GMT)
committerChristian Pointner <equinox@helsinki.at>2010-01-10 19:50:44 (GMT)
commitf8f458ca79d2f3a840ee87dbed9896670ed9e8e6 (patch)
tree9caf619e18349bbe12a03e5e1c3a57efb3f6433a /openwrt
parente9d4ec7889417822c777ef3adaf0c6b9ddb07975 (diff)
heartbeat initscript translates now led names
Diffstat (limited to 'openwrt')
-rw-r--r--openwrt/rhctl/Makefile2
-rwxr-xr-xopenwrt/rhctl/files/heartbeatclient.init24
-rw-r--r--openwrt/rhctl/files/rhctl.config1
3 files changed, 24 insertions, 3 deletions
diff --git a/openwrt/rhctl/Makefile b/openwrt/rhctl/Makefile
index cdf9681..82fb58e 100644
--- a/openwrt/rhctl/Makefile
+++ b/openwrt/rhctl/Makefile
@@ -18,7 +18,7 @@ PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://localhost/
-PKG_MD5SUM:=b641ecdf5c7461244ebfdc1d058031a6
+PKG_MD5SUM:=5ef6f94450062e0daf7eb2b974ace3cf
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
diff --git a/openwrt/rhctl/files/heartbeatclient.init b/openwrt/rhctl/files/heartbeatclient.init
index b201c5e..b4c6042 100755
--- a/openwrt/rhctl/files/heartbeatclient.init
+++ b/openwrt/rhctl/files/heartbeatclient.init
@@ -22,21 +22,41 @@ start_daemon() {
local value
local args=""
+ local status="OK"
for option in $CONFIG_OPTIONS
do
config_get value "$1" "$option"
option=`echo $option | tr '_' '-'`
- if [ -n "$value" ]; then
+ if [ $option = "led" ]; then
+ local led_path
+ eval "led_path=\${LED_${value}}"
+ if [ -z "$led_path" ]; then
+ status="OK but led not found"
+ else
+ led_path="/sys/class/leds/$led_path/brightness"
+ args="$args --led $led_path"
+ fi
+ elif [ -n "$value" ]; then
args="$args --$option $value"
fi
done
- local status="OK"
$DAEMON --write-pid $PIDFILE $args || status="failed"
echo -n " ($status)"
}
+get_led()
+{
+ local name
+ local sysfs
+ config_get name $1 name
+ config_get sysfs $1 sysfs
+ eval LED_$name=$sysfs
+}
+
start() {
echo -n "Starting $DESC:"
+ config_load "system"
+ config_foreach get_led "led"
config_load "rhctl"
mkdir -p $RUN_D
config_foreach start_daemon "heartbeatclient"
diff --git a/openwrt/rhctl/files/rhctl.config b/openwrt/rhctl/files/rhctl.config
index ef8c617..2e4f176 100644
--- a/openwrt/rhctl/files/rhctl.config
+++ b/openwrt/rhctl/files/rhctl.config
@@ -31,3 +31,4 @@ config 'heartbeatclient'
option baudrate '38400'
option device '/dev/ttyHeartbeat'
option timeout '15'
+ option led 'heartbeat' \ No newline at end of file