blob: 27aaf10a18c67e9170dffad2c27e951769614127 [file] [log] [blame]
you.chencd882682023-04-24 15:39:37 +08001#!/bin/sh
2for ((i=0; i < 10; i++)); do
3 state=`systemctl is-active wg870_drv_insmod.service`
4 if [ "$state" == "active" ]; then
5 break
6 elif [ "$state" != "activating" ]; then
7 echo "to start now"
8 systemctl start wg870_drv_insmod.service
9 fi
10 usleep 100000
11done
12
13if [ "$state" != "active" ]; then
14 exit 1
15fi
16
17state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ ping`
18if [ "$state" != "PONG" ]; then
19 for ((i=0; i < 50; i++)); do
20 usleep 100000
21 state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ ping`
22 echo "$state"
23 if [ "$state" == "PONG" ]; then
24 service_started=1
25 break
26 fi
27 done
28else
29 service_started=1
30fi
31
32if [ "$service_started" != "1" ];then
33 exit 1
34fi
35
36state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ interface | grep -vE "Available|p2p-dev" | grep wlan0`
37if [ $? != 0 ]; then
38 state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ interface_add wlan0 /data/wifi/wg870/wpa_supplicant.conf nl80211`
39 if [ "$state" != "OK" ]; then
40 exit 2
41 fi
you.chen3c309002023-04-26 10:00:06 +080042 wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 disconnect
you.chencd882682023-04-24 15:39:37 +080043fi
44
45state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ interface | grep -vE "Available|p2p-dev" | grep ap0`
46if [ $? != 0 ]; then
47 wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 DRIVER interface_create ap0
48 state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ interface_add ap0 /data/wifi/wg870/wpa_supplicant_ap.conf nl80211`
49
50 if [ "$state" != "OK" ]; then
51 exit 3
52 fi
53 ifconfig ap0 down
54fi
55
56
qs.xiongcb8547f2023-09-13 20:54:23 +080057state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 log_level INFO`
58if [ "$state" != "OK" ]; then
59 state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 log_level INFO`
60
61 if [ "$state" != "OK" ]; then
62 echo "change wpa_cli log_level to INFO FAIL"
63 fi
64fi
65
66
you.chencd882682023-04-24 15:39:37 +080067exit 0
68