ar71xx: ag71xx: use the generic get_port_link implementation
[openwrt.git] / target / linux / cns21xx / base-files / etc / diag.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2010 OpenWrt.org
4 #
5 #
6
7 . /lib/cns21xx.sh
8
9 status_led=""
10
11 led_set_attr() {
12 [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
13 }
14
15 status_led_set_timer() {
16 led_set_attr $status_led "trigger" "timer"
17 led_set_attr $status_led "delay_on" "$1"
18 led_set_attr $status_led "delay_off" "$2"
19 }
20
21 status_led_on() {
22 led_set_attr $status_led "trigger" "none"
23 led_set_attr $status_led "brightness" 255
24 }
25
26 status_led_off() {
27 led_set_attr $status_led "trigger" "none"
28 led_set_attr $status_led "brightness" 0
29 }
30
31 get_status_led() {
32 case $(get_board_name) in
33 ns-k330)
34 status_led="ns-k330:red:link"
35 ;;
36 esac;
37 }
38
39 set_state() {
40 get_status_led
41
42 case "$1" in
43 preinit)
44 insmod leds-gpio
45 status_led_set_timer 200 200
46 ;;
47 failsafe)
48 status_led_set_timer 50 50
49 ;;
50 done)
51 status_led_on
52 ;;
53 esac
54 }
This page took 0.041407 seconds and 5 git commands to generate.