aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-02-25 13:31:29 +0000
committerFelix Fietkau <nbd@openwrt.org>2016-02-25 13:31:29 +0000
commite5e06684f6c223de5a0f4018e2723accb59fa4cf (patch)
treed59af4fea23e894fd9c85250402fbbfa9bdfca4e /package
parent6eb4fa5885cb5f9c88a76b54444cdd94eb4b9eb5 (diff)
downloadmaster-187ad058-e5e06684f6c223de5a0f4018e2723accb59fa4cf.tar.gz
master-187ad058-e5e06684f6c223de5a0f4018e2723accb59fa4cf.tar.bz2
master-187ad058-e5e06684f6c223de5a0f4018e2723accb59fa4cf.zip
base-files: add support for speed mask to switch config init scripts
This patch adds extra parameter to switch LED trigger initialization functions. New functionality maintains backward compatibility, so calling functions without setting new speed_mask parameter works as expected. Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48776 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/bin/config_generate5
-rwxr-xr-xpackage/base-files/files/etc/init.d/led5
-rwxr-xr-xpackage/base-files/files/lib/functions/uci-defaults.sh2
3 files changed, 9 insertions, 3 deletions
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index 28ba0e2694..865dccc450 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -296,10 +296,11 @@ generate_led() {
;;
switch)
- local port_mask
- json_get_vars port_mask
+ local port_mask speed_mask
+ json_get_vars port_mask speed_mask
uci -q batch <<-EOF
set system.$cfg.port_mask='$port_mask'
+ set system.$cfg.speed_mask='$speed_mask'
EOF
;;
diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led
index 84cd028bd8..d1521a9a61 100755
--- a/package/base-files/files/etc/init.d/led
+++ b/package/base-files/files/etc/init.d/led
@@ -88,11 +88,14 @@ load_led() {
;;
switch[0-9]*)
- local port_mask
+ local port_mask speed_mask
config_get port_mask $1 port_mask
[ -n "$port_mask" ] && \
echo $port_mask > /sys/class/leds/${sysfs}/port_mask
+ config_get speed_mask $1 speed_mask
+ [ -n "$speed_mask" ] && \
+ echo $speed_mask > /sys/class/leds/${sysfs}/speed_mask
;;
esac
}
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index 84b78b84ef..d556844e95 100755
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -410,6 +410,7 @@ ucidef_set_led_switch() {
local sysfs="$3"
local trigger="$4"
local port_mask="$5"
+ local speed_mask="$6"
json_select_object led
@@ -419,6 +420,7 @@ ucidef_set_led_switch() {
json_add_string sysfs "$sysfs"
json_add_string trigger "$trigger"
json_add_string port_mask "$port_mask"
+ json_add_string speed_mask "$speed_mask"
json_select ..
json_select ..