aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files')
-rwxr-xr-xpackage/base-files/files/bin/config_generate8
-rwxr-xr-xpackage/base-files/files/lib/functions/uci-defaults.sh19
2 files changed, 27 insertions, 0 deletions
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index 2036ae44fe..428c6bd9de 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -354,6 +354,14 @@ generate_led() {
EOF
;;
+ portstate)
+ local port_state
+ json_get_vars port_state
+ uci -q batch <<-EOF
+ set system.$cfg.port_state='$port_state'
+ EOF
+ ;;
+
timer|oneshot)
local delayon delayoff
json_get_vars delayon delayoff
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index b097fba37c..8c954374a9 100755
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -432,6 +432,25 @@ ucidef_set_led_switch() {
json_select ..
}
+ucidef_set_led_portstate() {
+ local cfg="led_$1"
+ local name="$2"
+ local sysfs="$3"
+ local port_state="$4"
+
+ json_select_object led
+
+ json_select_object "$1"
+ json_add_string name "$name"
+ json_add_string type portstate
+ json_add_string sysfs "$sysfs"
+ json_add_string trigger port_state
+ json_add_string port_state "$port_state"
+ json_select ..
+
+ json_select ..
+}
+
ucidef_set_led_default() {
local cfg="led_$1"
local name="$2"