kirkwood: use the generic uci-default functions for initial LED setup

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31994 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Gabor Juhos 2012-05-29 16:39:20 +00:00
parent 32b2b86076
commit e7cab28a32
1 changed files with 4 additions and 38 deletions

View File

@ -3,55 +3,21 @@
# Copyright (C) 2012 OpenWrt.org # Copyright (C) 2012 OpenWrt.org
# #
COMMIT_SYSTEM=0 . /lib/fuctions/uci-defaults.sh
set_led_netdev() {
local cfg="led_$1"
local sysfs=$2
local dev=$3
uci -q get system.$cfg && return 0
uci batch <<EOF
set system.$cfg='led'
set system.$cfg.sysfs='$sysfs'
set system.$cfg.trigger='netdev'
set system.$cfg.dev='$dev'
set system.$cfg.mode='link tx rx'
EOF
COMMIT_SYSTEM=1
}
set_led_default() {
local cfg="led_$1"
local sysfs=$2
local default=$3
uci -q get system.$cfg && return 0
uci batch <<EOF
set system.$cfg='led'
set system.$cfg.sysfs='$sysfs'
set system.$cfg.trigger='none'
set system.$cfg.default='$default'
EOF
COMMIT_SYSTEM=1
}
. /lib/kirkwood.sh . /lib/kirkwood.sh
hardware=$(kirkwood_hardware_name) hardware=$(kirkwood_hardware_name)
case "$hardware" in case "$hardware" in
"Seagate FreeAgent DockStar") "Seagate FreeAgent DockStar")
set_led_netdev "eth0" "dockstar:orange:misc" "eth0" ucidef_set_led_netdev "eth0" "dockstar:orange:misc" "eth0"
set_led_default "health" "dockstar:green:health" "1" ucidef_set_led_default "health" "dockstar:green:health" "1"
;; ;;
*) *)
;; ;;
esac esac
[ "$COMMIT_SYSTEM" == "1" ] && uci commit system ucidef_commit_leds
exit 0 exit 0