Merge branch 'bugfix/wps_fail_reason_code' into 'master'

esp_wifi: Add Failures Reason code in all WPS failure send event

Closes WIFI-2947

See merge request espressif/esp-idf!10924
This commit is contained in:
Jiang Jiang Jian 2020-10-26 11:24:14 +08:00
commit 65bee98861

View File

@ -971,7 +971,8 @@ int wps_finish(void)
wifi_config_t *config = (wifi_config_t *)os_zalloc(sizeof(wifi_config_t));
if (config == NULL) {
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_FAILED, 0, 0, portMAX_DELAY);
wifi_event_sta_wps_fail_reason_t reason_code = WPS_FAIL_REASON_NORMAL;
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_FAILED, &reason_code, sizeof(reason_code), portMAX_DELAY);
return ESP_FAIL;
}
@ -1241,12 +1242,13 @@ int wps_sm_rx_eapol_internal(u8 *src_addr, u8 *buf, u32 len)
}
out:
if (ret != 0 || res == WPS_FAILURE) {
wifi_event_sta_wps_fail_reason_t reason_code = WPS_FAIL_REASON_NORMAL;
wpa_printf(MSG_DEBUG, "wpa rx eapol internal: fail ret=%d", ret);
wps_set_status(WPS_STATUS_DISABLE);
esp_wifi_disarm_sta_connection_timer_internal();
ets_timer_disarm(&sm->wps_timeout_timer);
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_FAILED, 0, 0, portMAX_DELAY);
esp_event_send_internal(WIFI_EVENT, WIFI_EVENT_STA_WPS_ER_FAILED, &reason_code, sizeof(reason_code), portMAX_DELAY);
return ret;
}