From a511dacc7e7f5ca0198cdfbee17c8a0a022a818a Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 7 Nov 2020 17:19:33 -0500 Subject: [PATCH] hack startup script --- .../data_persist/dev/bin/headunit-wrapper | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/mazda/installer/config/androidauto/data_persist/dev/bin/headunit-wrapper b/mazda/installer/config/androidauto/data_persist/dev/bin/headunit-wrapper index 7cd318f9..d22d2f65 100644 --- a/mazda/installer/config/androidauto/data_persist/dev/bin/headunit-wrapper +++ b/mazda/installer/config/androidauto/data_persist/dev/bin/headunit-wrapper @@ -33,7 +33,6 @@ fi start_headunit() { rm -f /tmp/root/headunit-wireless.status - sed -i 's."wifiTransport": true."wifiTransport": false.g' /tmp/root/headunit.json taskset 0xFFFFFFFF "${SCRIPTPATH}/headunit" "$@" >> ${LOGPATH} 2>&1 & sleep 2 touch /tmp/root/headunit.status @@ -42,25 +41,6 @@ start_headunit() echo "====================" >> ${LOGPATH} } -start_AAwireless() -{ - rm -f /tmp/root/headunit.status - sed -i 's."wifiTransport": false."wifiTransport": true.g' /tmp/root/headunit.json - PHONE_IP_ADDRESS=$1 - shift - if [ ! -z $PHONE_IP_ADDRESS ]; then - sed -i "s/\"phoneIpAddress\": \".[^\"]*\"/\"phoneIpAddress\": \"$PHONE_IP_ADDRESS\"/g" /tmp/root/headunit.json - fi - sleep 2 - echo "Phone IP: $PHONE_IP_ADDRESS" >> ${LOGPATH} - taskset 0xFFFFFFFF "${SCRIPTPATH}/headunit" "$@" >> ${LOGPATH} 2>&1 & - sleep 2 - touch /tmp/root/headunit-wireless.status - echo "=== headunit-wifi ===" >> ${LOGPATH} - cat /tmp/root/headunit.json >> ${LOGPATH} - echo "====================" >> ${LOGPATH} -} - iptables -A INPUT -p tcp --dport 30515 -m state --state NEW,ESTABLISHED -j ACCEPT rm -f /tmp/root/headunit.status /tmp/root/headunit-wireless.status @@ -74,7 +54,6 @@ start_headunit # loop forever. every 5 seconds, while true do - PHONE_IP_ADDRESS=`netstat -rn|awk '$2~/192\.168\.43\.[0-9]{1,3}/ {print $2}'` if [ -e /tmp/root/usb_connect ]; then USBCHECK=1 @@ -84,34 +63,17 @@ do # echo "USB detach" >> ${LOGPATH} fi - if [ ! -z $PHONE_IP_ADDRESS ] && [ $USBCHECK == 0 ]; then - if [ -e /tmp/root/headunit.status ]; then - killall -q headunit - fi - - if ! [ -e /tmp/root/headunit-wireless.status ]; then - echo "WLAN Mode" >> ${LOGPATH} - echo "Start Headunit (WiFi Mode)" - echo "Phone IP: $PHONE_IP_ADDRESS" - start_AAwireless $PHONE_IP_ADDRESS - fi - - else # echo "USB Mode" >> ${LOGPATH} check_headunit=`ps|grep 'bin/headunit'|grep -v wrapper|grep -v grep|wc -l|awk '{print $1}'` # echo "check_headunit = $check_headunit" >> ${LOGPATH} [ $check_headunit -eq 0 ] && rm -f /tmp/root/headunit-wireless.status /tmp/root/headunit.status - if [ -e /tmp/root/headunit-wireless.status ]; then - killall -q headunit - fi if ! [ -e /tmp/root/headunit.status ]; then echo "Start Headunit (USB Mode)" echo "Start USB" >> ${LOGPATH} start_headunit fi - fi RAND=`expr $RANDOM % 5 + 3` #echo "go sleep $RAND"