Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions network_provisioning/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 1.2.1 (15-Dec-2025)

- Fix prov-ctrl reset handler to return success when device is already in provisioning mode
- If firmware has already called `network_prov_mgr_reset_wifi_sm_state_on_failure()` or
`network_prov_mgr_reset_thread_sm_state_on_failure()`, the device state is already reset
to provisioning mode. The prov-ctrl handler now returns success in this case instead of
an invalid state error, allowing phone apps to successfully reset even if firmware has
already performed the reset operation.

# 07-October-2025

- Use managed cJSON component for IDF v6.0 and above
Expand Down
2 changes: 1 addition & 1 deletion network_provisioning/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "1.2.0"
version: "1.2.1"
description: Network provisioning component for Wi-Fi or Thread devices
url: https://github.com/espressif/idf-extra-components/tree/master/network_provisioning
dependencies:
Expand Down
14 changes: 14 additions & 0 deletions network_provisioning/src/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -2350,6 +2350,13 @@ esp_err_t network_prov_mgr_reset_wifi_sm_state_on_failure(void)
ACQUIRE_LOCK(prov_ctx_lock);

esp_err_t err = ESP_OK;
/* If already in STARTED state, reset has already been performed (e.g., by firmware).
* Return success as the device is effectively already reset and in provisioning mode. */
if (prov_ctx->prov_state == NETWORK_PROV_STATE_STARTED) {
ESP_LOGD(TAG, "Reset already performed, device already in provisioning mode");
goto exit;
}

if (prov_ctx->prov_state != NETWORK_PROV_STATE_FAIL) {
ESP_LOGE(TAG, "Trying reset when not in failure state. Current state: %d", prov_ctx->prov_state);
err = ESP_ERR_INVALID_STATE;
Expand Down Expand Up @@ -2448,6 +2455,13 @@ esp_err_t network_prov_mgr_reset_thread_sm_state_on_failure(void)
otInstance *instance = esp_openthread_get_instance();

esp_openthread_lock_acquire(portMAX_DELAY);
/* If already in STARTED state, reset has already been performed (e.g., by firmware).
* Return success as the device is effectively already reset and in provisioning mode. */
if (prov_ctx->prov_state == NETWORK_PROV_STATE_STARTED) {
ESP_LOGD(TAG, "Reset already performed, device already in provisioning mode");
goto exit;
}

if (prov_ctx->prov_state != NETWORK_PROV_STATE_FAIL) {
ESP_LOGE(TAG, "Trying reset when not in failure state. Current state: %d", prov_ctx->prov_state);
err = ESP_ERR_INVALID_STATE;
Expand Down
Loading