ar71xx: add default configuration for the switch on AP96
[openwrt.git] / target / linux / brcm63xx / base-files / etc / diag.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2007 OpenWrt.org
4 #
5 #
6
7 . /lib/brcm63xx.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 [ -n "$status_led2" ] && {
18 led_set_attr $status_led2 "trigger" "timer"
19 led_set_attr $status_led2 "delay_on" "$1"
20 led_set_attr $status_led2 "delay_off" "$2"
21 }
22 }
23
24 status_led_set_morse() {
25 led_set_attr $status_led "trigger" "morse"
26 led_set_attr $status_led "delay" "$1"
27 led_set_attr $status_led "message" "$2"
28 [ -n "$status_led2" ] && {
29 led_set_attr $status_led2 "trigger" "morse"
30 led_set_attr $status_led2 "delay" "$1"
31 led_set_attr $status_led2 "message" "$2"
32 }
33 }
34
35 status_led_on() {
36 led_set_attr $status_led "trigger" "none"
37 led_set_attr $status_led "brightness" 255
38 [ -n "$status_led2" ] && {
39 led_set_attr $status_led2 "trigger" "none"
40 led_set_attr $status_led2 "brightness" 255
41 }
42 }
43
44 status_led_off() {
45 led_set_attr $status_led "trigger" "none"
46 led_set_attr $status_led "brightness" 0
47 [ -n "$status_led2" ] && {
48 led_set_attr $status_led2 "trigger" "none"
49 led_set_attr $status_led2 "brightness" 0
50 }
51 }
52
53 set_state() {
54 case "$1" in
55 preinit)
56 insmod leds-gpio
57 status_led_on
58 status_led_set_timer 200 200
59 ;;
60 failsafe)
61 status_led_set_timer 50 50
62 ;;
63 done)
64 if [ "${status_led#power}" != "$status_led" ]; then
65 status_led_on
66 else
67 status_led_off
68 fi
69 ;;
70 esac
71 }
This page took 0.045129 seconds and 5 git commands to generate.