mirror of
https://github.com/espressif/esp-idf
synced 2025-03-31 03:41:07 -04:00
Merge branch 'bugfix/openthread_uart_vfs_register_v5_3' into 'release/v5.3'
fix(openthread): register uart vfs devices when they are not registered(v5.3) See merge request espressif/esp-idf!31795
This commit is contained in:
commit
c2d5712563
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -17,6 +17,7 @@
|
|||||||
#include "esp_openthread_common_macro.h"
|
#include "esp_openthread_common_macro.h"
|
||||||
#include "esp_openthread_platform.h"
|
#include "esp_openthread_platform.h"
|
||||||
#include "esp_openthread_types.h"
|
#include "esp_openthread_types.h"
|
||||||
|
#include "esp_vfs.h"
|
||||||
#include "esp_vfs_dev.h"
|
#include "esp_vfs_dev.h"
|
||||||
#include "common/logging.hpp"
|
#include "common/logging.hpp"
|
||||||
#include "driver/uart.h"
|
#include "driver/uart.h"
|
||||||
@ -62,6 +63,17 @@ otError otPlatUartSend(const uint8_t *buf, uint16_t buf_length)
|
|||||||
|
|
||||||
esp_err_t esp_openthread_uart_init_port(const esp_openthread_uart_config_t *config)
|
esp_err_t esp_openthread_uart_init_port(const esp_openthread_uart_config_t *config)
|
||||||
{
|
{
|
||||||
|
#ifndef CONFIG_ESP_CONSOLE_UART
|
||||||
|
// If UART console is used, UART vfs devices should be registered during startup.
|
||||||
|
// Otherwise we need to register them here.
|
||||||
|
DIR *uart_dir = opendir("/dev/uart");
|
||||||
|
if (!uart_dir) {
|
||||||
|
// If UART vfs devices are registered, we will failed to open the directory
|
||||||
|
uart_vfs_dev_register();
|
||||||
|
} else {
|
||||||
|
closedir(uart_dir);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
ESP_RETURN_ON_ERROR(uart_param_config(config->port, &config->uart_config), OT_PLAT_LOG_TAG,
|
ESP_RETURN_ON_ERROR(uart_param_config(config->port, &config->uart_config), OT_PLAT_LOG_TAG,
|
||||||
"uart_param_config failed");
|
"uart_param_config failed");
|
||||||
ESP_RETURN_ON_ERROR(
|
ESP_RETURN_ON_ERROR(
|
||||||
@ -91,7 +103,6 @@ esp_err_t esp_openthread_host_cli_usb_init(const esp_openthread_platform_config_
|
|||||||
|
|
||||||
ret = usb_serial_jtag_driver_install((usb_serial_jtag_driver_config_t *)&config->host_config.host_usb_config);
|
ret = usb_serial_jtag_driver_install((usb_serial_jtag_driver_config_t *)&config->host_config.host_usb_config);
|
||||||
usb_serial_jtag_vfs_use_driver();
|
usb_serial_jtag_vfs_use_driver();
|
||||||
uart_vfs_dev_register();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user