base-files: uci-defaults-new: remove reset/enable args of ucidef_add_switch()

Out of 69 switch definitions, only 3 pass something different than "1" as
values for reset and enable, with one of those three being invalid.

This change ...

 * removes the reset and enable arguments from ucidef_add_switch()
 * unconditionally writes reset:1 and enable:1 to JSON
 * converts the three users of nonstandard values to ucidef_add_switch_attr()

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>

SVN-Revision: 47720
This commit is contained in:
Jo-Philipp Wich 2015-12-03 17:30:08 +00:00
parent 80f767d093
commit d17a64c7c0
3 changed files with 18 additions and 17 deletions

View file

@ -84,16 +84,12 @@ ucidef_set_interfaces_lan_wan() {
ucidef_add_switch() {
local name="$1"
local reset="$2"
local enable="$3"
json_select_object switch
json_select_object "$name"
json_add_boolean enable "$enable"
json_add_boolean reset "$reset"
json_add_boolean enable 1
json_add_boolean reset 1
json_select ..
json_select ..
}
@ -106,6 +102,7 @@ ucidef_add_switch_attr() {
json_select_object "$name"
case "$val" in
true|false) [ "$val" != "true" ]; json_add_boolean "$key" $? ;;
[0-9]) json_add_int "$key" "$val" ;;
*) json_add_string "$key" "$val" ;;
esac
@ -273,6 +270,7 @@ ucidef_add_switch_port_attr() {
json_select_object attr
case "$val" in
true|false) [ "$val" != "true" ]; json_add_boolean "$key" $? ;;
[0-9]) json_add_int "$key" "$val" ;;
*) json_add_string "$key" "$val" ;;
esac

View file

@ -348,7 +348,8 @@ dlan-pro-500-wp)
dlan-pro-1200-ac)
ucidef_set_interface_lan "eth0"
ucidef_add_switch "switch0" "1" "0"
ucidef_add_switch "switch0"
ucidef_add_switch_attr "switch0" "reset" "false"
ucidef_add_switch_ports "switch0" \
"0@eth0" "2:lan" "3:lan" "4:lan"
;;

View file

@ -52,7 +52,8 @@ ramips_setup_interfaces()
w150m|\
wnce2001|\
zte-q7)
ucidef_add_switch "switch0" "1" "0"
ucidef_add_switch "switch0"
ucidef_add_switch_attr "switch0" "reset" "false"
ucidef_set_interface_lan "eth0"
;;
3g-6200nl|\
@ -186,7 +187,8 @@ ramips_setup_interfaces()
"1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "0:wan" "6@eth0"
;;
m2m)
ucidef_add_switch "switch0" "4"
ucidef_add_switch "switch0"
ucidef_add_switch_attr "switch0" "reset" "false"
ucidef_set_interface_lan "eth0"
;;
mlwg2|\