From 90824699389dec6d3ee25b947fd317454fb22897 Mon Sep 17 00:00:00 2001 From: CYFS <2805686936@qq.com> Date: Thu, 6 Nov 2025 17:20:23 +0800 Subject: [PATCH] [serialv2]:Fixed the issue where the serialv2 terminal did not have the enable stream mode --- components/drivers/serial/dev_serial_v2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/drivers/serial/dev_serial_v2.c b/components/drivers/serial/dev_serial_v2.c index 2613cf5f2b0..13007cbe5e9 100644 --- a/components/drivers/serial/dev_serial_v2.c +++ b/components/drivers/serial/dev_serial_v2.c @@ -441,7 +441,7 @@ rt_ssize_t _serial_poll_tx(struct rt_device *dev, while (size) { - if (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM) + if (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM || (dev == rt_console_get_device())) { /* If open_flag satisfies RT_DEVICE_FLAG_STREAM and the received character is '\n', * inserts '\r' character before '\n' character for the effect of carriage return newline */ @@ -579,7 +579,7 @@ static rt_ssize_t _serial_fifo_tx_blocking_nbuf(struct rt_device *dev, tx_fifo = (struct rt_serial_tx_fifo *)serial->serial_tx; RT_ASSERT(tx_fifo != RT_NULL); - if (rt_thread_self() == RT_NULL || (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM)) + if (rt_thread_self() == RT_NULL || (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM) || (dev == rt_console_get_device())) { /* using poll tx when the scheduler not startup or in stream mode */ return _serial_poll_tx(dev, pos, buffer, size); @@ -651,7 +651,7 @@ static rt_ssize_t _serial_fifo_tx_blocking_buf(struct rt_device *dev, tx_fifo = (struct rt_serial_tx_fifo *)serial->serial_tx; RT_ASSERT(tx_fifo != RT_NULL); - if (rt_thread_self() == RT_NULL || (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM)) + if (rt_thread_self() == RT_NULL || (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM) || (dev == rt_console_get_device())) { /* using poll tx when the scheduler not startup or in stream mode */ return _serial_poll_tx(dev, pos, buffer, size);