diff --git a/components/openthread/src/esp_openthread_cli.c b/components/openthread/src/esp_openthread_cli.c index 27c6b3cefc3..50f90d53c38 100644 --- a/components/openthread/src/esp_openthread_cli.c +++ b/components/openthread/src/esp_openthread_cli.c @@ -35,15 +35,17 @@ static bool append_escaped_ot_arg(char *buffer, size_t buffer_size, const char * ESP_RETURN_ON_FALSE(rem_size > 0, false, OT_PLAT_LOG_TAG, "CLI command buffer is full"); while (*arg) { - if ((*arg == ' ') || (*arg == '\t') || (*arg == '\r') || (*arg == '\n') || (*arg == '\\')) { - ESP_RETURN_ON_FALSE(rem_size > 1, false, OT_PLAT_LOG_TAG, "CLI command is too long"); + bool need_escape = (*arg == ' ') || (*arg == '\t') || (*arg == '\r') || (*arg == '\n') || (*arg == '\\'); + size_t need = need_escape ? 2 : 1; + + ESP_RETURN_ON_FALSE(rem_size >= need, false, OT_PLAT_LOG_TAG, "CLI command is too long"); + + if (need_escape) { buffer[len++] = '\\'; - rem_size--; } - ESP_RETURN_ON_FALSE(rem_size > 1, false, OT_PLAT_LOG_TAG, "CLI command is too long"); buffer[len++] = *arg++; - rem_size--; + rem_size -= need; } buffer[len] = '\0'; diff --git a/components/openthread/src/port/esp_openthread_radio_spinel.cpp b/components/openthread/src/port/esp_openthread_radio_spinel.cpp index b7892da9afa..5978d154210 100644 --- a/components/openthread/src/port/esp_openthread_radio_spinel.cpp +++ b/components/openthread/src/port/esp_openthread_radio_spinel.cpp @@ -53,7 +53,9 @@ static otRadioCaps s_radio_caps = (OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_RECEIVE_TIMING | OT_RADIO_CAPS_TRANSMIT_TIMING | OT_RADIO_CAPS_ACK_TIMEOUT | - OT_RADIO_CAPS_SLEEP_TO_TX); + OT_RADIO_CAPS_SLEEP_TO_TX | + OT_RADIO_CAPS_CSMA_BACKOFF | + OT_RADIO_CAPS_TRANSMIT_RETRIES); static const char *radiospinel_workflow = "radio_spinel"; static const esp_openthread_radio_config_t *s_esp_openthread_radio_config = NULL; diff --git a/components/openthread/src/spinel/esp_radio_spinel.cpp b/components/openthread/src/spinel/esp_radio_spinel.cpp index 3c35b0cbd8b..06ed3bc6e21 100644 --- a/components/openthread/src/spinel/esp_radio_spinel.cpp +++ b/components/openthread/src/spinel/esp_radio_spinel.cpp @@ -40,7 +40,9 @@ static otRadioCaps s_radio_caps = (OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_RECEIVE_TIMING | OT_RADIO_CAPS_TRANSMIT_TIMING | OT_RADIO_CAPS_ACK_TIMEOUT | - OT_RADIO_CAPS_SLEEP_TO_TX); + OT_RADIO_CAPS_SLEEP_TO_TX | + OT_RADIO_CAPS_CSMA_BACKOFF | + OT_RADIO_CAPS_TRANSMIT_RETRIES); static esp_radio_spinel_compatibility_error_callback s_radio_spinel_compatibility_error_callback = NULL; static esp_radio_spinel_coprocessor_reset_failure_callback s_radio_spinel_coprocessor_reset_failure_callback = NULL;