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