| From bdb9047c372c2ffa801df4be27be075e20e48084 Mon Sep 17 00:00:00 2001 |
| From: "Allen.Ye" <allen.ye@mediatek.com> |
| Date: Thu, 8 Sep 2022 10:07:20 +0800 |
| Subject: [PATCH] HAL: refactor OperatingParameters |
| |
| --- |
| source/wifi/wifi_hal.c | 399 +++++++++++++++++++++++++++++++++++++---- |
| 1 file changed, 360 insertions(+), 39 deletions(-) |
| |
| diff --git a/source/wifi/wifi_hal.c b/source/wifi/wifi_hal.c |
| index 414b60a..d87fd99 100644 |
| --- a/source/wifi/wifi_hal.c |
| +++ b/source/wifi/wifi_hal.c |
| @@ -2223,6 +2223,28 @@ INT wifi_setBandSteeringApGroup(char *ApGroup) |
| return RETURN_OK; |
| } |
| |
| +INT wifi_getApDTIMInterval(INT apIndex, INT *dtimInterval) |
| +{ |
| + char config_file[128] = {'\0'}; |
| + char buf[128] = {'\0'}; |
| + |
| + WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__); |
| + if (dtimInterval == NULL) |
| + return RETURN_ERR; |
| + |
| + snprintf(config_file, sizeof(config_file), "%s%d.conf", CONFIG_PREFIX, apIndex); |
| + wifi_hostapdRead(config_file, "dtime_period", buf, sizeof(buf)); |
| + |
| + if (strlen(buf) == 0) { |
| + *dtimInterval = 2; |
| + } else { |
| + *dtimInterval = strtoul(buf, NULL, 10); |
| + } |
| + |
| + WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__); |
| + return RETURN_OK; |
| +} |
| + |
| INT wifi_setApDTIMInterval(INT apIndex, INT dtimInterval) |
| { |
| struct params params={0}; |
| @@ -10530,79 +10552,371 @@ int main(int argc,char **argv) |
| |
| #ifdef WIFI_HAL_VERSION_3 |
| |
| +INT BitMapToTransmitRates(UINT bitMap, char *BasicRate) |
| +{ |
| + WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__); |
| + if (bitMap & WIFI_BITRATE_1MBPS) |
| + strcat(BasicRate, "1,"); |
| + if (bitMap & WIFI_BITRATE_2MBPS) |
| + strcat(BasicRate, "2,"); |
| + if (bitMap & WIFI_BITRATE_5_5MBPS) |
| + strcat(BasicRate, "5.5,"); |
| + if (bitMap & WIFI_BITRATE_6MBPS) |
| + strcat(BasicRate, "6,"); |
| + if (bitMap & WIFI_BITRATE_9MBPS) |
| + strcat(BasicRate, "9,"); |
| + if (bitMap & WIFI_BITRATE_11MBPS) |
| + strcat(BasicRate, "11,"); |
| + if (bitMap & WIFI_BITRATE_12MBPS) |
| + strcat(BasicRate, "12,"); |
| + if (bitMap & WIFI_BITRATE_18MBPS) |
| + strcat(BasicRate, "18,"); |
| + if (bitMap & WIFI_BITRATE_24MBPS) |
| + strcat(BasicRate, "24,"); |
| + if (bitMap & WIFI_BITRATE_36MBPS) |
| + strcat(BasicRate, "36,"); |
| + if (bitMap & WIFI_BITRATE_48MBPS) |
| + strcat(BasicRate, "48,"); |
| + if (bitMap & WIFI_BITRATE_54MBPS) |
| + strcat(BasicRate, "54,"); |
| + if (strlen(BasicRate) != 0) // remove last comma |
| + BasicRate[strlen(BasicRate) - 1] = '\0'; |
| + WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__); |
| + return RETURN_OK; |
| +} |
| + |
| +INT TransmitRatesToBitMap (char *BasicRatesList, UINT *basicRateBitMap) |
| +{ |
| + UINT BitMap = 0; |
| + char *rate; |
| + |
| + WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__); |
| + rate = strtok(BasicRatesList, ","); |
| + while(rate != NULL) |
| + { |
| + if (strcmp(rate, "1") == 0) |
| + BitMap |= WIFI_BITRATE_1MBPS; |
| + else if (strcmp(rate, "2") == 0) |
| + BitMap |= WIFI_BITRATE_2MBPS; |
| + else if (strcmp(rate, "5.5") == 0) |
| + BitMap |= WIFI_BITRATE_5_5MBPS; |
| + else if (strcmp(rate, "6") == 0) |
| + BitMap |= WIFI_BITRATE_6MBPS; |
| + else if (strcmp(rate, "9") == 0) |
| + BitMap |= WIFI_BITRATE_9MBPS; |
| + else if (strcmp(rate, "11") == 0) |
| + BitMap |= WIFI_BITRATE_11MBPS; |
| + else if (strcmp(rate, "12") == 0) |
| + BitMap |= WIFI_BITRATE_12MBPS; |
| + else if (strcmp(rate, "18") == 0) |
| + BitMap |= WIFI_BITRATE_18MBPS; |
| + else if (strcmp(rate, "24") == 0) |
| + BitMap |= WIFI_BITRATE_24MBPS; |
| + else if (strcmp(rate, "36") == 0) |
| + BitMap |= WIFI_BITRATE_36MBPS; |
| + else if (strcmp(rate, "48") == 0) |
| + BitMap |= WIFI_BITRATE_48MBPS; |
| + else if (strcmp(rate, "54") == 0) |
| + BitMap |= WIFI_BITRATE_54MBPS; |
| + rate = strtok(NULL, ","); |
| + } |
| + *basicRateBitMap = BitMap; |
| + WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__); |
| + return RETURN_OK; |
| +} |
| + |
| +// This API is used to configured all radio operation parameter in a single set. it includes channel number, channelWidth, mode and auto chammel configuration. |
| INT wifi_setRadioOperatingParameters(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam) |
| { |
| - // The only par-radio parameter is a channel number, however there's a 'dynamic' API |
| - // to change it ("wifi_pushRadioChannel2()") that is used instead. |
| + char buf[128] = {0}; |
| + char cmd[128] = {0}; |
| + char config_file[64] = {0}; |
| + int bandwidth; |
| + wifi_ieee80211_Mode set_mode; |
| + wifi_radio_operationParam_t current_param; |
| + |
| + WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__); |
| + |
| + if (wifi_getRadioOperatingParameters(index, ¤t_param) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getRadioOperatingParameters return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + if (current_param.enable != operationParam->enable) { |
| + if (wifi_setRadioEnable(index, operationParam->enable) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadioEnable return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.autoChannelEnabled != operationParam->autoChannelEnabled) { |
| + if (wifi_setRadioAutoChannelEnable(index, operationParam->autoChannelEnabled) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadioAutoChannelEnable return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.channelWidth != operationParam->channelWidth || (current_param.channel != operationParam->channel && !operationParam->autoChannelEnabled)) { |
| + if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_20MHZ) |
| + bandwidth = 20; |
| + else if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_40MHZ) |
| + bandwidth = 40; |
| + else if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_80MHZ) |
| + bandwidth = 80; |
| + else if (operationParam->channelWidth == WIFI_CHANNELBANDWIDTH_160MHZ) |
| + bandwidth = 160; |
| + if (wifi_pushRadioChannel2(index, operationParam->channel, bandwidth, operationParam->csa_beacon_count) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_pushRadioChannel2 return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.variant != operationParam->variant) { |
| + // Two different definition bit map, so need to check every bit. |
| + if (operationParam->variant & WIFI_80211_VARIANT_A) |
| + set_mode |= WIFI_MODE_A; |
| + if (operationParam->variant & WIFI_80211_VARIANT_B) |
| + set_mode |= WIFI_MODE_B; |
| + if (operationParam->variant & WIFI_80211_VARIANT_G) |
| + set_mode |= WIFI_MODE_G; |
| + if (operationParam->variant & WIFI_80211_VARIANT_N) |
| + set_mode |= WIFI_MODE_N; |
| + if (operationParam->variant & WIFI_80211_VARIANT_AC) |
| + set_mode |= WIFI_MODE_AC; |
| + if (operationParam->variant & WIFI_80211_VARIANT_AX) |
| + set_mode |= WIFI_MODE_AX; |
| + // Second parameter is to set channel band width, it is done by wifi_pushRadioChannel2 if changed. |
| + memset(buf, 0, sizeof(buf)); |
| + if (wifi_setRadioMode(index, buf, set_mode) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadioMode return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.dtimPeriod != operationParam->dtimPeriod) { |
| + if (wifi_setApDTIMInterval(index, operationParam->dtimPeriod) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setApDTIMInterval return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.beaconInterval != operationParam->beaconInterval) { |
| + if (wifi_setRadioBeaconPeriod(index, operationParam->beaconInterval) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadioBeaconPeriod return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.operationalDataTransmitRates != operationParam->operationalDataTransmitRates) { |
| + BitMapToTransmitRates(operationParam->operationalDataTransmitRates, buf); |
| + if (wifi_setRadioBasicDataTransmitRates(index, buf) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadioBasicDataTransmitRates return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.fragmentationThreshold != operationParam->fragmentationThreshold) { |
| + if (wifi_setRadioFragmentationThreshold(index, operationParam->fragmentationThreshold) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadioFragmentationThreshold return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.guardInterval != operationParam->guardInterval) { |
| + if (wifi_setGuardInterval(index, operationParam->guardInterval) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setGuardInterval return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.transmitPower != operationParam->transmitPower) { |
| + if (wifi_setRadioTransmitPower(index, operationParam->transmitPower) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadioTransmitPower return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.rtsThreshold != operationParam->rtsThreshold) { |
| + if (wifi_setApRtsThreshold(index, operationParam->rtsThreshold) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setApRtsThreshold return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.obssCoex != operationParam->obssCoex) { |
| + if (wifi_setRadioObssCoexistenceEnable(index, operationParam->obssCoex) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadioObssCoexistenceEnable return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.stbcEnable != operationParam->stbcEnable) { |
| + if (wifi_setRadioSTBCEnable(index, operationParam->stbcEnable) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadioSTBCEnable return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + if (current_param.greenFieldEnable != operationParam->greenFieldEnable) { |
| + if (wifi_setRadio11nGreenfieldEnable(index, operationParam->greenFieldEnable) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_setRadio11nGreenfieldEnable return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + } |
| + WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__); |
| + |
| return RETURN_OK; |
| } |
| |
| INT wifi_getRadioOperatingParameters(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam) |
| { |
| - INT ret; |
| - char band[128]; |
| + char band[64] = {0}; |
| + char buf[256] = {0}; |
| + char config_file[64] = {0}; |
| + char cmd[128] = {0}; |
| + int ret; |
| + int mode = 0; |
| + wifi_ieee80211_Mode get_mode = 0; |
| ULONG channel; |
| + ULONG lval; |
| BOOL enabled; |
| - char buf[256]; |
| |
| WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__); |
| printf("Entering %s index = %d\n", __func__, (int)index); |
| |
| - ret = wifi_getRadioEnable(index, &enabled); |
| - if (ret != RETURN_OK) |
| + memset(operationParam, 0, sizeof(wifi_radio_operationParam_t)); |
| + snprintf(config_file, sizeof(config_file), "%s%d.conf", CONFIG_PREFIX, index); |
| + if (wifi_getRadioEnable(index, &enabled) != RETURN_OK) |
| { |
| - printf("%s: cannot get enabled state for radio index %d\n", __func__, |
| - index); |
| + fprintf(stderr, "%s: wifi_getRadioEnable return error.\n", __func__); |
| return RETURN_ERR; |
| } |
| operationParam->enable = enabled; |
| |
| memset(band, 0, sizeof(band)); |
| - ret = wifi_getRadioOperatingFrequencyBand(index, band); |
| - if (ret != RETURN_OK) |
| + if (wifi_getRadioOperatingFrequencyBand(index, band) != RETURN_OK) |
| { |
| - printf("%s: cannot get radio band for radio index %d\n", __func__, index); |
| + fprintf(stderr, "%s: wifi_getRadioOperatingFrequencyBand return error.\n", __func__); |
| return RETURN_ERR; |
| } |
| |
| if (!strcmp(band, "2.4GHz")) |
| - { |
| operationParam->band = WIFI_FREQUENCY_2_4_BAND; |
| - operationParam->variant = WIFI_80211_VARIANT_N; |
| - } |
| else if (!strcmp(band, "5GHz")) |
| - { |
| operationParam->band = WIFI_FREQUENCY_5_BAND; |
| - operationParam->variant = WIFI_80211_VARIANT_AC; |
| - } |
| + else if (!strcmp(band, "6GHz")) |
| + operationParam->band = WIFI_FREQUENCY_6_BAND; |
| else |
| { |
| - printf("%s: cannot decode band for radio index %d ('%s')\n", __func__, index, |
| + fprintf(stderr, "%s: cannot decode band for radio index %d ('%s')\n", __func__, index, |
| band); |
| } |
| |
| + wifi_hostapdRead(config_file, "channel", buf, sizeof(buf)); |
| + if (strcmp(buf, "0") == 0 || strcmp(buf, "acs_survey") == 0) { |
| + operationParam->channel = 0; |
| + operationParam->autoChannelEnabled = TRUE; |
| + } else { |
| + operationParam->channel = strtol(buf, NULL, 10); |
| + operationParam->autoChannelEnabled = FALSE; |
| + } |
| + |
| memset(buf, 0, sizeof(buf)); |
| - ret = wifi_getRadioOperatingChannelBandwidth(index, buf); // XXX: handle errors |
| - // XXX: only handle 20/40/80 modes for now |
| + if (wifi_getRadioOperatingChannelBandwidth(index, buf) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getRadioOperatingChannelBandwidth return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| if (!strcmp(buf, "20MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_20MHZ; |
| else if (!strcmp(buf, "40MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_40MHZ; |
| else if (!strcmp(buf, "80MHz")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_80MHZ; |
| + else if (!strcmp(buf, "160")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_160MHZ; |
| + else if (!strcmp(buf, "80+80")) operationParam->channelWidth = WIFI_CHANNELBANDWIDTH_80_80MHZ; |
| else |
| { |
| - printf("%s: Unknown HT mode: '%s'\n", __func__, buf); |
| - operationParam->channelWidth = 0; |
| + fprintf(stderr, "Unknown channel bandwidth: %s\n", buf); |
| + return false; |
| } |
| |
| - ret = wifi_getRadioChannel(index, &channel); |
| - if (ret != RETURN_OK) |
| - { |
| - printf("%s: Failed to get channel number for radio index %d\n", __func__, index); |
| - channel = 0; |
| + if (wifi_getRadioMode(index, buf, &mode) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getRadioMode return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + get_mode = (wifi_ieee80211_Mode)mode; |
| + if (get_mode & WIFI_MODE_A) |
| + operationParam->variant |= WIFI_80211_VARIANT_A; |
| + if (get_mode & WIFI_MODE_B) |
| + operationParam->variant |= WIFI_80211_VARIANT_B; |
| + if (get_mode & WIFI_MODE_G) |
| + operationParam->variant |= WIFI_80211_VARIANT_G; |
| + if (get_mode & WIFI_MODE_N) |
| + operationParam->variant |= WIFI_80211_VARIANT_N; |
| + if (get_mode & WIFI_MODE_AC) |
| + operationParam->variant |= WIFI_80211_VARIANT_AC; |
| + if (get_mode & WIFI_MODE_AX) |
| + operationParam->variant |= WIFI_80211_VARIANT_AX; |
| + if (wifi_getRadioDCSEnable(index, &operationParam->DCSEnabled) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getRadioDCSEnable return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + if (wifi_getApDTIMInterval(index, &operationParam->dtimPeriod) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getApDTIMInterval return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + if (wifi_getRadioBeaconPeriod(index, &operationParam->dtimPeriod) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getRadioBeaconPeriod return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + |
| + memset(buf, 0, sizeof(buf)); |
| + if (wifi_getRadioSupportedDataTransmitRates(index, buf) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getRadioSupportedDataTransmitRates return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + TransmitRatesToBitMap(buf, &operationParam->basicDataTransmitRates); |
| + |
| + memset(buf, 0, sizeof(buf)); |
| + if (wifi_getRadioBasicDataTransmitRates(index, buf) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getRadioBasicDataTransmitRates return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + TransmitRatesToBitMap(buf, &operationParam->operationalDataTransmitRates); |
| + |
| + memset(buf, 0, sizeof(buf)); |
| + wifi_hostapdRead(config_file, "fragm_threshold", buf, sizeof(buf)); |
| + operationParam->fragmentationThreshold = strtoul(buf, NULL, 10); |
| + |
| + if (wifi_getGuardInterval(index, &operationParam->guardInterval) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getGuardInterval return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + if (wifi_getRadioPercentageTransmitPower(index, &operationParam->transmitPower) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getRadioPercentageTransmitPower return error.\n", __func__); |
| + return RETURN_ERR; |
| } |
| - operationParam->channel = channel; |
| - operationParam->csa_beacon_count = 15; // XXX: hardcoded for now |
| |
| - operationParam->countryCode = wifi_countrycode_US; // XXX: hardcoded for now |
| + memset(buf, 0, sizeof(buf)); |
| + wifi_hostapdRead(config_file, "rts_threshold", buf, sizeof(buf)); |
| + if (strcmp(buf, "-1") == 0) { |
| + operationParam->rtsThreshold = (UINT)-1; // maxuimum unsigned integer value |
| + operationParam->ctsProtection = FALSE; |
| + } else { |
| + operationParam->rtsThreshold = strtoul(buf, NULL, 10); |
| + operationParam->ctsProtection = TRUE; |
| + } |
| + |
| + memset(buf, 0, sizeof(buf)); |
| + wifi_hostapdRead(config_file, "ht_coex", buf, sizeof(buf)); |
| + if (strcmp(buf, "0") == 0) |
| + operationParam->obssCoex = FALSE; |
| + else |
| + operationParam->obssCoex = TRUE; |
| + |
| + snprintf(cmd, sizeof(cmd), "cat %s | grep STBC", config_file); |
| + _syscmd(cmd, buf, sizeof(buf)); |
| + if (strlen(buf) != 0) |
| + operationParam->stbcEnable = TRUE; |
| + else |
| + operationParam->stbcEnable = FALSE; |
| + |
| + if (wifi_getRadio11nGreenfieldEnable(index, &operationParam->greenFieldEnable) != RETURN_OK) { |
| + fprintf(stderr, "%s: wifi_getRadio11nGreenfieldEnable return error.\n", __func__); |
| + return RETURN_ERR; |
| + } |
| + |
| + // Below value is hardcoded |
| + |
| + operationParam->numSecondaryChannels = 0; |
| + for (int i = 0; i < MAXNUMSECONDARYCHANNELS; i++) { |
| + operationParam->channelSecondary[i] = 0; |
| + } |
| + operationParam->csa_beacon_count = 15; |
| + operationParam->countryCode = wifi_countrycode_US; // need to conver string to corresponding enum |
| |
| WIFI_ENTRY_EXIT_DEBUG("Exiting %s:%d\n",__func__, __LINE__); |
| return RETURN_OK; |
| @@ -10784,6 +11098,7 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap) |
| wifi_channels_list_t *chlistp; |
| CHAR output_string[64]; |
| CHAR pchannels[128]; |
| + wifi_band band; |
| |
| if(rcap == NULL) |
| { |
| @@ -10791,11 +11106,14 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap) |
| } |
| |
| rcap->numSupportedFreqBand = 1; |
| - if (1 == radioIndex) |
| - rcap->band[0] = WIFI_FREQUENCY_5_BAND; |
| - else |
| - rcap->band[0] = WIFI_FREQUENCY_2_4_BAND; |
| + band = wifi_index_to_band(radioIndex); |
| |
| + if (band == band_2_4) |
| + rcap->band[0] = WIFI_FREQUENCY_2_4_BAND; |
| + else if (band == band_5) |
| + rcap->band[0] = WIFI_FREQUENCY_5_BAND; |
| + else if (band == band_6) |
| + rcap->band[0] = WIFI_FREQUENCY_6_BAND; |
| |
| chlistp = &(rcap->channel_list[0]); |
| memset(pchannels, 0, sizeof(pchannels)); |
| @@ -10854,7 +11172,7 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap) |
| WIFI_CHANNELBANDWIDTH_40MHZ); |
| |
| } |
| - else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND )) { |
| + else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND ) || rcap->band[i] & (WIFI_FREQUENCY_6_BAND)) { |
| rcap->channelWidth[i] |= (WIFI_CHANNELBANDWIDTH_20MHZ | |
| WIFI_CHANNELBANDWIDTH_40MHZ | |
| WIFI_CHANNELBANDWIDTH_80MHZ | WIFI_CHANNELBANDWIDTH_160MHZ); |
| @@ -10864,10 +11182,13 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap) |
| /* mode - all supported variants */ |
| // rcap->mode[i] = WIFI_80211_VARIANT_H; |
| if (rcap->band[i] & WIFI_FREQUENCY_2_4_BAND ) { |
| - rcap->mode[i] = (WIFI_80211_VARIANT_N); |
| + rcap->mode[i] = ( WIFI_80211_VARIANT_B | WIFI_80211_VARIANT_G | WIFI_80211_VARIANT_N | WIFI_80211_VARIANT_AX ); |
| } |
| else if (rcap->band[i] & WIFI_FREQUENCY_5_BAND ) { |
| - rcap->mode[i] = ( WIFI_80211_VARIANT_AC ); |
| + rcap->mode[i] = ( WIFI_80211_VARIANT_A | WIFI_80211_VARIANT_N | WIFI_80211_VARIANT_AC | WIFI_80211_VARIANT_AX ); |
| + } |
| + else if (rcap->band[i] & WIFI_FREQUENCY_6_BAND) { |
| + rcap->mode[i] = ( WIFI_80211_VARIANT_AX ); |
| } |
| rcap->maxBitRate[i] = ( rcap->band[i] & WIFI_FREQUENCY_2_4_BAND ) ? 300 : |
| ((rcap->band[i] & WIFI_FREQUENCY_5_BAND) ? 1734 : 0); |
| @@ -10878,7 +11199,7 @@ static int getRadioCapabilities(int radioIndex, wifi_radio_capabilities_t *rcap) |
| rcap->supportedBitRate[i] |= (WIFI_BITRATE_6MBPS | WIFI_BITRATE_9MBPS | |
| WIFI_BITRATE_11MBPS | WIFI_BITRATE_12MBPS); |
| } |
| - else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND )) { |
| + else if (rcap->band[i] & (WIFI_FREQUENCY_5_BAND ) | rcap->band[i] & (WIFI_FREQUENCY_6_BAND )) { |
| rcap->supportedBitRate[i] |= (WIFI_BITRATE_6MBPS | WIFI_BITRATE_9MBPS | |
| WIFI_BITRATE_12MBPS | WIFI_BITRATE_18MBPS | WIFI_BITRATE_24MBPS | |
| WIFI_BITRATE_36MBPS | WIFI_BITRATE_48MBPS | WIFI_BITRATE_54MBPS); |
| -- |
| 2.18.0 |
| |