x86: prepare for kernels 2.6.33 & 2.6.34
[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 insmod leds-gpio
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.047588 seconds and 5 git commands to generate.