#!/bin/sh source /opt/wz_mini/wz_mini.conf #Set module dir depending on platform if [ -f /opt/wz_mini/tmp/.T20 ]; then KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14" else KMOD_PATH="/opt/wz_mini/lib/modules/3.10.14__isvp_swan_1.0__" fi if [[ "$ENABLE_USB_ETH" == "true" ]]; then ALT_IFACE=eth0 elif [[ "$ENABLE_USB_DIRECT" == "true" ]] || [[ "$ENABLE_USB_RNDIS" == "true" ]]; then ALT_IFACE=usb0 fi #Set the correct GPIO for the audio driver (T31 only) if [ -f /opt/wz_mini/tmp/.HL_PAN2 ]; then GPIO=7 elif [ -f /opt/wz_mini/tmp/.WYZE_CAKP2JFUS ]; then GPIO=63 fi wait_for_wlan() { while true; do if ifconfig wlan0 | grep "HWaddr" > /dev/null; then break fi echo "$1: Network HW not ready yet, try again in 5 seconds" sleep 5 done } wait_for_wlan_wpa() { while true; do if [ -e /tmp/wpa_supplicant.conf ]; then break fi echo "$1: wpa_supplicant not initialized yet, try again in 5 seconds" sleep 5 done } wait_for_wlan_ip() { while true; do if ifconfig wlan0 | grep "inet addr" > /dev/null; then break fi echo "$1: IP Address not acquired yet, try again in 5 seconds" sleep 5 done } wait_for_icamera() { while ! pgrep -f "iCamera" > /dev/null; do sleep 5 done } gateway_supervisor() { last=0 last2=0 while [[ 1 ]]; do ping -c1 -W 2 `/opt/wz_mini/bin/busybox ip route | awk '/default/ { print $3 }'` >& /dev/null status=$? if [[ $status == 1 ]]; then echo "$1: $(date) Unable to reach default route via USB Direct Link..." if [[ $last == 1 && $last2 == 1 ]]; then echo "$1: $(date) USB Direct is Down, bring down usb0" ifconfig usb0 down status=0 fi fi last2=$last last=$status sleep 10 done }