33
33
start_headunit ()
34
34
{
35
35
rm -f /tmp/root/headunit-wireless.status
36
- sed -i ' s."wifiTransport": true."wifiTransport": false.g' /tmp/root/headunit.json
37
36
taskset 0xFFFFFFFF " ${SCRIPTPATH} /headunit" " $@ " >> ${LOGPATH} 2>&1 &
38
37
sleep 2
39
38
touch /tmp/root/headunit.status
@@ -42,25 +41,6 @@ start_headunit()
42
41
echo " ====================" >> ${LOGPATH}
43
42
}
44
43
45
- start_AAwireless ()
46
- {
47
- rm -f /tmp/root/headunit.status
48
- sed -i ' s."wifiTransport": false."wifiTransport": true.g' /tmp/root/headunit.json
49
- PHONE_IP_ADDRESS=$1
50
- shift
51
- if [ ! -z $PHONE_IP_ADDRESS ]; then
52
- sed -i " s/\" phoneIpAddress\" : \" .[^\" ]*\" /\" phoneIpAddress\" : \" $PHONE_IP_ADDRESS \" /g" /tmp/root/headunit.json
53
- fi
54
- sleep 2
55
- echo " Phone IP: $PHONE_IP_ADDRESS " >> ${LOGPATH}
56
- taskset 0xFFFFFFFF " ${SCRIPTPATH} /headunit" " $@ " >> ${LOGPATH} 2>&1 &
57
- sleep 2
58
- touch /tmp/root/headunit-wireless.status
59
- echo " === headunit-wifi ===" >> ${LOGPATH}
60
- cat /tmp/root/headunit.json >> ${LOGPATH}
61
- echo " ====================" >> ${LOGPATH}
62
- }
63
-
64
44
iptables -A INPUT -p tcp --dport 30515 -m state --state NEW,ESTABLISHED -j ACCEPT
65
45
66
46
rm -f /tmp/root/headunit.status /tmp/root/headunit-wireless.status
@@ -74,7 +54,6 @@ start_headunit
74
54
# loop forever. every 5 seconds,
75
55
while true
76
56
do
77
- PHONE_IP_ADDRESS=` netstat -rn| awk ' $2~/192\.168\.43\.[0-9]{1,3}/ {print $2}' `
78
57
79
58
if [ -e /tmp/root/usb_connect ]; then
80
59
USBCHECK=1
84
63
# echo "USB detach" >> ${LOGPATH}
85
64
fi
86
65
87
- if [ ! -z $PHONE_IP_ADDRESS ] && [ $USBCHECK == 0 ]; then
88
- if [ -e /tmp/root/headunit.status ]; then
89
- killall -q headunit
90
- fi
91
-
92
- if ! [ -e /tmp/root/headunit-wireless.status ]; then
93
- echo " WLAN Mode" >> ${LOGPATH}
94
- echo " Start Headunit (WiFi Mode)"
95
- echo " Phone IP: $PHONE_IP_ADDRESS "
96
- start_AAwireless $PHONE_IP_ADDRESS
97
- fi
98
-
99
- else
100
66
# echo "USB Mode" >> ${LOGPATH}
101
67
check_headunit=` ps| grep ' bin/headunit' | grep -v wrapper| grep -v grep| wc -l| awk ' {print $1}' `
102
68
# echo "check_headunit = $check_headunit" >> ${LOGPATH}
103
69
104
70
[ $check_headunit -eq 0 ] && rm -f /tmp/root/headunit-wireless.status /tmp/root/headunit.status
105
71
106
- if [ -e /tmp/root/headunit-wireless.status ]; then
107
- killall -q headunit
108
- fi
109
72
if ! [ -e /tmp/root/headunit.status ]; then
110
73
echo " Start Headunit (USB Mode)"
111
74
echo " Start USB" >> ${LOGPATH}
112
75
start_headunit
113
76
fi
114
- fi
115
77
116
78
RAND=` expr $RANDOM % 5 + 3`
117
79
# echo "go sleep $RAND"
0 commit comments