summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-12-31 15:02:32 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-12-31 15:02:32 +0000
commit3f85c52a3a9e5c54ddacaf91d406d9f7b94dbcc7 (patch)
tree4c0d5e2e8cde43dc5da8a23111c5ea3d594a65a7 /package
parent5fa65cba6eef681c962ab43f7ca2834900a214ad (diff)
downloadmtk-20170518-3f85c52a3a9e5c54ddacaf91d406d9f7b94dbcc7.zip
mtk-20170518-3f85c52a3a9e5c54ddacaf91d406d9f7b94dbcc7.tar.gz
mtk-20170518-3f85c52a3a9e5c54ddacaf91d406d9f7b94dbcc7.tar.bz2
package/base-files: use case statement in led init script
SVN-Revision: 29628
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/etc/init.d/led42
1 files changed, 27 insertions, 15 deletions
diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led
index e4e812d..c0e26a0 100755
--- a/package/base-files/files/etc/init.d/led
+++ b/package/base-files/files/etc/init.d/led
@@ -34,21 +34,33 @@ load_led() {
echo 0 >/sys/class/leds/${sysfs}/brightness
}
echo $trigger > /sys/class/leds/${sysfs}/trigger
- [ "$trigger" == "netdev" -a -n "$dev" ] && {
- echo $dev > /sys/class/leds/${sysfs}/device_name
- echo $mode > /sys/class/leds/${sysfs}/mode
- }
- [ "$trigger" == "timer" ] && {
- [ -n "$delayon" ] && echo $delayon > /sys/class/leds/${sysfs}/delay_on
- [ -n "$delayoff" ] && echo $delayoff > /sys/class/leds/${sysfs}/delay_off
- }
- [ "$trigger" == "usbdev" -a -n "$dev" ] && {
- echo $dev > /sys/class/leds/${sysfs}/device_name
- echo $interval > /sys/class/leds/${sysfs}/activity_interval
- }
- [ "$trigger" == "port_state" -a -n "$port_state" ] && {
- echo $port_state > /sys/class/leds/${sysfs}/port_state
- }
+ case "$trigger" in
+ "netdev")
+ [ -n "$dev" ] && {
+ echo $dev > /sys/class/leds/${sysfs}/device_name
+ echo $mode > /sys/class/leds/${sysfs}/mode
+ }
+ ;;
+
+ "timer")
+ [ -n "$delayon" ] && \
+ echo $delayon > /sys/class/leds/${sysfs}/delay_on
+ [ -n "$delayoff" ] && \
+ echo $delayoff > /sys/class/leds/${sysfs}/delay_off
+ ;;
+
+ "usbdev")
+ [ -n "$dev" ] && {
+ echo $dev > /sys/class/leds/${sysfs}/device_name
+ echo $interval > /sys/class/leds/${sysfs}/activity_interval
+ }
+ ;;
+
+ "port_state")
+ [ -n "$port_state" ] && \
+ echo $port_state > /sys/class/leds/${sysfs}/port_state
+ ;;
+ esac
}
}