From 5894e049bc0628367b32520ee1b0228ba1908dd7 Mon Sep 17 00:00:00 2001 From: zhangyanjiao Date: Wed, 25 Dec 2019 11:42:40 +0800 Subject: [PATCH] esp_wifi: fix some WiFi issues Fix following WiFi issues: 1. Fix WiFi buffer reload issue 2. Fix AMSDU decrypt issue 3. Fix some WiFi timer issues 4. Fix the crash caused by too big of association request RSN information 5. Fix the crash caused by block scan 6. Fix the bug for getting channel and bandwidth 7. Fix some Sniffer bugs 8. Fix some ESP-NOW issues 1> fix the bug when modifying the channel info of peer node 2> fix the crash when modifying peer node between unencrypted and encrypted 3> fix the bug for fetch peer 4> modify the esp_wifi_set_channel() function 5> fix the bug that the channel parameter doesn't work when adding peer node Closes https://github.com/espressif/esp-idf/issues/2833 Closes https://github.com/espressif/esp-idf/issues/4311 --- .../esp_wifi/include/esp_private/wifi.h | 37 +++++++++++++++++++ components/esp_wifi/include/esp_wifi.h | 6 ++- components/esp_wifi/lib_esp32 | 2 +- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/components/esp_wifi/include/esp_private/wifi.h b/components/esp_wifi/include/esp_private/wifi.h index 5115169ab..4e995b679 100644 --- a/components/esp_wifi/include/esp_private/wifi.h +++ b/components/esp_wifi/include/esp_private/wifi.h @@ -377,6 +377,43 @@ esp_err_t esp_wifi_internal_get_log(wifi_log_level_t *log_level, uint32_t *log_m */ esp_err_t esp_wifi_internal_ioctl(int cmd, wifi_ioctl_config_t *cfg); +/** + * @brief Get the user-configured channel info + * + * @param ifx : WiFi interface + * @param primary : store the configured primary channel + * @param second : store the configured second channel + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_wifi_internal_get_config_channel(wifi_interface_t ifx, uint8_t *primary, uint8_t *second); + +/** + * @brief Get the negotiated channel info after WiFi connection established + * + * @param ifx : WiFi interface + * @param aid : the connection number when a STA connects to the softAP + * @param primary : store the negotiated primary channel + * @param second : store the negotiated second channel + * @attention the aid param is only works when the ESP32 in softAP/softAP+STA mode + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_wifi_internal_get_negotiated_channel(wifi_interface_t ifx, uint8_t aid, uint8_t *primary, uint8_t *second); + +/** + * @brief Get the negotiated bandwidth info after WiFi connection established + * + * @param ifx : WiFi interface + * @param bw : store the negotiated bandwidth + * + * @return + * - ESP_OK: succeed + */ +esp_err_t esp_wifi_internal_get_negotiated_bandwidth(wifi_interface_t ifx, uint8_t aid, uint8_t *bw); + #ifdef __cplusplus } #endif diff --git a/components/esp_wifi/include/esp_wifi.h b/components/esp_wifi/include/esp_wifi.h index 3cd02b58b..be481ee27 100644 --- a/components/esp_wifi/include/esp_wifi.h +++ b/components/esp_wifi/include/esp_wifi.h @@ -542,8 +542,10 @@ esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); /** * @brief Set primary/secondary channel of ESP32 * - * @attention 1. This is a special API for sniffer - * @attention 2. This API should be called after esp_wifi_start() and esp_wifi_set_promiscuous() + * @attention 1. This API should be called after esp_wifi_start() + * @attention 2. When ESP32 is in STA mode, this API should not be called when STA is scanning or connecting to an external AP + * @attention 3. When ESP32 is in softAP mode, this API should not be called when softAP has connected to external STAs + * @attention 4. When ESP32 is in STA+softAP mode, this API should not be called when in the scenarios described above * * @param primary for HT20, primary is the channel number, for HT40, primary is the primary channel * @param second for HT20, second is ignored, for HT40, second is the second channel diff --git a/components/esp_wifi/lib_esp32 b/components/esp_wifi/lib_esp32 index fc48978e6..6de7aa2cd 160000 --- a/components/esp_wifi/lib_esp32 +++ b/components/esp_wifi/lib_esp32 @@ -1 +1 @@ -Subproject commit fc48978e6237b0f116c8cef2a685d578b922ca65 +Subproject commit 6de7aa2cd72eb9a423378cf5e4f7e80df091fbca