fix(esp_wifi): Disable WPS timers once WPS succeed

This commit is contained in:
Kapil Gupta 2024-09-02 12:38:57 +05:30 committed by BOT
parent 2a6be654cd
commit 3a35b26de1

View File

@ -72,6 +72,7 @@ void wifi_station_wps_msg_timeout(void *data, void *user_ctx);
void wifi_station_wps_eapol_start_handle(void *data, void *user_ctx);
void wifi_station_wps_success(void *data, void *user_ctx);
void wifi_station_wps_timeout(void *data, void *user_ctx);
int wps_delete_timer(void);
struct wps_sm *gWpsSm = NULL;
static wps_factory_information_t *s_factory_info = NULL;
@ -834,7 +835,8 @@ int wps_finish(void)
if (sm->wps->state == WPS_FINISHED) {
wpa_printf(MSG_DEBUG, "wps finished------>");
wps_set_status(WPS_STATUS_SUCCESS);
wps_stop_connection_timers(sm);
/* WPS finished, dequeue all timers */
wps_delete_timer();
if (sm->ap_cred_cnt == 1) {
wifi_config_t *config = os_zalloc(sizeof(wifi_config_t));
@ -844,6 +846,7 @@ int wps_finish(void)
}
esp_wifi_get_config(WIFI_IF_STA, config);
esp_wifi_disconnect();
os_memcpy(config->sta.ssid, sm->creds[0].ssid, sm->creds[0].ssid_len);
os_memcpy(config->sta.password, sm->creds[0].key, sm->creds[0].key_len);
os_memcpy(config->sta.bssid, sm->bssid, ETH_ALEN);
@ -857,6 +860,7 @@ int wps_finish(void)
config->sta.bssid_set = 0;
config->sta.sae_pwe_h2e = 0;
esp_wifi_set_config(WIFI_IF_STA, config);
esp_wifi_connect();
os_free(config);
}