Skip to content

Commit 30f16e2

Browse files
committed
Merge branch 'fix/wps_failed_on_multiple_retries_v3.3.1' into 'draft/v3.3.1.0'
fix(ESPAT-2283): Fixed an issue where WPS would fail after multiple network configuration attempts (v3.3.1.0) See merge request application/esp-at!1775
2 parents 157d4b9 + b322ef3 commit 30f16e2

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed

module_config/module_esp32c2-2mb-g2/patch/patch_list.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@
77
[support_ext_partition.patch]
88
path = esp-idf
99
note = "[IDF-9560] Support to use partition table outside of the project directory"
10+
11+
[wps_failed_on_multiple_tries.patch]
12+
path = esp-idf
13+
note = "[ESPAT-2283] Fixed an issue where WPS would fail after multiple network configuration attempts"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c
2+
index fd019627ff..a279bbc677 100644
3+
--- a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c
4+
+++ b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c
5+
@@ -1,5 +1,5 @@
6+
/*
7+
- * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
8+
+ * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
9+
*
10+
* SPDX-License-Identifier: Apache-2.0
11+
*/
12+
@@ -870,9 +870,11 @@ int wps_finish(void)
13+
return ret;
14+
}
15+
16+
+/* This will get executed in the wifi task's context */
17+
static void wps_sm_notify_deauth(void)
18+
{
19+
- if (gWpsSm && gWpsSm->wps->state != WPS_FINISHED) {
20+
+ if (gWpsSm && gWpsSm->wps->state != WPS_FINISHED &&
21+
+ !gWpsSm->intermediate_disconnect) {
22+
wps_stop_process(WPS_FAIL_REASON_RECV_DEAUTH);
23+
}
24+
}
25+
@@ -1599,6 +1601,7 @@ wifi_station_wps_deinit(void)
26+
sm->wps = NULL;
27+
}
28+
if (s_wps_sm_cb) {
29+
+ s_wps_sm_cb->wps_sm_notify_deauth = NULL;
30+
os_free(s_wps_sm_cb);
31+
s_wps_sm_cb = NULL;
32+
}
33+
@@ -1649,7 +1652,9 @@ wifi_wps_scan_done(void *arg, STATUS status)
34+
sm->discover_ssid_cnt = 0;
35+
36+
if (wps_get_status() == WPS_STATUS_PENDING) {
37+
+ sm->intermediate_disconnect = true;
38+
esp_wifi_disconnect();
39+
+ sm->intermediate_disconnect = false;
40+
41+
os_memcpy(wifi_config.sta.bssid, sm->bssid, ETH_ALEN);
42+
os_memcpy(wifi_config.sta.ssid, (char *)sm->creds[0].ssid, sm->creds[0].ssid_len);
43+
diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h b/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h
44+
index 1b413a128b..52772729d0 100644
45+
--- a/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h
46+
+++ b/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h
47+
@@ -83,6 +83,7 @@ struct wps_sm {
48+
bool ignore_sel_reg;
49+
struct discard_ap_list_t dis_ap_list[WPS_MAX_DIS_AP_NUM];
50+
u8 discard_ap_cnt;
51+
+ bool intermediate_disconnect;
52+
};
53+
54+
#define API_MUTEX_TAKE() do {\

module_config/module_esp32c2-4mb-g2/patch/patch_list.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@
77
[support_ext_partition.patch]
88
path = esp-idf
99
note = "[IDF-9560] Support to use partition table outside of the project directory"
10+
11+
[wps_failed_on_multiple_tries.patch]
12+
path = esp-idf
13+
note = "[ESPAT-2283] Fixed an issue where WPS would fail after multiple network configuration attempts"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c
2+
index fd019627ff..a279bbc677 100644
3+
--- a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c
4+
+++ b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c
5+
@@ -1,5 +1,5 @@
6+
/*
7+
- * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
8+
+ * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
9+
*
10+
* SPDX-License-Identifier: Apache-2.0
11+
*/
12+
@@ -870,9 +870,11 @@ int wps_finish(void)
13+
return ret;
14+
}
15+
16+
+/* This will get executed in the wifi task's context */
17+
static void wps_sm_notify_deauth(void)
18+
{
19+
- if (gWpsSm && gWpsSm->wps->state != WPS_FINISHED) {
20+
+ if (gWpsSm && gWpsSm->wps->state != WPS_FINISHED &&
21+
+ !gWpsSm->intermediate_disconnect) {
22+
wps_stop_process(WPS_FAIL_REASON_RECV_DEAUTH);
23+
}
24+
}
25+
@@ -1599,6 +1601,7 @@ wifi_station_wps_deinit(void)
26+
sm->wps = NULL;
27+
}
28+
if (s_wps_sm_cb) {
29+
+ s_wps_sm_cb->wps_sm_notify_deauth = NULL;
30+
os_free(s_wps_sm_cb);
31+
s_wps_sm_cb = NULL;
32+
}
33+
@@ -1649,7 +1652,9 @@ wifi_wps_scan_done(void *arg, STATUS status)
34+
sm->discover_ssid_cnt = 0;
35+
36+
if (wps_get_status() == WPS_STATUS_PENDING) {
37+
+ sm->intermediate_disconnect = true;
38+
esp_wifi_disconnect();
39+
+ sm->intermediate_disconnect = false;
40+
41+
os_memcpy(wifi_config.sta.bssid, sm->bssid, ETH_ALEN);
42+
os_memcpy(wifi_config.sta.ssid, (char *)sm->creds[0].ssid, sm->creds[0].ssid_len);
43+
diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h b/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h
44+
index 1b413a128b..52772729d0 100644
45+
--- a/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h
46+
+++ b/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h
47+
@@ -83,6 +83,7 @@ struct wps_sm {
48+
bool ignore_sel_reg;
49+
struct discard_ap_list_t dis_ap_list[WPS_MAX_DIS_AP_NUM];
50+
u8 discard_ap_cnt;
51+
+ bool intermediate_disconnect;
52+
};
53+
54+
#define API_MUTEX_TAKE() do {\

0 commit comments

Comments
 (0)