Merge branch 'bugfix/wifi_config_fixes' into 'master'

esp_wifi: Update some wifi config options

See merge request espressif/esp-idf!22397
This commit is contained in:
Jiang Jiang Jian
2023-02-26 14:57:25 +08:00
5 changed files with 32 additions and 7 deletions

View File

@@ -1322,6 +1322,29 @@ esp_err_t esp_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t ra
*/ */
esp_err_t esp_wifi_disable_pmf_config(wifi_interface_t ifx); esp_err_t esp_wifi_disable_pmf_config(wifi_interface_t ifx);
/**
* @brief Get the Association id assigned to STA by AP
*
* @param[out] aid store the aid
*
* @attention aid = 0 if station is not connected to AP.
*
* @return
* - ESP_OK: succeed
*/
esp_err_t esp_wifi_sta_get_aid(uint16_t *aid);
/**
* @brief Get the negotiated phymode after connection.
*
* @param[out] phymode store the negotiated phymode.
*
* @attention Operation phy mode, BIT[5]: indicate whether LR enabled, BIT[0-4]: wifi_phy_mode_t
*
* @return
* - ESP_OK: succeed
*/
esp_err_t esp_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -307,9 +307,7 @@ typedef struct {
uint32_t ft_enabled:1; /**< Whether FT is enabled for the connection */ uint32_t ft_enabled:1; /**< Whether FT is enabled for the connection */
uint32_t owe_enabled:1; /**< Whether OWE is enabled for the connection */ uint32_t owe_enabled:1; /**< Whether OWE is enabled for the connection */
uint32_t transition_disable:1; /**< Whether to enable transition disable feature */ uint32_t transition_disable:1; /**< Whether to enable transition disable feature */
uint32_t aid:12; /**< Authentication id assigned by the connected AP. aid = 0 if the STA is not connected. */ uint32_t reserved:26; /**< Reserved for future feature set */
uint32_t phymode:6; /**< Operation phy mode, BIT[5]: indicate whether LR enabled, BIT[0-4]: wifi_phy_mode_t. */
uint32_t reserved:8; /**< Reserved for future feature set */
wifi_sae_pwe_method_t sae_pwe_h2e; /**< Whether SAE hash to element is enabled */ wifi_sae_pwe_method_t sae_pwe_h2e; /**< Whether SAE hash to element is enabled */
wifi_sae_pk_mode_t sae_pk_mode; /**< SAE-PK mode */ wifi_sae_pk_mode_t sae_pk_mode; /**< SAE-PK mode */
uint8_t failure_retry_cnt; /**< Number of connection retries station will do before moving to next AP. scan_method should be set as WIFI_ALL_CHANNEL_SCAN to use this config. uint8_t failure_retry_cnt; /**< Number of connection retries station will do before moving to next AP. scan_method should be set as WIFI_ALL_CHANNEL_SCAN to use this config.

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -592,7 +592,9 @@ static int wifi_cmd_query(int argc, char **argv)
printf("\tbssid: "MACSTR, MAC2STR(cfg.sta.bssid)); printf("\tbssid: "MACSTR, MAC2STR(cfg.sta.bssid));
printf("\n"); printf("\n");
printf("\tchannel: %d\n", cfg.sta.channel); printf("\tchannel: %d\n", cfg.sta.channel);
printf("\taid: %d\n", cfg.sta.aid); uint16_t aid;
esp_wifi_sta_get_aid(&aid);
printf("\taid: %d\n", aid);
if (cfg.sta.pmf_cfg.capable) { if (cfg.sta.pmf_cfg.capable) {
if (cfg.sta.pmf_cfg.required) { if (cfg.sta.pmf_cfg.required) {
printf("\tpmf: required\n"); printf("\tpmf: required\n");

View File

@@ -89,9 +89,11 @@ static void got_ip_handler(void *arg, esp_event_base_t event_base,
/* setup a trigger-based announce individual TWT agreement. */ /* setup a trigger-based announce individual TWT agreement. */
esp_err_t err = ESP_OK; esp_err_t err = ESP_OK;
int flow_id = 0; int flow_id = 0;
wifi_phy_mode_t phymode;
wifi_config_t sta_cfg = { 0, }; wifi_config_t sta_cfg = { 0, };
esp_wifi_get_config(WIFI_IF_STA, &sta_cfg); esp_wifi_get_config(WIFI_IF_STA, &sta_cfg);
if (sta_cfg.sta.phymode == WIFI_PHY_MODE_HE20) { esp_wifi_sta_get_negotiated_phymode(&phymode);
if (phymode == WIFI_PHY_MODE_HE20) {
err = esp_wifi_sta_itwt_setup(TWT_REQUEST, trigger_enabled, flow_type_announced ? 0 : 1, err = esp_wifi_sta_itwt_setup(TWT_REQUEST, trigger_enabled, flow_type_announced ? 0 : 1,
CONFIG_EXAMPLE_ITWT_MIN_WAKE_DURA, CONFIG_EXAMPLE_ITWT_WAKE_INVL_EXPN, CONFIG_EXAMPLE_ITWT_MIN_WAKE_DURA, CONFIG_EXAMPLE_ITWT_WAKE_INVL_EXPN,
CONFIG_EXAMPLE_ITWT_WAKE_INVL_MANT, &flow_id); CONFIG_EXAMPLE_ITWT_WAKE_INVL_MANT, &flow_id);