[Bugfix][API-1158] tmp fix ap cannot connect & ping bug
Only Configure:NO
Affected branch:MR3.0-xx && GSW3.0
Affected module:wifi
Is it addected on both ZXIC and MTK: only MTK
Self-test: Yes
Doc Update: NO
Change-Id: I531f04099040bc709b149b273bc07e6cc183d09a
diff --git a/src/lynq/lib/liblynq-wifi6/libwifi6.c b/src/lynq/lib/liblynq-wifi6/libwifi6.c
index f6f1dc5..3c2ff97 100755
--- a/src/lynq/lib/liblynq-wifi6/libwifi6.c
+++ b/src/lynq/lib/liblynq-wifi6/libwifi6.c
@@ -46,6 +46,11 @@
volatile int g_ap_watcher_stop_flag = 0;
volatile int g_ap_watcher_started_flag = 0;
+pthread_t g_ap_tmp_watcher_pid = 0;
+volatile int g_ap_tmp_watcher_stop_flag = 0;
+
+
+
pthread_t g_sta_watcher_pid = 0;
volatile int g_sta_watcher_stop_flag = 0;
volatile int g_sta_scan_finish_flag = 1;
@@ -490,6 +495,34 @@
}
}
+
+static void APTmpWatcherThreadProc() {
+
+ int i = 0;
+ g_ap_tmp_watcher_stop_flag = 0;
+ int delytimes = 1800;
+
+ RLOGD("APTmpWatcherThreadProc ----> ThreadProc start");
+ while(1)
+ {
+ sleep(1);
+ i++;
+ if( i == delytimes )
+ {
+ i = 0;
+ system("wl reinit");
+ RLOGD("APTmpWatcherThreadProc ----- > do cmd reinit");
+ }
+ if( g_ap_tmp_watcher_pid == 1 )
+ {
+ RLOGD("APTmpWatcherThreadProc ----- > ap closed or wifi disabled");
+ return;
+ }
+ }
+
+}
+
+
static void inner_check_connect_error(const char * event_msg, lynq_wifi_sta_status_s state, error_number_s error_num)
{
char * p;
@@ -1125,12 +1158,15 @@
g_ap_watcher_stop_flag = 1;
g_sta_watcher_stop_flag = 1;
g_sta_auto_watcher_stop_flag = 1;
+ g_ap_tmp_watcher_stop_flag = 1;
if (g_ap_watcher_pid != 0)
pthread_join(g_ap_watcher_pid, NULL);
if (g_sta_watcher_pid != 0)
pthread_join(g_sta_watcher_pid, NULL);
if (g_sta_auto_watcher_pid != 0)
pthread_join(g_sta_auto_watcher_pid, NULL);
+ if (g_ap_tmp_watcher_pid != 0)
+ pthread_join(g_ap_tmp_watcher_pid, NULL);
if (g_lynq_wpa_ctrl[0] != NULL)
wpa_ctrl_close(g_lynq_wpa_ctrl[0]);
if (g_lynq_wpa_ctrl[1] != NULL)
@@ -1138,6 +1174,7 @@
g_ap_watcher_pid = 0;
g_sta_watcher_pid = 0;
g_sta_auto_watcher_pid = 0;
+ g_ap_tmp_watcher_pid = 0;
g_lynq_wpa_ctrl[0] = NULL;
g_lynq_wpa_ctrl[1] = NULL;
system("systemctl stop wg870_drv_insmod.service");
@@ -2280,6 +2317,17 @@
check_tether_and_notify();
+ if (g_ap_tmp_watcher_pid == 0)
+ {
+ if(pthread_create(&g_ap_tmp_watcher_pid,NULL,APTmpWatcherThreadProc,NULL) < 0)
+ {
+ g_ap_tmp_watcher_pid = 0;
+ RLOGE("[wifi error]create APTmpWatcherThreadProc fail");
+ return -1;
+ }
+ RLOGD("[lynq_wifi_ap_start] creat APTmpWatcherThreadProc ok");
+ }
+
return 0;
}
@@ -2308,7 +2356,10 @@
RLOGE("lynq_wifi_ap_start excute script fail");
return -1;
}
-
+ g_ap_tmp_watcher_stop_flag = 1;
+ if (g_ap_tmp_watcher_pid != 0)
+ pthread_join(g_ap_tmp_watcher_pid, NULL);
+ g_ap_tmp_watcher_pid = 0;
return 0;
}