diff --git a/iopsys-brcm63xx-arm/config/eagle/config b/iopsys-brcm63xx-arm/config/eagle/config index 7b31070a510a7acdd155020a6553314ccb6b952c..18e5727ba0a0f141b945435dcf937cadefa5d06b 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 3ec51707dc4cae4ef803cd13079a3d3be7d740ed..0000000000000000000000000000000000000000 --- 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 8c1a2cec6aa4131d45c7364c17cee0ab49030c43..521b84b7067fc18b2e2ad747881b1cfc8721bdb3 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 afe3ca95a5f4457027f1fd7ca557e64648d3f3be..64b2457dd32d73fcaa7038457624bb577cd80bca 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 0000000000000000000000000000000000000000..34d000fc6112f5d70dc0b067483c5b70e2519f14 --- /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 22786831482e6293072f47842658635bbd2d3587..e00b888619139deaa660cbcf845960a4a2c2d639 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 afe3ca95a5f4457027f1fd7ca557e64648d3f3be..64b2457dd32d73fcaa7038457624bb577cd80bca 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 22786831482e6293072f47842658635bbd2d3587..e00b888619139deaa660cbcf845960a4a2c2d639 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 afe3ca95a5f4457027f1fd7ca557e64648d3f3be..64b2457dd32d73fcaa7038457624bb577cd80bca 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 22786831482e6293072f47842658635bbd2d3587..e00b888619139deaa660cbcf845960a4a2c2d639 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 0000000000000000000000000000000000000000..a8673490a01a3031d0201905377d725e15faf385 --- /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 0000000000000000000000000000000000000000..e00b888619139deaa660cbcf845960a4a2c2d639 --- /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 21edd36edfaafcb08562c2c8f0f2ec0d93df25c8..6ecefd1dc138b8068c004492cfe810589f51173a 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 3aa70b276921fb45d23ce09b50147b93c5d519b0..0000000000000000000000000000000000000000 --- 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 3057dbc2b572a860d525afdf89a255a2c0a24b3f..0000000000000000000000000000000000000000 --- 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 2e0834abcd6b6c54920d1fe0a4b7c225d1ead4d0..0000000000000000000000000000000000000000 --- 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 132e768166da278b371aa179f82da8621a9ae2b1..0000000000000000000000000000000000000000 --- 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 cc404eff0957e5b47e36bd8f4dea9e21893ab0f8..0000000000000000000000000000000000000000 --- 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 0968839e0c6a64143da19da7b536fa7784f50384..0000000000000000000000000000000000000000 --- 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 048c31b5968920553c0188f214529a162973bf83..0000000000000000000000000000000000000000 --- 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