mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(esp_wifi):Fix WDT when esp_supp_dpp_start_listen called multiple times
This commit is contained in:
parent
609d25482b
commit
6a92a3582e
@ -416,6 +416,9 @@ static const esp_err_msg_t esp_err_msg_table[] = {
|
||||
# endif
|
||||
# ifdef ESP_ERR_WIFI_DISCARD
|
||||
ERR_TBL_IT(ESP_ERR_WIFI_DISCARD), /* 12315 0x301b Discard frame */
|
||||
# endif
|
||||
# ifdef ESP_ERR_WIFI_ROC_IN_PROGRESS
|
||||
ERR_TBL_IT(ESP_ERR_WIFI_ROC_IN_PROGRESS), /* 12316 0x301c ROC op is in progress */
|
||||
# endif
|
||||
// components/wpa_supplicant/esp_supplicant/include/esp_wps.h
|
||||
# ifdef ESP_ERR_WIFI_REGISTRAR
|
||||
|
@ -88,6 +88,7 @@ extern "C" {
|
||||
#define ESP_ERR_WIFI_TWT_SETUP_TXFAIL (ESP_ERR_WIFI_BASE + 25) /*!< TWT setup frame tx failed */
|
||||
#define ESP_ERR_WIFI_TWT_SETUP_REJECT (ESP_ERR_WIFI_BASE + 26) /*!< The twt setup request was rejected by the AP */
|
||||
#define ESP_ERR_WIFI_DISCARD (ESP_ERR_WIFI_BASE + 27) /*!< Discard frame */
|
||||
#define ESP_ERR_WIFI_ROC_IN_PROGRESS (ESP_ERR_WIFI_BASE + 28) /*!< ROC op is in progress */
|
||||
|
||||
/**
|
||||
* @brief WiFi stack configuration parameters passed to esp_wifi_init call.
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 67d28b38dfc84442cafff0780965d93e10705764
|
||||
Subproject commit 05058c38e7712e74b6f0a9e599641c0f387dd942
|
@ -21,7 +21,7 @@ static void *s_dpp_task_hdl = NULL;
|
||||
static void *s_dpp_evt_queue = NULL;
|
||||
static void *s_dpp_api_lock = NULL;
|
||||
|
||||
static bool s_dpp_stop_listening;
|
||||
static bool s_dpp_listen_in_progress;
|
||||
static int s_dpp_auth_retries;
|
||||
static struct esp_dpp_context_t s_dpp_ctx;
|
||||
static wifi_action_rx_cb_t s_action_rx_cb = esp_supp_rx_action;
|
||||
@ -203,7 +203,7 @@ static int esp_dpp_handle_config_obj(struct dpp_authentication *auth,
|
||||
wpa_printf(MSG_INFO, DPP_EVENT_CONNECTOR "%s",
|
||||
conf->connector);
|
||||
}
|
||||
s_dpp_stop_listening = false;
|
||||
s_dpp_listen_in_progress = true;
|
||||
esp_wifi_action_tx_req(WIFI_OFFCHAN_TX_CANCEL, 0, 0, NULL);
|
||||
esp_dpp_call_cb(ESP_SUPP_DPP_CFG_RECVD, wifi_cfg);
|
||||
|
||||
@ -319,7 +319,7 @@ static void esp_dpp_rx_action(struct action_rx_param *rx_param)
|
||||
(size_t)(public_action->v.pa_vendor_spec.vendor_data -
|
||||
(u8 *)rx_param->action_frm);
|
||||
|
||||
if (!s_dpp_stop_listening) {
|
||||
if (s_dpp_listen_in_progress) {
|
||||
esp_supp_dpp_stop_listen();
|
||||
}
|
||||
|
||||
@ -380,14 +380,20 @@ static void esp_dpp_task(void *pvParameters )
|
||||
struct dpp_bootstrap_params_t *p = &s_dpp_ctx.bootstrap_params;
|
||||
static int counter;
|
||||
int channel;
|
||||
esp_err_t ret = 0;
|
||||
|
||||
if (p->num_chan <= 0) {
|
||||
wpa_printf(MSG_ERROR, "Listen channel not set");
|
||||
break;
|
||||
}
|
||||
channel = p->chan_list[counter++ % p->num_chan];
|
||||
esp_wifi_remain_on_channel(WIFI_IF_STA, WIFI_ROC_REQ, channel,
|
||||
ret = esp_wifi_remain_on_channel(WIFI_IF_STA, WIFI_ROC_REQ, channel,
|
||||
BOOTSTRAP_ROC_WAIT_TIME, s_action_rx_cb);
|
||||
if (ret != ESP_OK) {
|
||||
wpa_printf(MSG_ERROR, "Failed ROC. error : 0x%x", ret);
|
||||
break;
|
||||
}
|
||||
s_dpp_listen_in_progress = true;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -466,7 +472,7 @@ static void offchan_event_handler(void *arg, esp_event_base_t event_base,
|
||||
} else if (event_id == WIFI_EVENT_ROC_DONE) {
|
||||
wifi_event_roc_done_t *evt = (wifi_event_roc_done_t *)event_data;
|
||||
|
||||
if (!s_dpp_stop_listening && evt->context == (uint32_t)s_action_rx_cb) {
|
||||
if (s_dpp_listen_in_progress && evt->context == (uint32_t)s_action_rx_cb) {
|
||||
esp_dpp_post_evt(SIG_DPP_LISTEN_NEXT_CHANNEL, 0);
|
||||
}
|
||||
}
|
||||
@ -591,6 +597,11 @@ fail:
|
||||
|
||||
esp_err_t esp_supp_dpp_start_listen(void)
|
||||
{
|
||||
if (s_dpp_listen_in_progress) {
|
||||
wpa_printf(MSG_ERROR, "DPP: Failed to start listen as listen is already in progress.");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
if (!s_dpp_ctx.dpp_global || s_dpp_ctx.id < 1) {
|
||||
wpa_printf(MSG_ERROR, "DPP: failed to start listen as dpp not initialized or bootstrapped.");
|
||||
return ESP_FAIL;
|
||||
@ -601,13 +612,12 @@ esp_err_t esp_supp_dpp_start_listen(void)
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
s_dpp_stop_listening = false;
|
||||
return esp_dpp_post_evt(SIG_DPP_LISTEN_NEXT_CHANNEL, 0);
|
||||
}
|
||||
|
||||
void esp_supp_dpp_stop_listen(void)
|
||||
{
|
||||
s_dpp_stop_listening = true;
|
||||
s_dpp_listen_in_progress = false;
|
||||
esp_wifi_remain_on_channel(WIFI_IF_STA, WIFI_ROC_CANCEL, 0, 0, NULL);
|
||||
}
|
||||
|
||||
@ -642,7 +652,7 @@ esp_err_t esp_supp_dpp_init(esp_supp_dpp_event_cb_t cb)
|
||||
cfg.msg_ctx = &s_dpp_ctx;
|
||||
s_dpp_ctx.dpp_global = dpp_global_init(&cfg);
|
||||
|
||||
s_dpp_stop_listening = false;
|
||||
s_dpp_listen_in_progress = false;
|
||||
s_dpp_evt_queue = os_queue_create(3, sizeof(dpp_event_t));
|
||||
ret = os_task_create(esp_dpp_task, "dppT", DPP_TASK_STACK_SIZE, NULL, 2, &s_dpp_task_hdl);
|
||||
if (ret != TRUE) {
|
||||
|
Loading…
Reference in New Issue
Block a user