base-files: led board init
authorDavid Bauer <mail@david-bauer.net>
Mon, 3 Apr 2023 00:17:51 +0000 (02:17 +0200)
committerDavid Bauer <mail@david-bauer.net>
Mon, 3 Apr 2023 01:14:58 +0000 (03:14 +0200)
package/base-files/files/bin/config_generate
package/base-files/files/lib/functions/uci-defaults.sh

index 0001f887466196373077d6ba01e47dbde9aabfbb..9072086a27c20ece3fb1f002394a1a59cbb49232 100755 (executable)
@@ -408,12 +408,15 @@ generate_led() {
 
                netdev)
                        local device mode
-                       json_get_vars device mode
+                       json_get_vars mode
+                       json_get_values device device
                        uci -q batch <<-EOF
                                set system.$cfg.trigger='netdev'
                                set system.$cfg.mode='$mode'
-                               set system.$cfg.dev='$device'
                        EOF
+                       for dev in $device; do
+                               uci add_list system.$cfg.dev=$dev
+                       done
                ;;
 
                usb)
index a37e8cf82416d3afe7637c61150d7aee8f2399f5..ba06d9afa15a5ea9e9330b1808b2b06242a2e044 100644 (file)
@@ -455,13 +455,17 @@ ucidef_set_led_ide() {
 }
 
 ucidef_set_led_netdev() {
-       local dev="$4"
+       local devices="$4"
        local mode="${5:-link tx rx}"
 
        _ucidef_set_led_common "$1" "$2" "$3"
 
        json_add_string type netdev
-       json_add_string device "$dev"
+       json_select_array device
+       for netdev in $devices; do
+               json_add_string "device" "$netdev"
+       done
+       json_select ..
        json_add_string mode "$mode"
        json_select ..