blob: 662b14a5474f354d7112ab8fa2e76e0406cb08b2 [file] [log] [blame]
developerfa902712022-09-08 10:19:24 +08001From bdb9047c372c2ffa801df4be27be075e20e48084 Mon Sep 17 00:00:00 2001
2From: "Allen.Ye" <allen.ye@mediatek.com>
3Date: Thu, 8 Sep 2022 10:07:20 +0800
4Subject: [PATCH] HAL: refactor OperatingParameters
5
6---
7 source/wifi/wifi_hal.c | 399 +++++++++++++++++++++++++++++++++++++----
8 1 file changed, 360 insertions(+), 39 deletions(-)
9
10diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c
11index 414b60a..d87fd99 100644
12--- a/source/wifi/wifi_hal.c
13+++ b/source/wifi/wifi_hal.c
14@@ -2223,6 +2223,28 @@ INT wifi_setBandSteeringApGroup(char *ApGroup)
15 return RETURN_OK;
16 }
17
18+INT wifi_getApDTIMInterval(INT apIndex, INT *dtimInterval)
19+{
20+ char config_file[128] = {'\0'};
21+ char buf[128] = {'\0'};
22+
23+ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
24+ if (dtimInterval == NULL)
25+ return RETURN_ERR;
26+
27+ snprintf(config_file, sizeof(config_file), "%s%d.conf", CONFIG_PREFIX, apIndex);
28+ wifi_hostapdRead(config_file, "dtime_period", buf, sizeof(buf));
29+
30+ if (strlen(buf) == 0) {
31+ *dtimInterval = 2;
32+ } else {
33+ *dtimInterval = strtoul(buf, NULL, 10);
34+ }
35+
36+ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
37+ return RETURN_OK;
38+}
39+
40 INT wifi_setApDTIMInterval(INT apIndex, INT dtimInterval)
41 {
42 struct params params={0};
43@@ -10530,79 +10552,371 @@ int main(int argc,char **argv)
44
45 #ifdef WIFI_HAL_VERSION_3
46
47+INT BitMapToTransmitRates(UINT bitMap, char *BasicRate)
48+{
49+ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
50+ if (bitMap & WIFI_BITRATE_1MBPS)
51+ strcat(BasicRate, "1,");
52+ if (bitMap & WIFI_BITRATE_2MBPS)
53+ strcat(BasicRate, "2,");
54+ if (bitMap & WIFI_BITRATE_5_5MBPS)
55+ strcat(BasicRate, "5.5,");
56+ if (bitMap & WIFI_BITRATE_6MBPS)
57+ strcat(BasicRate, "6,");
58+ if (bitMap & WIFI_BITRATE_9MBPS)
59+ strcat(BasicRate, "9,");
60+ if (bitMap & WIFI_BITRATE_11MBPS)
61+ strcat(BasicRate, "11,");
62+ if (bitMap & WIFI_BITRATE_12MBPS)
63+ strcat(BasicRate, "12,");
64+ if (bitMap & WIFI_BITRATE_18MBPS)
65+ strcat(BasicRate, "18,");
66+ if (bitMap & WIFI_BITRATE_24MBPS)
67+ strcat(BasicRate, "24,");
68+ if (bitMap & WIFI_BITRATE_36MBPS)
69+ strcat(BasicRate, "36,");
70+ if (bitMap & WIFI_BITRATE_48MBPS)
71+ strcat(BasicRate, "48,");
72+ if (bitMap & WIFI_BITRATE_54MBPS)
73+ strcat(BasicRate, "54,");
74+ if (strlen(BasicRate) != 0) // remove last comma
75+ BasicRate[strlen(BasicRate) - 1] = '\0';
76+ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
77+ return RETURN_OK;
78+}
79+
80+INT TransmitRatesToBitMap (char *BasicRatesList, UINT *basicRateBitMap)
81+{
82+ UINT BitMap = 0;
83+ char *rate;
84+
85+ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
86+ rate = strtok(BasicRatesList, ",");
87+ while(rate != NULL)
88+ {
89+ if (strcmp(rate, "1") == 0)
90+ BitMap |= WIFI_BITRATE_1MBPS;
91+ else if (strcmp(rate, "2") == 0)
92+ BitMap |= WIFI_BITRATE_2MBPS;
93+ else if (strcmp(rate, "5.5") == 0)
94+ BitMap |= WIFI_BITRATE_5_5MBPS;
95+ else if (strcmp(rate, "6") == 0)
96+ BitMap |= WIFI_BITRATE_6MBPS;
97+ else if (strcmp(rate, "9") == 0)
98+ BitMap |= WIFI_BITRATE_9MBPS;
99+ else if (strcmp(rate, "11") == 0)
100+ BitMap |= WIFI_BITRATE_11MBPS;
101+ else if (strcmp(rate, "12") == 0)
102+ BitMap |= WIFI_BITRATE_12MBPS;
103+ else if (strcmp(rate, "18") == 0)
104+ BitMap |= WIFI_BITRATE_18MBPS;
105+ else if (strcmp(rate, "24") == 0)
106+ BitMap |= WIFI_BITRATE_24MBPS;
107+ else if (strcmp(rate, "36") == 0)
108+ BitMap |= WIFI_BITRATE_36MBPS;
109+ else if (strcmp(rate, "48") == 0)
110+ BitMap |= WIFI_BITRATE_48MBPS;
111+ else if (strcmp(rate, "54") == 0)
112+ BitMap |= WIFI_BITRATE_54MBPS;
113+ rate = strtok(NULL, ",");
114+ }
115+ *basicRateBitMap = BitMap;
116+ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
117+ return RETURN_OK;
118+}
119+
120+// This API is used to configured all radio operation parameter in a single set. it includes channel number, channelWidth, mode and auto chammel configuration.
121 INT wifi_setRadioOperatingParameters(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam)
122 {
123- // The only par-radio parameter is a channel number, however there's a 'dynamic' API
124- // to change it ("wifi_pushRadioChannel2()") that is used instead.
125+ char buf[128] = {0};
126+ char cmd[128] = {0};
127+ char config_file[64] = {0};
128+ int bandwidth;
129+ wifi_ieee80211_Mode set_mode;
130+ wifi_radio_operationParam_t current_param;
131+
132+ WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
133+
134+ if (wifi_getRadioOperatingParameters(index, &current_param) != RETURN_OK) {
135+ fprintf(stderr, "%s: wifi_getRadioOperatingParameters return error.\n", __func__);
136+ return RETURN_ERR;
137+ }
138+ if (current_param.enable != operationParam->enable) {
139+ if (wifi_setRadioEnable(index, operationParam->enable) != RETURN_OK) {
140+ fprintf(stderr, "%s: wifi_setRadioEnable return error.\n", __func__);
141+ return RETURN_ERR;
142+ }
143+ }
144+ if (current_param.autoChannelEnabled != operationParam->autoChannelEnabled) {
145+ if (wifi_setRadioAutoChannelEnable(index, operationParam->autoChannelEnabled) != RETURN_OK) {
146+ fprintf(stderr, "%s: wifi_setRadioAutoChannelEnable return error.\n", __func__);
147+ return RETURN_ERR;
148+ }
149+ }
150+ if (current_param.channelWidth != operationParam->channelWidth || (current_param.channel != operationParam->channel && !operationParam->autoChannelEnabled)) {
151+ if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_20MHZ)
152+ bandwidth = 20;
153+ else if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_40MHZ)
154+ bandwidth = 40;
155+ else if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_80MHZ)
156+ bandwidth = 80;
157+ else if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_160MHZ)
158+ bandwidth = 160;
159+ if (wifi_pushRadioChannel2(index, operationParam->channel, bandwidth, operationParam->csa_beacon_count) != RETURN_OK) {
160+ fprintf(stderr, "%s: wifi_pushRadioChannel2 return error.\n", __func__);
161+ return RETURN_ERR;
162+ }
163+ }
164+ if (current_param.variant != operationParam->variant) {
165+ // Two different definition bit map, so need to check every bit.
166+ if (operationParam->variant & WIFI_80211_VARIANT_A)
167+ set_mode |= WIFI_MODE_A;
168+ if (operationParam->variant & WIFI_80211_VARIANT_B)
169+ set_mode |= WIFI_MODE_B;
170+ if (operationParam->variant & WIFI_80211_VARIANT_G)
171+ set_mode |= WIFI_MODE_G;
172+ if (operationParam->variant & WIFI_80211_VARIANT_N)
173+ set_mode |= WIFI_MODE_N;
174+ if (operationParam->variant & WIFI_80211_VARIANT_AC)
175+ set_mode |= WIFI_MODE_AC;
176+ if (operationParam->variant & WIFI_80211_VARIANT_AX)
177+ set_mode |= WIFI_MODE_AX;
178+ // Second parameter is to set channel band width, it is done by wifi_pushRadioChannel2 if changed.
179+ memset(buf, 0, sizeof(buf));
180+ if (wifi_setRadioMode(index, buf, set_mode) != RETURN_OK) {
181+ fprintf(stderr, "%s: wifi_setRadioMode return error.\n", __func__);
182+ return RETURN_ERR;
183+ }
184+ }
185+ if (current_param.dtimPeriod != operationParam->dtimPeriod) {
186+ if (wifi_setApDTIMInterval(index, operationParam->dtimPeriod) != RETURN_OK) {
187+ fprintf(stderr, "%s: wifi_setApDTIMInterval return error.\n", __func__);
188+ return RETURN_ERR;
189+ }
190+ }
191+ if (current_param.beaconInterval != operationParam->beaconInterval) {
192+ if (wifi_setRadioBeaconPeriod(index, operationParam->beaconInterval) != RETURN_OK) {
193+ fprintf(stderr, "%s: wifi_setRadioBeaconPeriod return error.\n", __func__);
194+ return RETURN_ERR;
195+ }
196+ }
197+ if (current_param.operationalDataTransmitRates != operationParam->operationalDataTransmitRates) {
198+ BitMapToTransmitRates(operationParam->operationalDataTransmitRates, buf);
199+ if (wifi_setRadioBasicDataTransmitRates(index, buf) != RETURN_OK) {
200+ fprintf(stderr, "%s: wifi_setRadioBasicDataTransmitRates return error.\n", __func__);
201+ return RETURN_ERR;
202+ }
203+ }
204+ if (current_param.fragmentationThreshold != operationParam->fragmentationThreshold) {
205+ if (wifi_setRadioFragmentationThreshold(index, operationParam->fragmentationThreshold) != RETURN_OK) {
206+ fprintf(stderr, "%s: wifi_setRadioFragmentationThreshold return error.\n", __func__);
207+ return RETURN_ERR;
208+ }
209+ }
210+ if (current_param.guardInterval != operationParam->guardInterval) {
211+ if (wifi_setGuardInterval(index, operationParam->guardInterval) != RETURN_OK) {
212+ fprintf(stderr, "%s: wifi_setGuardInterval return error.\n", __func__);
213+ return RETURN_ERR;
214+ }
215+ }
216+ if (current_param.transmitPower != operationParam->transmitPower) {
217+ if (wifi_setRadioTransmitPower(index, operationParam->transmitPower) != RETURN_OK) {
218+ fprintf(stderr, "%s: wifi_setRadioTransmitPower return error.\n", __func__);
219+ return RETURN_ERR;
220+ }
221+ }
222+ if (current_param.rtsThreshold != operationParam->rtsThreshold) {
223+ if (wifi_setApRtsThreshold(index, operationParam->rtsThreshold) != RETURN_OK) {
224+ fprintf(stderr, "%s: wifi_setApRtsThreshold return error.\n", __func__);
225+ return RETURN_ERR;
226+ }
227+ }
228+ if (current_param.obssCoex != operationParam->obssCoex) {
229+ if (wifi_setRadioObssCoexistenceEnable(index, operationParam->obssCoex) != RETURN_OK) {
230+ fprintf(stderr, "%s: wifi_setRadioObssCoexistenceEnable return error.\n", __func__);
231+ return RETURN_ERR;
232+ }
233+ }
234+ if (current_param.stbcEnable != operationParam->stbcEnable) {
235+ if (wifi_setRadioSTBCEnable(index, operationParam->stbcEnable) != RETURN_OK) {
236+ fprintf(stderr, "%s: wifi_setRadioSTBCEnable return error.\n", __func__);
237+ return RETURN_ERR;
238+ }
239+ }
240+ if (current_param.greenFieldEnable != operationParam->greenFieldEnable) {
241+ if (wifi_setRadio11nGreenfieldEnable(index, operationParam->greenFieldEnable) != RETURN_OK) {
242+ fprintf(stderr, "%s: wifi_setRadio11nGreenfieldEnable return error.\n", __func__);
243+ return RETURN_ERR;
244+ }
245+ }
246+ WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
247+
248 return RETURN_OK;
249 }
250
251 INT wifi_getRadioOperatingParameters(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam)
252 {
253- INT ret;
254- char band[128];
255+ char band[64] = {0};
256+ char buf[256] = {0};
257+ char config_file[64] = {0};
258+ char cmd[128] = {0};
259+ int ret;
260+ int mode = 0;
261+ wifi_ieee80211_Mode get_mode = 0;
262 ULONG channel;
263+ ULONG lval;
264 BOOL enabled;
265- char buf[256];
266
267 WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
268 printf("Entering %s index = %d\n", __func__, (int)index);
269
270- ret = wifi_getRadioEnable(index, &enabled);
271- if (ret != RETURN_OK)
272+ memset(operationParam, 0, sizeof(wifi_radio_operationParam_t));
273+ snprintf(config_file, sizeof(config_file), "%s%d.conf", CONFIG_PREFIX, index);
274+ if (wifi_getRadioEnable(index, &enabled) != RETURN_OK)
275 {
276- printf("%s: cannot get enabled state for radio index %d\n", __func__,
277- index);
278+ fprintf(stderr, "%s: wifi_getRadioEnable return error.\n", __func__);
279 return RETURN_ERR;
280 }
281 operationParam->enable = enabled;
282
283 memset(band, 0, sizeof(band));
284- ret = wifi_getRadioOperatingFrequencyBand(index, band);
285- if (ret != RETURN_OK)
286+ if (wifi_getRadioOperatingFrequencyBand(index, band) != RETURN_OK)
287 {
288- printf("%s: cannot get radio band for radio index %d\n", __func__, index);
289+ fprintf(stderr, "%s: wifi_getRadioOperatingFrequencyBand return error.\n", __func__);
290 return RETURN_ERR;
291 }
292
293 if (!strcmp(band, "2.4GHz"))
294- {
295 operationParam->band = WIFI_FREQUENCY_2_4_BAND;
296- operationParam->variant = WIFI_80211_VARIANT_N;
297- }
298 else if (!strcmp(band, "5GHz"))
299- {
300 operationParam->band = WIFI_FREQUENCY_5_BAND;
301- operationParam->variant = WIFI_80211_VARIANT_AC;
302- }
303+ else if (!strcmp(band, "6GHz"))
304+ operationParam->band = WIFI_FREQUENCY_6_BAND;
305 else
306 {
307- printf("%s: cannot decode band for radio index %d ('%s')\n", __func__, index,
308+ fprintf(stderr, "%s: cannot decode band for radio index %d ('%s')\n", __func__, index,
309 band);
310 }
311
312+ wifi_hostapdRead(config_file, "channel", buf, sizeof(buf));
313+ if (strcmp(buf, "0") == 0 || strcmp(buf, "acs_survey") == 0) {
314+ operationParam->channel = 0;
315+ operationParam->autoChannelEnabled = TRUE;
316+ } else {
317+ operationParam->channel = strtol(buf, NULL, 10);
318+ operationParam->autoChannelEnabled = FALSE;
319+ }
320+
321 memset(buf, 0, sizeof(buf));
322- ret = wifi_getRadioOperatingChannelBandwidth(index, buf); // XXX: handle errors
323- // XXX: only handle 20/40/80 modes for now
324+ if (wifi_getRadioOperatingChannelBandwidth(index, buf) != RETURN_OK) {
325+ fprintf(stderr, "%s: wifi_getRadioOperatingChannelBandwidth return error.\n", __func__);
326+ return RETURN_ERR;
327+ }
328 if (!strcmp(buf, "20MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_20MHZ;
329 else if (!strcmp(buf, "40MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_40MHZ;
330 else if (!strcmp(buf, "80MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_80MHZ;
331+ else if (!strcmp(buf, "160")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_160MHZ;
332+ else if (!strcmp(buf, "80+80")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_80_80MHZ;
333 else
334 {
335- printf("%s: Unknown HT mode: '%s'\n", __func__, buf);
336- operationParam->channelWidth = 0;
337+ fprintf(stderr, "Unknown channel bandwidth: %s\n", buf);
338+ return false;
339 }
340
341- ret = wifi_getRadioChannel(index, &channel);
342- if (ret != RETURN_OK)
343- {
344- printf("%s: Failed to get channel number for radio index %d\n", __func__, index);
345- channel = 0;
346+ if (wifi_getRadioMode(index, buf, &mode) != RETURN_OK) {
347+ fprintf(stderr, "%s: wifi_getRadioMode return error.\n", __func__);
348+ return RETURN_ERR;
349+ }
350+ get_mode = (wifi_ieee80211_Mode)mode;
351+ if (get_mode & WIFI_MODE_A)
352+ operationParam->variant |= WIFI_80211_VARIANT_A;
353+ if (get_mode & WIFI_MODE_B)
354+ operationParam->variant |= WIFI_80211_VARIANT_B;
355+ if (get_mode & WIFI_MODE_G)
356+ operationParam->variant |= WIFI_80211_VARIANT_G;
357+ if (get_mode & WIFI_MODE_N)
358+ operationParam->variant |= WIFI_80211_VARIANT_N;
359+ if (get_mode & WIFI_MODE_AC)
360+ operationParam->variant |= WIFI_80211_VARIANT_AC;
361+ if (get_mode & WIFI_MODE_AX)
362+ operationParam->variant |= WIFI_80211_VARIANT_AX;
363+ if (wifi_getRadioDCSEnable(index, &operationParam->DCSEnabled) != RETURN_OK) {
364+ fprintf(stderr, "%s: wifi_getRadioDCSEnable return error.\n", __func__);
365+ return RETURN_ERR;
366+ }
367+ if (wifi_getApDTIMInterval(index, &operationParam->dtimPeriod) != RETURN_OK) {
368+ fprintf(stderr, "%s: wifi_getApDTIMInterval return error.\n", __func__);
369+ return RETURN_ERR;
370+ }
371+ if (wifi_getRadioBeaconPeriod(index, &operationParam->dtimPeriod) != RETURN_OK) {
372+ fprintf(stderr, "%s: wifi_getRadioBeaconPeriod return error.\n", __func__);
373+ return RETURN_ERR;
374+ }
375+
376+ memset(buf, 0, sizeof(buf));
377+ if (wifi_getRadioSupportedDataTransmitRates(index, buf) != RETURN_OK) {
378+ fprintf(stderr, "%s: wifi_getRadioSupportedDataTransmitRates return error.\n", __func__);
379+ return RETURN_ERR;
380+ }
381+ TransmitRatesToBitMap(buf, &operationParam->basicDataTransmitRates);
382+
383+ memset(buf, 0, sizeof(buf));
384+ if (wifi_getRadioBasicDataTransmitRates(index, buf) != RETURN_OK) {
385+ fprintf(stderr, "%s: wifi_getRadioBasicDataTransmitRates return error.\n", __func__);
386+ return RETURN_ERR;
387+ }
388+ TransmitRatesToBitMap(buf, &operationParam->operationalDataTransmitRates);
389+
390+ memset(buf, 0, sizeof(buf));
391+ wifi_hostapdRead(config_file, "fragm_threshold", buf, sizeof(buf));
392+ operationParam->fragmentationThreshold = strtoul(buf, NULL, 10);
393+
394+ if (wifi_getGuardInterval(index, &operationParam->guardInterval) != RETURN_OK) {
395+ fprintf(stderr, "%s: wifi_getGuardInterval return error.\n", __func__);
396+ return RETURN_ERR;
397+ }
398+ if (wifi_getRadioPercentageTransmitPower(index, &operationParam->transmitPower) != RETURN_OK) {
399+ fprintf(stderr, "%s: wifi_getRadioPercentageTransmitPower return error.\n", __func__);
400+ return RETURN_ERR;
401 }
402- operationParam->channel = channel;
403- operationParam->csa_beacon_count = 15; // XXX: hardcoded for now
404
405- operationParam->countryCode = wifi_countrycode_US; // XXX: hardcoded for now
406+ memset(buf, 0, sizeof(buf));
407+ wifi_hostapdRead(config_file, "rts_threshold", buf, sizeof(buf));
408+ if (strcmp(buf, "-1") == 0) {
409+ operationParam->rtsThreshold = (UINT)-1; // maxuimum unsigned integer value
410+ operationParam->ctsProtection = FALSE;
411+ } else {
412+ operationParam->rtsThreshold = strtoul(buf, NULL, 10);
413+ operationParam->ctsProtection = TRUE;
414+ }
415+
416+ memset(buf, 0, sizeof(buf));
417+ wifi_hostapdRead(config_file, "ht_coex", buf, sizeof(buf));
418+ if (strcmp(buf, "0") == 0)
419+ operationParam->obssCoex = FALSE;
420+ else
421+ operationParam->obssCoex = TRUE;
422+
423+ snprintf(cmd, sizeof(cmd), "cat %s | grep STBC", config_file);
424+ _syscmd(cmd, buf, sizeof(buf));
425+ if (strlen(buf) != 0)
426+ operationParam->stbcEnable = TRUE;
427+ else
428+ operationParam->stbcEnable = FALSE;
429+
430+ if (wifi_getRadio11nGreenfieldEnable(index, &operationParam->greenFieldEnable) != RETURN_OK) {
431+ fprintf(stderr, "%s: wifi_getRadio11nGreenfieldEnable return error.\n", __func__);
432+ return RETURN_ERR;
433+ }
434+
435+ // Below value is hardcoded
436+
437+ operationParam->numSecondaryChannels = 0;
438+ for (int i = 0; i < MAXNUMSECONDARYCHANNELS; i++) {
439+ operationParam->channelSecondary[i] = 0;
440+ }
441+ operationParam->csa_beacon_count = 15;
442+ operationParam->countryCode = wifi_countrycode_US; // need to conver string to corresponding enum
443
444 WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__);
445 return RETURN_OK;
446@@ -10784,6 +11098,7 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap)
447 wifi_channels_list_t *chlistp;
448 CHAR output_string[64];
449 CHAR pchannels[128];
450+ wifi_band band;
451
452 if(rcap == NULL)
453 {
454@@ -10791,11 +11106,14 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap)
455 }
456
457 rcap->numSupportedFreqBand = 1;
458- if (1 == radioIndex)
459- rcap->band[0] = WIFI_FREQUENCY_5_BAND;
460- else
461- rcap->band[0] = WIFI_FREQUENCY_2_4_BAND;
462+ band = wifi_index_to_band(radioIndex);
463
464+ if (band == band_2_4)
465+ rcap->band[0] = WIFI_FREQUENCY_2_4_BAND;
466+ else if (band == band_5)
467+ rcap->band[0] = WIFI_FREQUENCY_5_BAND;
468+ else if (band == band_6)
469+ rcap->band[0] = WIFI_FREQUENCY_6_BAND;
470
471 chlistp = &(rcap->channel_list[0]);
472 memset(pchannels, 0, sizeof(pchannels));
473@@ -10854,7 +11172,7 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap)
474 WIFI_CHANNELBANDWIDTH_40MHZ);
475
476 }
477- else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND )) {
478+ else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND ) || rcap->band[i] & (WIFI_FREQUENCY_6_BAND)) {
479 rcap->channelWidth[i] |= (WIFI_CHANNELBANDWIDTH_20MHZ |
480 WIFI_CHANNELBANDWIDTH_40MHZ |
481 WIFI_CHANNELBANDWIDTH_80MHZ | WIFI_CHANNELBANDWIDTH_160MHZ);
482@@ -10864,10 +11182,13 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap)
483 /* mode - all supported variants */
484 // rcap->mode[i] = WIFI_80211_VARIANT_H;
485 if (rcap->band[i] & WIFI_FREQUENCY_2_4_BAND ) {
486- rcap->mode[i] = (WIFI_80211_VARIANT_N);
487+ rcap->mode[i] = ( WIFI_80211_VARIANT_B | WIFI_80211_VARIANT_G | WIFI_80211_VARIANT_N | WIFI_80211_VARIANT_AX );
488 }
489 else if (rcap->band[i] & WIFI_FREQUENCY_5_BAND ) {
490- rcap->mode[i] = ( WIFI_80211_VARIANT_AC );
491+ rcap->mode[i] = ( WIFI_80211_VARIANT_A | WIFI_80211_VARIANT_N | WIFI_80211_VARIANT_AC | WIFI_80211_VARIANT_AX );
492+ }
493+ else if (rcap->band[i] & WIFI_FREQUENCY_6_BAND) {
494+ rcap->mode[i] = ( WIFI_80211_VARIANT_AX );
495 }
496 rcap->maxBitRate[i] = ( rcap->band[i] & WIFI_FREQUENCY_2_4_BAND ) ? 300 :
497 ((rcap->band[i] & WIFI_FREQUENCY_5_BAND) ? 1734 : 0);
498@@ -10878,7 +11199,7 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap)
499 rcap->supportedBitRate[i] |= (WIFI_BITRATE_6MBPS | WIFI_BITRATE_9MBPS |
500 WIFI_BITRATE_11MBPS | WIFI_BITRATE_12MBPS);
501 }
502- else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND )) {
503+ else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND ) | rcap->band[i] & (WIFI_FREQUENCY_6_BAND )) {
504 rcap->supportedBitRate[i] |= (WIFI_BITRATE_6MBPS | WIFI_BITRATE_9MBPS |
505 WIFI_BITRATE_12MBPS | WIFI_BITRATE_18MBPS | WIFI_BITRATE_24MBPS |
506 WIFI_BITRATE_36MBPS | WIFI_BITRATE_48MBPS | WIFI_BITRATE_54MBPS);
507--
5082.18.0
509