diff options
author | John Bowler <jbowler@nslu2-linux.org> | 2006-01-22 09:14:24 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2006-01-22 09:14:24 +0000 |
commit | 65fd7a75e0f5786a0582b33f7ba01e814692f992 (patch) | |
tree | e7092ced8612d13498fcb4eb1190e55e63ab3bf9 /packages/slugos-init/files/initscripts | |
parent | b23d1cb9a50613922861d94f8ff24005656877c3 (diff) |
ixp4xx-kernel: new LED driver in 2.6.15.1
slugos-init: update for new LED support in 0.10
- the kernel now uses the RP LED driver code, the new patches add
a generic ixp4xx driver and board level definitions for nslu2, loft
and nas100d
Diffstat (limited to 'packages/slugos-init/files/initscripts')
-rw-r--r-- | packages/slugos-init/files/initscripts/zleds | 65 |
1 files changed, 53 insertions, 12 deletions
diff --git a/packages/slugos-init/files/initscripts/zleds b/packages/slugos-init/files/initscripts/zleds index c4e2b37219..b6d2f1600b 100644 --- a/packages/slugos-init/files/initscripts/zleds +++ b/packages/slugos-init/files/initscripts/zleds @@ -8,7 +8,10 @@ # two colours of the previous and next runlevel. # 'start' sets the LED to steady # -# 'red' is the initial setting on kernel boot +# The 'ready' led is used for the indication of state, except that +# if a 'status' led is used ready+status is set in place of !ready. +# +# For NSLU2: # # 'amber' is used for run levels S (from /linuxrc), 0 (halt), # 1 (single user) and 6 (reboot). halt and reboot do not @@ -17,22 +20,60 @@ # # 'green' is used for run levels 2-5 - the normal user run levels. # -# colours are 'g' (green), 'r' (red) or 'gr' (amber). -colour() { +# state outputs 's' (for 'system') or 'u' (for user) to distinguish +# the required colours. +# +# NOTE: this will change +state(){ case "$1" in - S|0|1|6) echo gr;; - 2|3|4|5) echo g;; - N) echo r;; + S|0|1|6) echo s;; + 2|3|4|5) echo u;; + N) echo s;; *) echo "led change: $runlevel: runlevel unknown" >&2 - echo r;; + echo s;; esac } -# leds syntax is -A +<init state> /<new state> -case "$1" in -start) leds -gr +"$(colour "$runlevel")";; -stop) leds -gr +"$(colour "$previous")" /"$(colour "$runlevel")";; -*) echo "led change: $1: command ignored" >&2;; +# Make the named LED do something +flash(){ + echo timer >/sys/class/leds/"$1"/trigger + echo 200 >/sys/class/leds/"$1"/frequency +} +on(){ + echo none >/sys/class/leds/"$1"/trigger + echo 100 >/sys/class/leds/"$1"/brightness +} +off(){ + echo none >/sys/class/leds/"$1"/trigger + echo 0 >/sys/class/leds/"$1"/brightness +} + +test -d /sys/class/leds/ready && case "$1" in +start) if test -d /sys/class/leds/status + then + case "$(state "$runlevel")" in + s) on status + on ready;; + u) off status + on ready;; + esac + else + on ready + fi;; +stop) if test -d /sys/class/leds/status + then + case "$(state "$previous")$(state "$runlevel")" in + ss) flash status + flash ready;; + su|us) flash status + on ready;; + uu) off status + flash ready;; + esac + else + flash ready + fi;; +*) echo "led change: $1: command ignored" >&2;; esac exit 0 |