From 7edd9f7ab51f671afc9f255ce65432d75562b673 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 3 Apr 2023 02:17:51 +0200 Subject: [PATCH] base-files: led board init --- package/base-files/files/bin/config_generate | 7 +++++-- package/base-files/files/lib/functions/uci-defaults.sh | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index 0001f88746..9072086a27 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -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) diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index a37e8cf824..ba06d9afa1 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -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 .. -- 2.30.2