aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-08-13 14:01:37 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-08-13 14:01:37 +0000
commitca857b7a50506047aff1fef7b8ed3faa31f5075b (patch)
tree24d5fc4f5bb740c8a470bbe9cf4f2e21885ce13a /package/base-files/files
parent02cf95877e1cad9d16fbb720f7167a0577ccfd31 (diff)
downloadupstream-ca857b7a50506047aff1fef7b8ed3faa31f5075b.tar.gz
upstream-ca857b7a50506047aff1fef7b8ed3faa31f5075b.tar.bz2
upstream-ca857b7a50506047aff1fef7b8ed3faa31f5075b.zip
base-files: uci-defaults for rssileds
Adds capability to add uci-defaults defining RSSI LEDs Signed-off-by: Daniel Golle <dgolle@allnet.de> SVN-Revision: 33164
Diffstat (limited to 'package/base-files/files')
-rw-r--r--package/base-files/files/lib/functions/uci-defaults.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index 2cbf69a6ff..477c00cfd4 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -94,6 +94,50 @@ EOF
UCIDEF_LEDS_CHANGED=1
}
+ucidef_set_led_rssi() {
+ local cfg="led_$1"
+ local name=$2
+ local sysfs=$3
+ local iface=$4
+ local minq=$5
+ local maxq=$6
+ local offset=$7
+ local factor=$8
+
+ uci -q get system.$cfg && return 0
+
+ uci batch <<EOF
+set system.$cfg='led'
+set system.$cfg.name='$name'
+set system.$cfg.sysfs='$sysfs'
+set system.$cfg.trigger='rssi'
+set system.$cfg.iface='rssid_$iface'
+set system.$cfg.minq='$minq'
+set system.$cfg.maxq='$maxq'
+set system.$cfg.offset='$offset'
+set system.$cfg.factor='$factor'
+EOF
+ UCIDEF_LEDS_CHANGED=1
+}
+
+ucidef_set_rssimon() {
+ local dev="$1"
+ local refresh="$2"
+ local threshold="$3"
+
+ local cfg="rssid_$dev"
+
+ uci -q get system.$cfg && return 0
+
+ uci batch <<EOF
+set system.$cfg='rssid'
+set system.$cfg.dev='$dev'
+set system.$cfg.refresh='$refresh'
+set system.$cfg.threshold='$threshold'
+EOF
+ UCIDEF_LEDS_CHANGED=1
+}
+
ucidef_commit_leds()
{
[ "$UCIDEF_LEDS_CHANGED" == "1" ] && uci commit system