[serialv2]:Fixed the issue where the serialv2 terminal did not have the enable stream mode

This commit is contained in:
CYFS
2025-11-07 09:52:55 +08:00
committed by R b b666
parent 97f316f5d0
commit 934c8195f4
+3 -3
View File
@@ -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);