lua: Fixed some cross-platform issues for PPC (and probably other architectures)
[openwrt.git] / target / linux / adm5120 / base-files / etc / diag.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2007 OpenWrt.org
4 #
5 # $Id$
6 #
7
8 . /lib/adm5120.sh
9
10 led_set_attr() {
11 [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
12 }
13
14 status_led_set_timer() {
15 led_set_attr $status_led "trigger" "timer"
16 led_set_attr $status_led "delay_on" "$1"
17 led_set_attr $status_led "delay_off" "$2"
18 }
19
20 status_led_set_morse() {
21 led_set_attr $status_led "trigger" "morse"
22 led_set_attr $status_led "delay" "$1"
23 led_set_attr $status_led "message" "$2"
24 }
25
26 status_led_on() {
27 led_set_attr $status_led "trigger" "none"
28 led_set_attr $status_led "brightness" 255
29 }
30
31 status_led_off() {
32 led_set_attr $status_led "trigger" "none"
33 led_set_attr $status_led "brightness" 0
34 }
35
36 set_state() {
37 case "$1" in
38 preinit)
39 status_led_set_timer 200 200
40 ;;
41 failsafe)
42 status_led_set_timer 50 50
43 ;;
44 done)
45 status_led_on
46 ;;
47 esac
48 }
This page took 0.044416 seconds and 5 git commands to generate.