summaryrefslogtreecommitdiff
path: root/package/base-files/files/bin/config_generate
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-11-26 13:53:02 +0000
committerJo-Philipp Wich <jow@openwrt.org>2015-11-26 13:53:02 +0000
commitaa4c5fd2b0a7c68853970b3b25717fafdf8eb8da (patch)
tree851ec047dc80c69cc1cffd81f0d0ca1d52ef1c5e /package/base-files/files/bin/config_generate
parent8b9e8399558980bd79b39f6601c61138d3471636 (diff)
downloadmtk-20170518-aa4c5fd2b0a7c68853970b3b25717fafdf8eb8da.zip
mtk-20170518-aa4c5fd2b0a7c68853970b3b25717fafdf8eb8da.tar.gz
mtk-20170518-aa4c5fd2b0a7c68853970b3b25717fafdf8eb8da.tar.bz2
base-files: config_generate: regroup led generator code
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 47659
Diffstat (limited to 'package/base-files/files/bin/config_generate')
-rwxr-xr-xpackage/base-files/files/bin/config_generate20
1 files changed, 16 insertions, 4 deletions
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index 45bf77b..a0ff53a 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -293,36 +293,40 @@ generate_led() {
json_select led
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
delete system.$cfg
set system.$cfg='led'
set system.$cfg.name='$name'
set system.$cfg.sysfs='$sysfs'
- set system.$cfg.dev='$device'
set system.$cfg.trigger='$trigger'
- set system.$cfg.port_mask='$port_mask'
set system.$cfg.default='$default'
EOF
case "$type" in
netdev)
+ local device
+ json_get_vars device
uci -q batch <<-EOF
set system.$cfg.trigger='netdev'
set system.$cfg.mode='link tx rx'
+ set system.$cfg.dev='$device'
EOF
;;
usb)
+ local device
+ json_get_vars device
uci -q batch <<-EOF
set system.$cfg.trigger='usbdev'
set system.$cfg.interval='50'
+ set system.$cfg.dev='$device'
EOF
;;
rssi)
- local minq maxq offset factor
+ local iface minq maxq offset factor
json_get_vars iface minq maxq offset factor
uci -q batch <<-EOF
set system.$cfg.trigger='rssi'
@@ -333,6 +337,14 @@ generate_led() {
set system.$cfg.factor='$factor'
EOF
;;
+
+ switch)
+ local port_mask
+ json_get_vars port_mask
+ uci -q batch <<-EOF
+ set system.$cfg.port_mask='$port_mask'
+ EOF
+ ;;
esac
json_select ..