From d88cc5e7bc3dd1d8c91cd45e37e45e1060b425c4 Mon Sep 17 00:00:00 2001
From: Markus Gothe <markus.gothe@genexis.eu>
Date: Tue, 14 Dec 2021 11:47:44 +0000
Subject: [PATCH] Merge Zebra and Eagle

---
 iopsys-brcm63xx-arm/config/eagle/config       |   2 +-
 iopsys-brcm63xx-arm/config/zebra/config       |  13 ---
 .../base-files/etc/init.d/ethernet_wan        |   3 +
 .../base-files/etc/init.d/voice_monitor       |   2 +
 .../etc/uci-defaults/02-fixup-variant         |   9 ++
 .../base-files/etc/wlan/nvram/E600.nvm        | Bin
 .../base-files/usr/sbin/ethernet_wan          |   0
 .../base-files/usr/sbin/voice_monitor         |  14 ++-
 .../koala/base-files/etc/init.d/voice_monitor |   2 +
 .../koala/base-files/usr/sbin/voice_monitor   |  14 ++-
 .../panda/base-files/etc/init.d/voice_monitor |   2 +
 .../panda/base-files/usr/sbin/voice_monitor   |  14 ++-
 .../base-files/etc/init.d/voice_monitor       |  34 ++++++
 .../panther/base-files/usr/sbin/voice_monitor |  42 +++++++
 iopsys-brcm63xx-arm/profiles/iopsys.mk        |  14 +--
 .../etc/hotplug.d/button/20-softresetbutton   |  12 --
 .../zebra/base-files/etc/init.d/udevtrigger   |   9 --
 .../zebra/base-files/etc/sysctl.d/archer.conf |   1 -
 .../zebra/base-files/etc/wifi.json            |  40 -------
 .../lib/functions/iopsys-environment.sh       |  94 ----------------
 .../zebra/base-files/usr/bin/kv_read          |  15 ---
 .../base-files/usr/libexec/rpcd/wifi.acs      | 104 ------------------
 22 files changed, 132 insertions(+), 308 deletions(-)
 delete mode 100644 iopsys-brcm63xx-arm/config/zebra/config
 rename iopsys-brcm63xx-arm/{zebra => eagle}/base-files/etc/init.d/ethernet_wan (82%)
 rename iopsys-brcm63xx-arm/{zebra => eagle}/base-files/etc/init.d/voice_monitor (87%)
 create mode 100644 iopsys-brcm63xx-arm/eagle/base-files/etc/uci-defaults/02-fixup-variant
 rename iopsys-brcm63xx-arm/{zebra => eagle}/base-files/etc/wlan/nvram/E600.nvm (100%)
 rename iopsys-brcm63xx-arm/{zebra => eagle}/base-files/usr/sbin/ethernet_wan (100%)
 rename iopsys-brcm63xx-arm/{zebra => eagle}/base-files/usr/sbin/voice_monitor (66%)
 create mode 100755 iopsys-brcm63xx-arm/panther/base-files/etc/init.d/voice_monitor
 create mode 100755 iopsys-brcm63xx-arm/panther/base-files/usr/sbin/voice_monitor
 delete mode 100644 iopsys-brcm63xx-arm/zebra/base-files/etc/hotplug.d/button/20-softresetbutton
 delete mode 100755 iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/udevtrigger
 delete mode 100644 iopsys-brcm63xx-arm/zebra/base-files/etc/sysctl.d/archer.conf
 delete mode 100644 iopsys-brcm63xx-arm/zebra/base-files/etc/wifi.json
 delete mode 100644 iopsys-brcm63xx-arm/zebra/base-files/lib/functions/iopsys-environment.sh
 delete mode 100755 iopsys-brcm63xx-arm/zebra/base-files/usr/bin/kv_read
 delete mode 100755 iopsys-brcm63xx-arm/zebra/base-files/usr/libexec/rpcd/wifi.acs

diff --git a/iopsys-brcm63xx-arm/config/eagle/config b/iopsys-brcm63xx-arm/config/eagle/config
index 7b31070a5..18e5727ba 100644
--- a/iopsys-brcm63xx-arm/config/eagle/config
+++ b/iopsys-brcm63xx-arm/config/eagle/config
@@ -3,7 +3,7 @@ CONFIG_BCM_KERNEL_PROFILE="96750GW_WL20D1D1"
 CONFIG_BCM_CHIP_ID="63178"
 
 CONFIG_BCM_FIRMWARE_TYPE_NAND_SQUASHFS=y
