Skip to content

Commit 3cea9be

Browse files
committed
Merge branch 'fix/fix_ot_wifi_cmd' into 'main'
fix(ext_cmd): fix the ot wifi extension commands to resolve a deadlock issue Closes TZ-265 See merge request espressif/esp-thread-br!169
2 parents ecbd69d + 54e6efe commit 3cea9be

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ variables:
66
CI_DOCKER_REGISTRY: "ciregistry.espressif.cn:8443"
77
ESP_THREAD_BR_PATH: "$CI_PROJECT_DIR"
88
CI_TOOLS_PATH: "$CI_PROJECT_DIR/tools/ci"
9-
ESP_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-env-v5.5:2"
9+
ESP_ENV_IMAGE: "$CI_DOCKER_REGISTRY/esp-env-v6.0:1"
1010
ESP_IDF_HTTP: "https://gitlab-ci-token:${CI_JOB_TOKEN}@${ESP_GITLAB}/espressif/esp-idf.git"
1111

1212
pre_commit:

components/esp_ot_cli_extension/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.3.1"
1+
version: "1.3.2"
22
description: Espressif OpenThread CLI Extension
33
url: https://github.com/espressif/esp-thread-br/tree/main/components/esp_ot_cli_extension
44
dependencies:

components/esp_ot_cli_extension/src/esp_ot_wifi_cmd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ static esp_err_t wifi_join(const char *ssid, const char *password)
144144
return ESP_ERR_INVALID_ARG;
145145
}
146146

147+
esp_openthread_task_switching_lock_release();
147148
esp_err_t err = example_wifi_sta_do_connect(wifi_config, true);
149+
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
148150
return err;
149151
}
150152

@@ -177,7 +179,9 @@ void esp_ot_wifi_border_router_init_flag_set(bool initialized)
177179
esp_err_t esp_ot_wifi_connect(const char *ssid, const char *password)
178180
{
179181
if (!s_wifi_initialized) {
182+
esp_openthread_task_switching_lock_release();
180183
example_wifi_start();
184+
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
181185
#if CONFIG_ESP_COEX_SW_COEXIST_ENABLE && CONFIG_OPENTHREAD_RADIO_NATIVE
182186
ESP_ERROR_CHECK(esp_coex_wifi_i154_enable());
183187
#endif
@@ -220,7 +224,9 @@ esp_err_t esp_ot_wifi_disconnect(void)
220224
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_CONNECTED, &handler_on_wifi_connect));
221225
s_wifi_handler_registered = false;
222226
s_wifi_state = OT_WIFI_DISCONNECTED;
227+
esp_openthread_task_switching_lock_release();
223228
esp_err_t err = example_wifi_sta_do_disconnect();
229+
esp_openthread_task_switching_lock_acquire(portMAX_DELAY);
224230
return err;
225231
}
226232

@@ -294,12 +300,10 @@ otError esp_ot_process_wifi_cmd(void *aContext, uint8_t aArgsLength, char *aArgs
294300
}
295301
if (esp_ot_wifi_connect(ssid, psk) == ESP_OK) {
296302
if (!s_border_router_initialized) {
297-
esp_openthread_lock_acquire(portMAX_DELAY);
298303
esp_openthread_set_backbone_netif(get_example_netif());
299304
if (esp_openthread_border_router_init() != ESP_OK) {
300305
ESP_LOGE(OT_EXT_CLI_TAG, "Fail to initialize border router");
301306
}
302-
esp_openthread_lock_release();
303307
s_border_router_initialized = true;
304308
}
305309
otCliOutputFormat("wifi sta is connected successfully\n");

0 commit comments

Comments
 (0)