source: trunk/target/linux/ramips/base-files/etc/diag.sh @ 29871

Last change on this file since 29871 was 29871, checked in by juhosg, 4 years ago

ramips: scripts updates

In this patch:

  • rename Argus leds to avoid underscores
  • rename Belkin F5D8235 v1 leds from f5d8234 to f5d8235
  • remove Belkin F5D8235 v1 status led defined as storage led (it was defined as usb led earlier, just in wrong place) - it should have router led as in v2
  • add Argus, Sparklan and Belkin F5D8235 v2 status leds
  • add Belkin F5D8235 v1 and v2 usb leds
  • fix Belkin F5D8235 v2 network config generation and mac address axtraction
  • fix Sparklan board identification
  • add Sparklan usb led (this board doesn't have usb connector by default and the led is hidden also but if you are going to solder the connector then you'll see the led too)
  • add Sparklan network config generation and mac address extraction
  • fix empty string test in network script and...
  • ...sort case entries by the first board in the list

Signed-off-by: Roman Yeryomin <roman@…>

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/sh
2#
3# Copyright (C) 2010 OpenWrt.org
4#
5#
6
7. /lib/ramips.sh
8
9status_led=""
10
11led_set_attr() {
12        [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
13}
14
15status_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
21status_led_on() {
22        led_set_attr $status_led "trigger" "none"
23        led_set_attr $status_led "brightness" 255
24}
25
26status_led_off() {
27        led_set_attr $status_led "trigger" "none"
28        led_set_attr $status_led "brightness" 0
29}
30
31get_status_led() {
32        case $(ramips_board_name) in
33        argus-atp52b)
34                status_led="argus-atp52b:green:run"
35                ;;
36        dir-300-b1 | dir-600-b1 | dir-600-b2)
37                status_led="d-link:green:status"
38                ;;
39        esr-9753)
40                status_led="esr-9753:orange:power"
41                ;;
42        f5d8235-v2)
43                status_led="f5d8235v2:blue:router"
44                ;;
45        fonera20n)
46                status_led="fonera20n:green:power"
47                ;;
48        hw550-3g)
49                status_led="hw550-3g:green:status"
50                ;;
51        mofi3500-3gn)
52                status_led="mofi3500-3gn:green:status"
53                ;;
54        nbg-419n)
55                status_led="nbg-419n:green:power"
56                ;;
57        nw718)
58                status_led="nw718:amber:cpu"
59                ;;
60        omni-emb)
61                status_led="emb:green:status"
62                ;;
63        pwh2004)
64                status_led="pwh2004:green:power"
65                ;;
66        rt-n15)
67                status_led="rt-n15:blue:power"
68                ;;
69        v22rw-2x2)
70                status_led="v22rw-2x2:green:security"
71                ;;
72        w502u)
73                status_led="alfa:blue:wps"
74                ;;
75        wcr-150gn)
76                status_led="wcr150gn:amber:power"
77                ;;
78        whr-g300n)
79                status_led="whr-g300n:green:router"
80                ;;
81        wli-tx4-ag300n)
82                status_led="buffalo:blue:power"
83                ;;
84        wl-351)
85                status_led="wl-351:amber:power"
86                ;;
87        wr512-3gn)
88                status_led="wr512:green:wps"
89                ;;
90        esac
91}
92
93set_state() {
94        get_status_led
95
96        case "$1" in
97        preinit)
98                insmod leds-gpio
99                status_led_set_timer 200 200
100                ;;
101        failsafe)
102                status_led_set_timer 50 50
103                ;;
104        done)
105                status_led_on
106                ;;
107        esac
108}
Note: See TracBrowser for help on using the repository browser.