-# CONFIG_BCM_VOICE is not set
+CONFIG_BCM_VOICE=y
 # CONFIG_BCM_DSL is not set
 # CONFIG_PACKAGE_libdsl is not set
 # CONFIG_PACKAGE_dslmngr is not set
diff --git a/iopsys-brcm63xx-arm/config/zebra/config b/iopsys-brcm63xx-arm/config/zebra/config
deleted file mode 100644
index 3ec51707d..000000000
--- a/iopsys-brcm63xx-arm/config/zebra/config
+++ /dev/null
@@ -1,13 +0,0 @@
-CONFIG_TARGET_FAMILY="ZEBRA"
-CONFIG_BCM_KERNEL_PROFILE="96750GW_WL20D1D1"
-CONFIG_BCM_CHIP_ID="63178"
-
-CONFIG_BCM_FIRMWARE_TYPE_NAND_SQUASHFS=y
-CONFIG_BCM_VOICE=y
-# CONFIG_BCM_DSL is not set
-# CONFIG_PACKAGE_libdsl is not set
-# CONFIG_PACKAGE_dslmngr is not set
-# CONFIG_PACKAGE_mwan3 is not set
-CONFIG_BCM_FLASH_LAYOUT_OPTIONS="options_63178_nand"
-
-CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/ethernet_wan b/iopsys-brcm63xx-arm/eagle/base-files/etc/init.d/ethernet_wan
similarity index 82%
rename from iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/ethernet_wan
rename to iopsys-brcm63xx-arm/eagle/base-files/etc/init.d/ethernet_wan
index 8c1a2cec6..521b84b70 100755
--- a/iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/ethernet_wan
+++ b/iopsys-brcm63xx-arm/eagle/base-files/etc/init.d/ethernet_wan
@@ -7,6 +7,9 @@ USE_PROCD=1
 ETHERNET_WAN=$(which ethernet_wan)
 
 start_service() {
+	# Only run for E600 board
+	[ "$(fw_printenv -n boardid)" != "E600" ] && exit 0
+
 	[ -n "$ETHERNET_WAN" ] && {
 		procd_open_instance
 		procd_set_param command "$ETHERNET_WAN"
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/voice_monitor b/iopsys-brcm63xx-arm/eagle/base-files/etc/init.d/voice_monitor
similarity index 87%
rename from iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/voice_monitor
rename to iopsys-brcm63xx-arm/eagle/base-files/etc/init.d/voice_monitor
index afe3ca95a..64b2457dd 100755
--- a/iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/voice_monitor
+++ b/iopsys-brcm63xx-arm/eagle/base-files/etc/init.d/voice_monitor
@@ -7,6 +7,8 @@ USE_PROCD=1
 VOICE_MONITOR=$(which voice_monitor)
 
 start_service() {
+	[ "$(db -q get hw.board.hasVoice)" = "1" ] || return
+
 	[ -n "$VOICE_MONITOR" ] && {
 		procd_open_instance
 		procd_set_param command "$VOICE_MONITOR"
diff --git a/iopsys-brcm63xx-arm/eagle/base-files/etc/uci-defaults/02-fixup-variant b/iopsys-brcm63xx-arm/eagle/base-files/etc/uci-defaults/02-fixup-variant
new file mode 100644
index 000000000..34d000fc6
--- /dev/null
+++ b/iopsys-brcm63xx-arm/eagle/base-files/etc/uci-defaults/02-fixup-variant
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Only run for E600 board
+[ "$(fw_printenv -n boardid)" != "E600" ] && exit 0
+
+if [ "$(fw_printenv -n Variant)" = "1" ]; then
+	fw_setenv Variant 2
+	setup_device.sh
+fi
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/etc/wlan/nvram/E600.nvm b/iopsys-brcm63xx-arm/eagle/base-files/etc/wlan/nvram/E600.nvm
similarity index 100%
rename from iopsys-brcm63xx-arm/zebra/base-files/etc/wlan/nvram/E600.nvm
rename to iopsys-brcm63xx-arm/eagle/base-files/etc/wlan/nvram/E600.nvm
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/usr/sbin/ethernet_wan b/iopsys-brcm63xx-arm/eagle/base-files/usr/sbin/ethernet_wan
similarity index 100%
rename from iopsys-brcm63xx-arm/zebra/base-files/usr/sbin/ethernet_wan
rename to iopsys-brcm63xx-arm/eagle/base-files/usr/sbin/ethernet_wan
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/usr/sbin/voice_monitor b/iopsys-brcm63xx-arm/eagle/base-files/usr/sbin/voice_monitor
similarity index 66%
rename from iopsys-brcm63xx-arm/zebra/base-files/usr/sbin/voice_monitor
rename to iopsys-brcm63xx-arm/eagle/base-files/usr/sbin/voice_monitor
index 227868314..e00b88861 100755
--- a/iopsys-brcm63xx-arm/zebra/base-files/usr/sbin/voice_monitor
+++ b/iopsys-brcm63xx-arm/eagle/base-files/usr/sbin/voice_monitor
@@ -1,18 +1,28 @@
 #!/bin/sh
 . /lib/voice/utils.sh
+. /usr/share/libubox/jshn.sh
 
 ubus call led.voice set '{"state":"off"}'
 
 check_voice() {
 	local account_enabled=0
 	local registered=0
-	
+	local global_led_state=""
+
 	while true; do
 		account_enabled=0
 		registered=0
+		global_led_state=""
+
+		json_load "$(ubus -S call leds status 2> /dev/null)"
+		json_get_var global_led_state state
+		if [ "$global_led_state" = "test" ]; then
+			sleep 5
+			continue
+		fi
 
 		for peer in $(uci show $VOICE_UCI_CONFIG | grep sip_service_provider | awk -F[.,=] '{print$2}'); do
-			[ "$(uci -q get $VOICE_UCI_CONFIG.$peer.enabled)" = "1" ] && account_enabled=1
+			[ "$(uci -q get $VOICE_UCI_CONFIG.$peer.enable)" = "1" ] && account_enabled=1
 		done
 
 		if [ "$account_enabled" = "0" ]; then
diff --git a/iopsys-brcm63xx-arm/koala/base-files/etc/init.d/voice_monitor b/iopsys-brcm63xx-arm/koala/base-files/etc/init.d/voice_monitor
index afe3ca95a..64b2457dd 100755
--- a/iopsys-brcm63xx-arm/koala/base-files/etc/init.d/voice_monitor
+++ b/iopsys-brcm63xx-arm/koala/base-files/etc/init.d/voice_monitor
@@ -7,6 +7,8 @@ USE_PROCD=1
 VOICE_MONITOR=$(which voice_monitor)
 
 start_service() {
+	[ "$(db -q get hw.board.hasVoice)" = "1" ] || return
+
 	[ -n "$VOICE_MONITOR" ] && {
 		procd_open_instance
 		procd_set_param command "$VOICE_MONITOR"
diff --git a/iopsys-brcm63xx-arm/koala/base-files/usr/sbin/voice_monitor b/iopsys-brcm63xx-arm/koala/base-files/usr/sbin/voice_monitor
index 227868314..e00b88861 100755
--- a/iopsys-brcm63xx-arm/koala/base-files/usr/sbin/voice_monitor
+++ b/iopsys-brcm63xx-arm/koala/base-files/usr/sbin/voice_monitor
@@ -1,18 +1,28 @@
 #!/bin/sh
 . /lib/voice/utils.sh
+. /usr/share/libubox/jshn.sh
 
 ubus call led.voice set '{"state":"off"}'
 
 check_voice() {
 	local account_enabled=0
 	local registered=0
-	
+	local global_led_state=""
+
 	while true; do
 		account_enabled=0
 		registered=0
+		global_led_state=""
+
+		json_load "$(ubus -S call leds status 2> /dev/null)"
+		json_get_var global_led_state state
+		if [ "$global_led_state" = "test" ]; then
+			sleep 5
+			continue
+		fi
 
 		for peer in $(uci show $VOICE_UCI_CONFIG | grep sip_service_provider | awk -F[.,=] '{print$2}'); do
-			[ "$(uci -q get $VOICE_UCI_CONFIG.$peer.enabled)" = "1" ] && account_enabled=1
+			[ "$(uci -q get $VOICE_UCI_CONFIG.$peer.enable)" = "1" ] && account_enabled=1
 		done
 
 		if [ "$account_enabled" = "0" ]; then
diff --git a/iopsys-brcm63xx-arm/panda/base-files/etc/init.d/voice_monitor b/iopsys-brcm63xx-arm/panda/base-files/etc/init.d/voice_monitor
index afe3ca95a..64b2457dd 100755
--- a/iopsys-brcm63xx-arm/panda/base-files/etc/init.d/voice_monitor
+++ b/iopsys-brcm63xx-arm/panda/base-files/etc/init.d/voice_monitor
@@ -7,6 +7,8 @@ USE_PROCD=1
 VOICE_MONITOR=$(which voice_monitor)
 
 start_service() {
+	[ "$(db -q get hw.board.hasVoice)" = "1" ] || return
+
 	[ -n "$VOICE_MONITOR" ] && {
 		procd_open_instance
 		procd_set_param command "$VOICE_MONITOR"
diff --git a/iopsys-brcm63xx-arm/panda/base-files/usr/sbin/voice_monitor b/iopsys-brcm63xx-arm/panda/base-files/usr/sbin/voice_monitor
index 227868314..e00b88861 100755
--- a/iopsys-brcm63xx-arm/panda/base-files/usr/sbin/voice_monitor
+++ b/iopsys-brcm63xx-arm/panda/base-files/usr/sbin/voice_monitor
@@ -1,18 +1,28 @@
 #!/bin/sh
 . /lib/voice/utils.sh
+. /usr/share/libubox/jshn.sh
 
 ubus call led.voice set '{"state":"off"}'
 
 check_voice() {
 	local account_enabled=0
 	local registered=0
-	
+	local global_led_state=""
+
 	while true; do
 		account_enabled=0
 		registered=0
+		global_led_state=""
+
+		json_load "$(ubus -S call leds status 2> /dev/null)"
+		json_get_var global_led_state state
+		if [ "$global_led_state" = "test" ]; then
+			sleep 5
+			continue
+		fi
 
 		for peer in $(uci show $VOICE_UCI_CONFIG | grep sip_service_provider | awk -F[.,=] '{print$2}'); do
-			[ "$(uci -q get $VOICE_UCI_CONFIG.$peer.enabled)" = "1" ] && account_enabled=1
+			[ "$(uci -q get $VOICE_UCI_CONFIG.$peer.enable)" = "1" ] && account_enabled=1
 		done
 
 		if [ "$account_enabled" = "0" ]; then
diff --git a/iopsys-brcm63xx-arm/panther/base-files/etc/init.d/voice_monitor b/iopsys-brcm63xx-arm/panther/base-files/etc/init.d/voice_monitor
new file mode 100755
index 000000000..a8673490a
--- /dev/null
+++ b/iopsys-brcm63xx-arm/panther/base-files/etc/init.d/voice_monitor
@@ -0,0 +1,34 @@
+#!/bin/sh /etc/rc.common
+
+START=21
+STOP=90
+USE_PROCD=1
+
+. /lib/functions.sh
+. /lib/functions/iopsys-environment.sh
+
+VOICE_MONITOR=$(which voice_monitor)
+
+start_service() {
+	[ "$(db -q get hw.board.hasVoice)" = "1" ] || return
+
+	[ -n "$VOICE_MONITOR" ] && {
+		procd_open_instance
+		procd_set_param command "$VOICE_MONITOR"
+		procd_set_param respawn
+		procd_close_instance
+	}
+}
+
+stop_service() {
+	[ -n "$VOICE_MONITOR" ] && service_stop "$VOICE_MONITOR"
+}
+
+boot() {
+	start
+}
+
+reload_service() {
+	stop
+	start
+}
diff --git a/iopsys-brcm63xx-arm/panther/base-files/usr/sbin/voice_monitor b/iopsys-brcm63xx-arm/panther/base-files/usr/sbin/voice_monitor
new file mode 100755
index 000000000..e00b88861
--- /dev/null
+++ b/iopsys-brcm63xx-arm/panther/base-files/usr/sbin/voice_monitor
@@ -0,0 +1,42 @@
+#!/bin/sh
+. /lib/voice/utils.sh
+. /usr/share/libubox/jshn.sh
+
+ubus call led.voice set '{"state":"off"}'
+
+check_voice() {
+	local account_enabled=0
+	local registered=0
+	local global_led_state=""
+
+	while true; do
+		account_enabled=0
+		registered=0
+		global_led_state=""
+
+		json_load "$(ubus -S call leds status 2> /dev/null)"
+		json_get_var global_led_state state
+		if [ "$global_led_state" = "test" ]; then
+			sleep 5
+			continue
+		fi
+
+		for peer in $(uci show $VOICE_UCI_CONFIG | grep sip_service_provider | awk -F[.,=] '{print$2}'); do
+			[ "$(uci -q get $VOICE_UCI_CONFIG.$peer.enable)" = "1" ] && account_enabled=1
+		done
+
+		if [ "$account_enabled" = "0" ]; then
+			ubus call led.voice set '{"state":"off"}'
+		else
+			asterisk -x 'pjsip show registrations' | grep -q "Registered" && registered=1
+			if [ "$registered" = "0" ]; then
+				ubus call led.voice set '{"state":"error"}'
+			else
+				ubus call led.voice set '{"state":"ok"}'
+			fi
+		fi
+		sleep 5
+	done
+}
+
+check_voice
diff --git a/iopsys-brcm63xx-arm/profiles/iopsys.mk b/iopsys-brcm63xx-arm/profiles/iopsys.mk
index 21edd36ed..6ecefd1dc 100644
--- a/iopsys-brcm63xx-arm/profiles/iopsys.mk
+++ b/iopsys-brcm63xx-arm/profiles/iopsys.mk
@@ -90,7 +90,7 @@ $(eval $(call Profile,koala))
 #################### EAGLE
 define Profile/eagle
   NAME:=eagle
-  PACKAGES:=i2c-tools
+  PACKAGES:=i2c-tools $(VOICE_SUPPORT)
 endef
 
 define Profile/eagle/Description
@@ -99,18 +99,6 @@ endef
 
 $(eval $(call Profile,eagle))
 
-#################### ZEBRA
-define Profile/zebra
-  NAME:=zebra
-  PACKAGES:=i2c-tools $(VOICE_SUPPORT)
-endef
-
-define Profile/zebra/Description
-	zebra profile
-endef
-
-$(eval $(call Profile,zebra))
-
 #################### Xavi xug534
 define Profile/xug534
   NAME:=xug534
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/etc/hotplug.d/button/20-softresetbutton b/iopsys-brcm63xx-arm/zebra/base-files/etc/hotplug.d/button/20-softresetbutton
deleted file mode 100644
index 3aa70b276..000000000
--- a/iopsys-brcm63xx-arm/zebra/base-files/etc/hotplug.d/button/20-softresetbutton
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-case "$ACTION" in
-        add|register)
-        [ "softresetbutton" == "$INTERFACE" ] && {
-                printf "\n\nSoft reset button is pressed\n\n" > /dev/console
-                reboot
-        }
-        ;;
-        remove|unregister)
-        ;;
-esac
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/udevtrigger b/iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/udevtrigger
deleted file mode 100755
index 3057dbc2b..000000000
--- a/iopsys-brcm63xx-arm/zebra/base-files/etc/init.d/udevtrigger
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh /etc/rc.common
-
-START=8
-
-
-boot() {
-	# Cold plug trigger - USB LED etc..
-	udevtrigger
-}
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/etc/sysctl.d/archer.conf b/iopsys-brcm63xx-arm/zebra/base-files/etc/sysctl.d/archer.conf
deleted file mode 100644
index 2e0834abc..000000000
--- a/iopsys-brcm63xx-arm/zebra/base-files/etc/sysctl.d/archer.conf
+++ /dev/null
@@ -1 +0,0 @@
-net.ipv6.conf.archer.disable_ipv6=1
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/etc/wifi.json b/iopsys-brcm63xx-arm/zebra/base-files/etc/wifi.json
deleted file mode 100644
index 132e76816..000000000
--- a/iopsys-brcm63xx-arm/zebra/base-files/etc/wifi.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-        "events" : [
-                {
-                        "type": "wifi-event",
-                        "name": "broadcom",
-			"ifname" : "wl0*",
-                        "family": "bcmwl",
-                        "group": [
-                                "notify"
-                        ]
-                },
-                {
-                        "type": "wifi-event",
-                        "name": "broadcom",
-			"ifname" : "wl1*",
-                        "family": "bcmwl",
-                        "group": [
-                                "notify"
-                        ]
-                },
-                {
-                        "type": "wifi-event",
-                        "name": "cfg",
-                        "ifname": "wl0",
-                        "family": "nl80211",
-                        "group": [
-                                "scan"
-                        ]
-                },
-                {
-                        "type": "wifi-event",
-                        "name": "cfg",
-                        "ifname": "wl1",
-                        "family": "nl80211",
-                        "group": [
-                                "scan"
-                        ]
-                }
-        ]
-}
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/lib/functions/iopsys-environment.sh b/iopsys-brcm63xx-arm/zebra/base-files/lib/functions/iopsys-environment.sh
deleted file mode 100644
index cc404eff0..000000000
--- a/iopsys-brcm63xx-arm/zebra/base-files/lib/functions/iopsys-environment.sh
+++ /dev/null
@@ -1,94 +0,0 @@
-get_base_macaddr() {
-	local basemac="$(/usr/bin/kv_read BaseMacAddr)"
-	echo "$basemac"
-}
-
-get_macaddr_maxsize() {
-	local maxsize="$(/usr/bin/kv_read NumMacAddrs)"
-	echo "$maxsize"
-}
-
-get_board_id() {
-	local board_id="$(fw_printenv -n boardid | tr '_' '-')"
-	echo "$board_id"
-}
-
-get_product_name() {
-	local prodname="$(/usr/bin/kv_read ProdName)"
-	echo "$prodname"
-}
-
-get_serial_number() {
-	local serial_number="$(/usr/bin/kv_read SerialNumber)"
-	case $serial_number in
-		*[a-z]*|*[A-Z]*|*[0-9]*) ;;
-		*) serial_number="0000000000" ;;
-	esac
-	echo "$serial_number"
-}
-
-get_psn() {
-	local psn="$(/usr/bin/kv_read PSN)"
-	case $psn in
-		*[a-z]*|*[A-Z]*|*[0-9]*) ;;
-		*) psn="0000000000" ;;
-	esac
-	echo "$psn"
-}
-
-get_variant() {
-	local variant="$(/usr/bin/kv_read Variant)"
-	case $variant in
-		*[0-9]*) ;;
-		*) variant="0" ;;
-	esac
-	echo "$variant"
-}
-
-get_hardware_version() {
-	local hardware_version="$(/usr/bin/kv_read HV)"
-	case $hardware_version in
-		.[0-9]*) hardware_version="1$hardware_version" ;;
-		[0-9]*) ;;
-		*) hardware_version="0" ;;
-	esac
-	echo "$hardware_version"
-}
-
-get_wpa_key() {
-	local wpa_key="$(/usr/bin/kv_read WpaKey)"
-	case $wpa_key in
-		*[a-z]*|*[A-Z]*|*[0-9]*) wpa_key=$(echo $wpa_key | sed 's/[ \t]*$//') ;;
-		*) wpa_key="00000000" ;;
-	esac
-	echo "$wpa_key"
-}
-
-get_des_key() {
-	local des_key="$(/usr/bin/kv_read DesKey)"
-	echo "$des_key"
-}
-
-get_auth_key() {
-	local auth_key="$(/usr/bin/kv_read AuthKey)"
-	echo "$auth_key"
-}
-
-get_user_password() {
-	local user_pass="$(/usr/bin/kv_read UserPassword)"
-	echo "$user_pass"
-}
-
-get_acs_password() {
-	local acs_pass="$(/usr/bin/kv_read AcsPassword)"
-	echo "$acs_pass"
-}
-
-get_production_mode() {
-	local production="$(fw_printenv -n Production)"
-	echo "$production"
-}
-
-get_board_specific_encryption_key() {
-	[ -f /proc/device-tree/key_dev_specific_512 ] && cat /proc/device-tree/key_dev_specific_512 2> /dev/null
-}
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/usr/bin/kv_read b/iopsys-brcm63xx-arm/zebra/base-files/usr/bin/kv_read
deleted file mode 100755
index 0968839e0..000000000
--- a/iopsys-brcm63xx-arm/zebra/base-files/usr/bin/kv_read
+++ /dev/null
@@ -1,15 +0,0 @@
- #!/bin/sh
-
-readonly DEVPARAM_FILE="/data/config/device_params"
-readonly DEVPARAM="$1"
-
-if [ ! -f $DEVPARAM_FILE ]; then
-	fw_printenv -n $DEVPARAM
-	exit $?
-fi
-
-if [ -n "$DEVPARAM" ]; then
-	grep "^${DEVPARAM}=" $DEVPARAM_FILE | awk -F'=' '{print$2}'
-else
-	cat $DEVPARAM_FILE
-fi
diff --git a/iopsys-brcm63xx-arm/zebra/base-files/usr/libexec/rpcd/wifi.acs b/iopsys-brcm63xx-arm/zebra/base-files/usr/libexec/rpcd/wifi.acs
deleted file mode 100755
index 048c31b59..000000000
--- a/iopsys-brcm63xx-arm/zebra/base-files/usr/libexec/rpcd/wifi.acs
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/bin/sh
-
-. /usr/share/libubox/jshn.sh
-
-get_acs_interface() {
-	local root_intf="$1"
-	local intfs=""
-	local intf=""
-
-	intfs="$(iw dev | grep "Interface $root_intf" | cut -f2 -d' ' | sort | xargs)"
-	for intf in $intfs; do
-		if iw dev "$intf" info | grep -q 'type AP'; then
-			echo "$intf"
-			return
-		fi
-	done
-
-	echo "$root_intf"
-}
-
-start_acs() {
-	local ifname="$1"
-	local acs_ifnames="$(uci show wireless | grep '\.channel' | grep auto | cut -d'.' -f2 | tr '\n' ' ')"
-	local found="$(echo "$acs_ifnames" | tr ' ' '\n' | grep -o -x "$ifname")"
-	local acsif=""
-
-	if [ "$found" = "$ifname" ]; then
-		sleep 1
-		ifname="$(get_acs_interface "$ifname")"
-		acs_ifnames="$(nvram get acs_ifnames 2> /dev/null | tr ' ' '\n' | grep -v -x "$ifname") $ifname"
-		nvram set acs_ifnames="$(echo "$acs_ifnames" | tr '\n' ' ' | awk '{$1=$1;print}')"
-
-		killall -9 acs_cli2 > /dev/null 2>&1
-		killall -9 acsd2 > /dev/null 2>&1
-		acsd2 > /dev/null 2>&1 &
-		sleep 1
-		for acsif in $(nvram get acs_ifnames 2> /dev/null); do
-			acs_cli2 -i "$acsif" set mode 2 > /dev/null 2>&1
-		done
-	fi
-}
-
-stop_acs() {
-	local ifname="$1"
-	local acs_ifnames="$(uci show wireless | grep '\.channel' | grep auto | cut -d'.' -f2 | tr '\n' ' ')"
-	local found="$(echo "$acs_ifnames" | tr ' ' '\n' | grep -o -x "$ifname")"
-	local acsif=""
-
-	if [ "$found" = "$ifname" ]; then
-		ifname="$(get_acs_interface "$ifname")"
-		acs_ifnames="$(nvram get acs_ifnames 2> /dev/null | tr ' ' '\n' | grep -v -x "$ifname")"
-		nvram set acs_ifnames="$(echo "$acs_ifnames" | tr '\n' ' ' | awk '{$1=$1;print}')"
-
-		killall -9 acs_cli2 > /dev/null 2>&1
-		killall -9 acsd2 > /dev/null 2>&1
-		acsd2 > /dev/null 2>&1 &
-		sleep 1
-		for acsif in $(nvram get acs_ifnames 2> /dev/null); do
-			acs_cli2 -i "$acsif" set mode 2 > /dev/null 2>&1
-		done
-	fi
-}
-
-case "$1" in
-	list)
-		json_init
-		json_add_object "status"
-		json_close_object
-		json_add_object "start"
-		json_add_string "ifname" ""
-		json_close_object
-		json_add_object "stop"
-		json_add_string "ifname" ""
-		json_close_object
-		json_dump
-	;;
-	call)
-		case "$2" in
-			start)
-				read input
-				json_load "$input"
-				json_get_var ifname ifname
-				start_acs "$ifname"
-				json_init
-				json_add_string "active_interfaces" "$(nvram get acs_ifnames 2> /dev/null | awk '{$1=$1;print}')"
-				json_dump
-			;;
-			stop)
-				read input
-				json_load "$input"
-				json_get_var ifname ifname
-				stop_acs "$ifname"
-				json_init
-				json_add_string "active_interfaces" "$(nvram get acs_ifnames 2> /dev/null | awk '{$1=$1;print}')"
-				json_dump
-			;;
-			status)
-				json_init
-				json_add_string "active_interfaces" "$(nvram get acs_ifnames 2> /dev/null | awk '{$1=$1;print}')"
-				json_dump
-			;;
-		esac
-	;;
-esac
-- 
GitLab