已开启
p2p Frequency bugfix #280
huangxianwei9527创建于 14 天前
p2p Frequency bugfix #280
已开启
huangxianwei9527创建于 14 天前
1 个文件变更+1-31
Msrc/driver_wifi_adapter.c+1-31
@@ -3355,18 +3355,6 @@ static int32_t FreqToChannel(int32_t freq)
3355 return WIFI_OPT_FAILED; // 无效频率3355 return WIFI_OPT_FAILED; // 无效频率
3356}3356}
3357 3357 
3358-// 从信道号获取频率
3359-static int32_t ChannelToFreq(int32_t channel)
3360-{
3361- for (int i = 0; freqToChannel[i].channel != 0; i++) {
3362- if (freqToChannel[i].channel == channel) {
3363- return freqToChannel[i].freq;
3364- }
3365- }
3366- 
3367- return WIFI_OPT_FAILED; // 无效信道
3368-}
3369- 
3370// 添加信道到列表3358// 添加信道到列表
3371static int AddChannelToList(int32_t *chanList, int *count, int32_t channel)3359static int AddChannelToList(int32_t *chanList, int *count, int32_t channel)
3372{3360{
@@ -3688,25 +3676,7 @@ int32_t SoftBusGetStationFrequency(void)
3688 if (ret == WIFI_SUCCESS && linkedInfo.freq >= FREQ_5G_MIN && linkedInfo.freq <= FREQ_5G_MAX) {3676 if (ret == WIFI_SUCCESS && linkedInfo.freq >= FREQ_5G_MIN && linkedInfo.freq <= FREQ_5G_MAX) {
3689 LOGD("get wifi linked info succ, linkedInfo.freq: %d", linkedInfo.freq);3677 LOGD("get wifi linked info succ, linkedInfo.freq: %d", linkedInfo.freq);
3690 return linkedInfo.freq;3678 return linkedInfo.freq;
3691- } else {
3692- LOGW("get wifi linked info fail, searching channel list:");
3693- int32_t chanList[WIFI_MAX_CHANNELS] = {0};
3694- int32_t channel_count = GetChannelListFor5G(chanList, WIFI_MAX_CHANNELS);
3695- LOGD("channel_count: %d", channel_count);
3696- if (channel_count == 0) {
3697- LOGE("Error: GetChannelListFor5G failed!");
3698- return WIFI_OPT_FAILED;
3699- }
3700- for (int i = 0; i < channel_count; i++) {
3701- if (chanList[i] == WIFI_5GHZ_CHANNEL_149) {
3702- LOGI("support 149 channel.");
3703- return WIFI_5GHZ_FREQ_149;
3704- }
3705- }
3706- LOGI("not supported 149 channel, chanList[0]: %d", chanList[0]);
3707- int32_t freq = ChannelToFreq(chanList[0]);
3708- LOGI("freq: %d", freq);
3709- return freq;
3710 }3679 }
3680+ return WIFI_OPT_FAILED;
3711}3681}
3712 3682