base-files: config_generate: regroup led generator code

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 47659
This commit is contained in:
Jo-Philipp Wich 2015-11-26 13:53:02 +00:00
parent 8b9e839955
commit aa4c5fd2b0

View file

@ -293,36 +293,40 @@ generate_led() {
json_select led json_select led
json_select "$key" json_select "$key"
json_get_vars name sysfs type trigger device default port_mask json_get_vars name sysfs type trigger default
uci -q batch <<-EOF uci -q batch <<-EOF
delete system.$cfg delete system.$cfg
set system.$cfg='led' set system.$cfg='led'
set system.$cfg.name='$name' set system.$cfg.name='$name'
set system.$cfg.sysfs='$sysfs' set system.$cfg.sysfs='$sysfs'
set system.$cfg.dev='$device'
set system.$cfg.trigger='$trigger' set system.$cfg.trigger='$trigger'
set system.$cfg.port_mask='$port_mask'
set system.$cfg.default='$default' set system.$cfg.default='$default'
EOF EOF
case "$type" in case "$type" in
netdev) netdev)
local device
json_get_vars device
uci -q batch <<-EOF uci -q batch <<-EOF
set system.$cfg.trigger='netdev' set system.$cfg.trigger='netdev'
set system.$cfg.mode='link tx rx' set system.$cfg.mode='link tx rx'
set system.$cfg.dev='$device'
EOF EOF
;; ;;
usb) usb)
local device
json_get_vars device
uci -q batch <<-EOF uci -q batch <<-EOF
set system.$cfg.trigger='usbdev' set system.$cfg.trigger='usbdev'
set system.$cfg.interval='50' set system.$cfg.interval='50'
set system.$cfg.dev='$device'
EOF EOF
;; ;;
rssi) rssi)
local minq maxq offset factor local iface minq maxq offset factor
json_get_vars iface minq maxq offset factor json_get_vars iface minq maxq offset factor
uci -q batch <<-EOF uci -q batch <<-EOF
set system.$cfg.trigger='rssi' set system.$cfg.trigger='rssi'
@ -333,6 +337,14 @@ generate_led() {
set system.$cfg.factor='$factor' set system.$cfg.factor='$factor'
EOF EOF
;; ;;
switch)
local port_mask
json_get_vars port_mask
uci -q batch <<-EOF
set system.$cfg.port_mask='$port_mask'
EOF
;;
esac esac
json_select .. json_select ..