[Feature][T106][task-view-74]Based on baseline p56u06 first and fifth patch WiFi part and patch caused mac failure and gpio setting input low failure modification

	Only Configure: Yes
	Affected branch: master
	Affected module: wifi
	Is it affected on both ZXIC and MTK:only ZXIC
	Self-test: Yes
	Doc Update:No

Change-Id: I06a6b61b6e229f4f9f4e949e98c0454110be810c
diff --git a/ap/app/zte_comm/wlan/src/wlan-station.c b/ap/app/zte_comm/wlan/src/wlan-station.c
index 371635b..54070e3 100755
--- a/ap/app/zte_comm/wlan/src/wlan-station.c
+++ b/ap/app/zte_comm/wlan/src/wlan-station.c
@@ -241,6 +241,7 @@
 extern struct  wlan_sta_manager  *sta_manager;

 extern int need_channel_follow;

 

+

 //static int g_timer_sim_init_undefined_status_count = 0;

 //add by zhouti ÔÚeap ÈÏÖ¤¹ý³Ìǰ·¢Ë͵ÄÒì²½ÏûÏ¢Ôڵȴýʱºò£¬Èç¹ûÓû§disconnect£¬ÄÇôÐèÒªÅжϻØÀ´µÄrespÏûÏ¢ÊÇ·ñΪÕâ´ÎµÄ»ØÓ¦£¬Èç¹ûÊǾÍÐèÒª¶ªÆú²»´¦Àí

 static int g_send_count = 0;

@@ -268,6 +269,9 @@
 int g_connecting_time_out_timer = 0;//È«¾Ö¼Ç¼ÊÇ·ñÒÑ´´½¨Á¬½Ó³¬Ê±¶¨Ê±Æ÷

 

 #ifdef USE_CAP_SUPPORT

+extern int g_work_mode;

+extern int g_cap_sta_enable;

+

 int g_cap_scan = 0; //½öcap·¢Æðscanʱ,²ÅÉϱ¨½á¹û,ºǫִ́Ðнá¹û²»±¨

 int send_sta_status_to_cap(int status, int reason);

 #endif

@@ -2719,24 +2723,26 @@
 static void cap_station_enable(wlan_sta_enable_t *sta_ena)

 {

 	if (sta_ena->enable == 1) {

+		g_cap_sta_enable = 1;

 		if (1 == g_wpa_supplicant) {

 			wf_log("station has opened");

 			return;

 		}

 		//MSG_CMD_WIFI_STATION_OPEN;

-#if defined(__REALTEK_8192_CHIP__) || defined(__AIC_8800DW_CHIP__)

-		wifi_station_open_apsta();

-		//wifi_station_connect(MODULE_ID_WEB_CGI);//´ò¿ªµÄʱºòÒѾ­Á¬ÁËÒ»´Î£¬Ã»ÓбØÒªÔÙ´ÎÁ¬½Ó

-#else

-		wf_log("-MSG_CMD_WIFI_STATION_OPEN-");

-		wlan_station_init();

-#endif

+		if (g_work_mode == IN_WIFI_WORK_MODE_AP0 || g_work_mode == IN_WIFI_WORK_MODE_AP1) {

+			wifi_station_open_apsta();

+			//wifi_station_connect(MODULE_ID_WEB_CGI);//´ò¿ªµÄʱºòÒѾ­Á¬ÁËÒ»´Î£¬Ã»ÓбØÒªÔÙ´ÎÁ¬½Ó

+		}

+		else {

+			wf_log("-MSG_CMD_WIFI_STATION_OPEN-");

+			wlan_station_init();

+		}

 	}

 	else {

-#ifdef USE_CAP_SUPPORT

+		g_cap_sta_enable = 0;

 		send_sta_status_to_cap(IN_WIFI_STA_STATUS_NONE, IN_WIFI_REASON_CODE_NONE);

 		//sc_cfg_set("wifi_sta_connection", "0");

-#endif

+

 		if (0 == g_wpa_supplicant) {

 			wf_log("station has closed");

 			return;

@@ -2744,9 +2750,10 @@
 		//MSG_CMD_WIFI_STATION_CLOSE;

 		sta_disconnected();

 		wlan_station_deinit();

-#if defined(__REALTEK_8192_CHIP__)|| defined(__AIC_8800DW_CHIP__)

-		basic_deal_all (WIFI_CFG_RESTART_AP);

-#endif

+		if (g_work_mode == IN_WIFI_WORK_MODE_AP0 || g_work_mode == IN_WIFI_WORK_MODE_AP1) {

+			//no mssid, not need

+			//basic_deal_all (WIFI_CFG_RESTART_AP);

+		}

 	}

 

 }

@@ -2952,20 +2959,19 @@
 	return ret;

 }

 

+static void cap_station_info(MSG_BUF *pMsg)

+{

+	wlan_sta_stat_sync_t sta_stat = {0};

+	sta_stat.rssi = get_cur_ap_rssi();

+	ipc_send_message(MODULE_ID_WIFI, pMsg->src_id, MSG_CMD_CAP_WIFI_STA_STAT_RSP, sizeof(sta_stat), &sta_stat, 0);

+}

+

 static void cap_station_scan(void)

 {

-	char wifi_sta_connection[WIFI_CONNECTION_LEN] = {0};

 	char sta_ip_status[WIFI_STATION_IP_STATUS_LEN] = {0};

-

-	sc_cfg_get("wifi_sta_connection", wifi_sta_connection, sizeof (wifi_sta_connection));

-

+	

 	wf_log("cap_station_scan");

 	//¹¦ÄܹرÕÔòÖ±½ÓÍ˳ö

-	if (strcmp(wifi_sta_connection, "1") != 0) {

-		wf_log("station close: %s", wifi_sta_connection);

-		return;

-	}

-	

 	//wpa_supplicant½ø³ÌûÆô¶¯ÔòÆô¶¯£¬ÊôÓÚÒì³£±£»¤

 	if (check_supplicant_alive() == 0) {

 		wf_log("wpa supplicant is not running!xx");

@@ -3304,7 +3310,10 @@
 		cap_station_scan();

 		break;

 	}

-

+	case MSG_CMD_CAP_WIFI_STA_STAT_REQ: {

+		cap_station_info(pMsg);

+		break;

+	}

 #endif

 	default: {

 		ret = -1;

@@ -3375,6 +3384,12 @@
 	unsigned int len = 0;//klocwork

 	int frequency = 0;

 

+#ifdef USE_CAP_SUPPORT

+	if (g_work_mode == IN_WIFI_WORK_MODE_STA) {

+		wf_log("no ap channel_follow not need");

+		return;

+	}

+#endif

 	start = strstr(buf, "freq=") + strlen("freq=");

 	if (start != NULL) {

 		end = strstr (start, " MHz");//klocwork