[Feature][ZXW-265]merge P56U03 version
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I873f6df64e2605a77b8b8bfec35b21e7f33c5444
diff --git a/ap/app/zte_comm/wlan/src/wlan-station.c b/ap/app/zte_comm/wlan/src/wlan-station.c
index 68d39e0..1be786d 100755
--- a/ap/app/zte_comm/wlan/src/wlan-station.c
+++ b/ap/app/zte_comm/wlan/src/wlan-station.c
@@ -71,6 +71,35 @@
#define WIFI_STATION_CHANNEL11 2462
#define WIFI_STATION_CHANNEL12 2467
#define WIFI_STATION_CHANNEL13 2472
+
+#define WIFI_STATION_CHANNEL14 2484
+//5G
+#define WIFI_STATION_CHANNEL36 5180
+#define WIFI_STATION_CHANNEL40 5200
+#define WIFI_STATION_CHANNEL44 5220
+#define WIFI_STATION_CHANNEL48 5240
+#define WIFI_STATION_CHANNEL52 5260
+#define WIFI_STATION_CHANNEL56 5280
+#define WIFI_STATION_CHANNEL60 5300
+#define WIFI_STATION_CHANNEL64 5320
+#define WIFI_STATION_CHANNEL100 5500
+#define WIFI_STATION_CHANNEL104 5520
+#define WIFI_STATION_CHANNEL108 5540
+#define WIFI_STATION_CHANNEL112 5560
+#define WIFI_STATION_CHANNEL116 5580
+#define WIFI_STATION_CHANNEL120 5600
+#define WIFI_STATION_CHANNEL124 5620
+#define WIFI_STATION_CHANNEL128 5640
+#define WIFI_STATION_CHANNEL132 5660
+#define WIFI_STATION_CHANNEL136 5680
+#define WIFI_STATION_CHANNEL140 5700
+#define WIFI_STATION_CHANNEL144 5720
+#define WIFI_STATION_CHANNEL149 5745
+#define WIFI_STATION_CHANNEL153 5765
+#define WIFI_STATION_CHANNEL157 5785
+#define WIFI_STATION_CHANNEL161 5805
+#define WIFI_STATION_CHANNEL165 5825
+
#define WIFI_STATION_FREQ_LEN 16
#define WIFI_STATION_MSG_SOURCE_STR_LEN 15
@@ -159,7 +188,51 @@
//#define SIMCARD_INIT_LOCKED "locked"
//#define SIMCARD_INIT_FAIL "fail"
//#define SIMCARD_INIT_PARTIAL_SUCCESS "partial_success"
+#if 0
+static const wlan_sta_freq_ch_t g_sta_freq_ch[] =
+{
+ {WIFI_STATION_CHANNEL1, 1},
+ {WIFI_STATION_CHANNEL2, 2},
+ {WIFI_STATION_CHANNEL3, 3},
+ {WIFI_STATION_CHANNEL4, 4},
+ {WIFI_STATION_CHANNEL5, 5},
+ {WIFI_STATION_CHANNEL6, 6},
+ {WIFI_STATION_CHANNEL7, 7},
+ {WIFI_STATION_CHANNEL8, 8},
+ {WIFI_STATION_CHANNEL9, 9},
+ {WIFI_STATION_CHANNEL10, 10},
+ {WIFI_STATION_CHANNEL11, 11},
+ {WIFI_STATION_CHANNEL12, 12},
+ {WIFI_STATION_CHANNEL13, 13},
+ {WIFI_STATION_CHANNEL14, 14},
+ {WIFI_STATION_CHANNEL36, 36},
+ {WIFI_STATION_CHANNEL40, 40},
+ {WIFI_STATION_CHANNEL44, 44},
+ {WIFI_STATION_CHANNEL48, 48},
+ {WIFI_STATION_CHANNEL52, 52},
+ {WIFI_STATION_CHANNEL56, 56},
+ {WIFI_STATION_CHANNEL60, 60},
+ {WIFI_STATION_CHANNEL64, 64},
+ {WIFI_STATION_CHANNEL100, 100},
+ {WIFI_STATION_CHANNEL104, 104},
+ {WIFI_STATION_CHANNEL108, 108},
+ {WIFI_STATION_CHANNEL112, 112},
+ {WIFI_STATION_CHANNEL116, 116},
+ {WIFI_STATION_CHANNEL120, 120},
+ {WIFI_STATION_CHANNEL124, 124},
+ {WIFI_STATION_CHANNEL128, 128},
+ {WIFI_STATION_CHANNEL132, 132},
+ {WIFI_STATION_CHANNEL136, 136},
+ {WIFI_STATION_CHANNEL140, 140},
+ {WIFI_STATION_CHANNEL144, 144},
+ {WIFI_STATION_CHANNEL149, 149},
+ {WIFI_STATION_CHANNEL153, 153},
+ {WIFI_STATION_CHANNEL157, 157},
+ {WIFI_STATION_CHANNEL161, 161},
+ {WIFI_STATION_CHANNEL165, 165}
+};
+#endif
extern struct wlan_sta_manager *sta_manager;
extern int need_channel_follow;
@@ -192,7 +265,7 @@
#ifdef USE_CAP_SUPPORT
int g_cap_scan = 0; //½öcap·¢Æðscanʱ,²ÅÉϱ¨½á¹û,ºǫִ́Ðнá¹û²»±¨
-static int send_sta_status_to_cap(int status, int reason);
+int send_sta_status_to_cap(int status, int reason);
#endif
static int wifi_station_connect (int from_where);
@@ -1314,6 +1387,136 @@
}
+static int frequency_to_channel(int freq)
+{
+ int channel = 0;
+ //channel
+ switch(freq) {
+ case WIFI_STATION_CHANNEL1:
+ channel = 1;
+ break;
+ case WIFI_STATION_CHANNEL2:
+ channel = 2;
+ break;
+ case WIFI_STATION_CHANNEL3:
+ channel = 3;
+ break;
+ case WIFI_STATION_CHANNEL4:
+ channel = 4;
+ break;
+ case WIFI_STATION_CHANNEL5:
+ channel = 5;
+ break;
+ case WIFI_STATION_CHANNEL6:
+ channel = 6;
+ break;
+ case WIFI_STATION_CHANNEL7:
+ channel = 7;
+ break;
+ case WIFI_STATION_CHANNEL8:
+ channel = 8;
+ break;
+ case WIFI_STATION_CHANNEL9:
+ channel = 9;
+ break;
+ case WIFI_STATION_CHANNEL10:
+ channel = 10;
+ break;
+ case WIFI_STATION_CHANNEL11:
+ channel = 11;
+ break;
+ case WIFI_STATION_CHANNEL12:
+ channel = 12;
+ break;
+ case WIFI_STATION_CHANNEL13:
+ channel = 13;
+ break;
+ case WIFI_STATION_CHANNEL14:
+ channel = 14;
+ break;
+ case WIFI_STATION_CHANNEL36:
+ channel = 36;
+ break;
+ case WIFI_STATION_CHANNEL40:
+ channel = 40;
+ break;
+ case WIFI_STATION_CHANNEL44:
+ channel = 44;
+ break;
+ case WIFI_STATION_CHANNEL48:
+ channel = 48;
+ break;
+ case WIFI_STATION_CHANNEL52:
+ channel = 52;
+ break;
+ case WIFI_STATION_CHANNEL56:
+ channel = 56;
+ break;
+ case WIFI_STATION_CHANNEL60:
+ channel = 60;
+ break;
+ case WIFI_STATION_CHANNEL64:
+ channel = 64;
+ break;
+ case WIFI_STATION_CHANNEL100:
+ channel = 100;
+ break;
+ case WIFI_STATION_CHANNEL104:
+ channel = 104;
+ break;
+ case WIFI_STATION_CHANNEL108:
+ channel = 108;
+ break;
+ case WIFI_STATION_CHANNEL112:
+ channel = 112;
+ break;
+ case WIFI_STATION_CHANNEL116:
+ channel = 116;
+ break;
+ case WIFI_STATION_CHANNEL120:
+ channel = 120;
+ break;
+ case WIFI_STATION_CHANNEL124:
+ channel = 124;
+ break;
+ case WIFI_STATION_CHANNEL128:
+ channel = 128;
+ break;
+ case WIFI_STATION_CHANNEL132:
+ channel = 132;
+ break;
+ case WIFI_STATION_CHANNEL136:
+ channel = 136;
+ break;
+ case WIFI_STATION_CHANNEL140:
+ channel = 140;
+ break;
+ case WIFI_STATION_CHANNEL144:
+ channel = 144;
+ break;
+ case WIFI_STATION_CHANNEL149:
+ channel = 149;
+ break;
+ case WIFI_STATION_CHANNEL153:
+ channel = 153;
+ break;
+ case WIFI_STATION_CHANNEL157:
+ channel = 157;
+ break;
+ case WIFI_STATION_CHANNEL161:
+ channel = 161;
+ break;
+ case WIFI_STATION_CHANNEL165:
+ channel = 165;
+ break;
+ default:
+ channel = 0;
+ wf_log("unknow freq[%d]MHz!!!", freq);
+ break;
+ }
+
+ return channel;
+}
static scan_result_t* parse_scan_result (Var *var)
{
@@ -1403,6 +1606,9 @@
}
//channel
+#ifdef USE_CAP_SUPPORT
+ scan_result->channel = frequency_to_channel(frequency);
+#else
switch (frequency) {
case WIFI_STATION_CHANNEL1:
scan_result->channel = 1;
@@ -1447,7 +1653,7 @@
scan_result->channel = 0;
break;
}
-
+#endif
//authMode¼øÈ¨Ä£Ê½
ptr = NULL;
ptr2 = NULL;
@@ -1753,7 +1959,7 @@
wf_log ("wifi_sta_connection isn't 1,abormal!!!========");
return;
}
-
+#ifndef USE_CAP_SUPPORT
//ÕýÔÚÁ¬½Ó״̬ÔòÍ˳ö
sc_cfg_get ("sta_ip_status", sta_ip_status, sizeof (sta_ip_status));
if (strcmp (sta_ip_status, WIFI_STATION_IP_STATUS_CONNECTING) == 0 ||
@@ -1762,7 +1968,7 @@
sc_cfg_set ("scan_finish", "2"); //Ä¿µÄÊǸæËßwebui£¬´Ëʱµ×²ãÔÚconnecting
return;
}
-
+#endif
//wpa_supplicant½ø³ÌûÆô¶¯ÔòÆô¶¯£¬ÊôÓÚÒì³£±£»¤
if (check_supplicant_alive() ==0) {
wf_log ("detect wpa_supplicant isnot running========");
@@ -2513,6 +2719,7 @@
else {
#ifdef USE_CAP_SUPPORT
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");
@@ -2528,7 +2735,7 @@
}
-static int send_sta_status_to_cap(int status, int reason)
+int send_sta_status_to_cap(int status, int reason)
{
int ret = 0;
wlan_sta_status_t sta_stat = {0};
@@ -2716,7 +2923,6 @@
}
}
-
#endif
//wifi station´¦Àíº¯Êý
@@ -3020,7 +3226,14 @@
snprintf(freq, len+1, "%s", start);
frequency = atoi(freq);
wf_log("Trying to associate with freq= %s[%d]", freq, frequency);
-
+
+#ifdef USE_CAP_SUPPORT
+ int i_ch = 0;
+ char s_ch[10] = {0};
+ i_ch = frequency_to_channel(frequency);
+ snprintf(s_ch, sizeof(s_ch), "%d", i_ch);
+ sc_cfg_set("flower_channel", s_ch);
+#else
switch (frequency) {
case WIFI_STATION_CHANNEL1:
sc_cfg_set("flower_channel", "1");
@@ -3066,6 +3279,7 @@
wf_log("channel_follow with unknow freq = [%d]", frequency);
break;
}
+#endif
}
ipc_send_message (MODULE_ID_WIFI, MODULE_ID_WIFI, MSG_CMD_WIFI_CHANNEL_FOLLOW, 0, NULL, 0);