Skip to content

Commit 1d7241a

Browse files
committed
fix(esp_wifi): Add changes to enable 5ghz scan
1 parent 903c11f commit 1d7241a

File tree

1 file changed

+13
-4
lines changed
  • components/wpa_supplicant/esp_supplicant/src

1 file changed

+13
-4
lines changed

components/wpa_supplicant/esp_supplicant/src/esp_scan.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,31 @@ int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender,
167167

168168
return 0;
169169
}
170+
170171
#ifdef CONFIG_WNM
171-
void get_scan_channel_bitmap(struct wpa_supplicant *wpa_s, wifi_scan_config_t *params)
172+
static void get_scan_channel_bitmap(struct wpa_supplicant *wpa_s, wifi_scan_config_t *params)
172173
{
174+
const int MAX_2GHZ_CHANNEL = 14;
175+
173176
if (!wpa_s->wnm_num_neighbor_report) {
174177
wpa_printf(MSG_DEBUG, "No Neighbor Report to gather scan channel list");
175178
return;
176179
}
177180
params->channel_bitmap.ghz_2_channels = 0;
181+
params->channel_bitmap.ghz_5_channels = 0;
178182

179183
for (int i = 0; i < wpa_s->wnm_num_neighbor_report; i++) {
180-
struct neighbor_report *nei;
181-
nei = &wpa_s->wnm_neighbor_report_elements[i];
182-
params->channel_bitmap.ghz_2_channels |= (1 << nei->channel_number);
184+
struct neighbor_report *nei = &wpa_s->wnm_neighbor_report_elements[i];
185+
186+
if (nei->channel_number <= MAX_2GHZ_CHANNEL) {
187+
params->channel_bitmap.ghz_2_channels |= CHANNEL_TO_BIT(nei->channel_number);
188+
} else {
189+
params->channel_bitmap.ghz_5_channels |= CHANNEL_TO_BIT(nei->channel_number);
190+
}
183191
}
184192
}
185193
#endif /*CONFIG_WNM*/
194+
186195
static int issue_scan(struct wpa_supplicant *wpa_s,
187196
struct wpa_driver_scan_params *scan_params)
188197
{

0 commit comments

Comments
 (0)