From 1d7241acc15a06fbb47ced9450deb89766863f9a Mon Sep 17 00:00:00 2001 From: Kapil Gupta Date: Thu, 19 Sep 2024 21:23:19 +0530 Subject: [PATCH] fix(esp_wifi): Add changes to enable 5ghz scan --- .../esp_supplicant/src/esp_scan.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_scan.c b/components/wpa_supplicant/esp_supplicant/src/esp_scan.c index df04c6f1a6..ac4c995b66 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_scan.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_scan.c @@ -167,22 +167,31 @@ int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender, return 0; } + #ifdef CONFIG_WNM -void get_scan_channel_bitmap(struct wpa_supplicant *wpa_s, wifi_scan_config_t *params) +static void get_scan_channel_bitmap(struct wpa_supplicant *wpa_s, wifi_scan_config_t *params) { + const int MAX_2GHZ_CHANNEL = 14; + if (!wpa_s->wnm_num_neighbor_report) { wpa_printf(MSG_DEBUG, "No Neighbor Report to gather scan channel list"); return; } params->channel_bitmap.ghz_2_channels = 0; + params->channel_bitmap.ghz_5_channels = 0; for (int i = 0; i < wpa_s->wnm_num_neighbor_report; i++) { - struct neighbor_report *nei; - nei = &wpa_s->wnm_neighbor_report_elements[i]; - params->channel_bitmap.ghz_2_channels |= (1 << nei->channel_number); + struct neighbor_report *nei = &wpa_s->wnm_neighbor_report_elements[i]; + + if (nei->channel_number <= MAX_2GHZ_CHANNEL) { + params->channel_bitmap.ghz_2_channels |= CHANNEL_TO_BIT(nei->channel_number); + } else { + params->channel_bitmap.ghz_5_channels |= CHANNEL_TO_BIT(nei->channel_number); + } } } #endif /*CONFIG_WNM*/ + static int issue_scan(struct wpa_supplicant *wpa_s, struct wpa_driver_scan_params *scan_params) {