Skip to content

Commit 934c819

Browse files
CYFS3Rbb666
authored andcommitted
[serialv2]:Fixed the issue where the serialv2 terminal did not have the enable stream mode
1 parent 97f316f commit 934c819

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/drivers/serial/dev_serial_v2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ rt_ssize_t _serial_poll_tx(struct rt_device *dev,
441441

442442
while (size)
443443
{
444-
if (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM)
444+
if (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM || (dev == rt_console_get_device()))
445445
{
446446
/* If open_flag satisfies RT_DEVICE_FLAG_STREAM and the received character is '\n',
447447
* 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,
579579
tx_fifo = (struct rt_serial_tx_fifo *)serial->serial_tx;
580580
RT_ASSERT(tx_fifo != RT_NULL);
581581

582-
if (rt_thread_self() == RT_NULL || (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM))
582+
if (rt_thread_self() == RT_NULL || (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM) || (dev == rt_console_get_device()))
583583
{
584584
/* using poll tx when the scheduler not startup or in stream mode */
585585
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,
651651
tx_fifo = (struct rt_serial_tx_fifo *)serial->serial_tx;
652652
RT_ASSERT(tx_fifo != RT_NULL);
653653

654-
if (rt_thread_self() == RT_NULL || (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM))
654+
if (rt_thread_self() == RT_NULL || (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM) || (dev == rt_console_get_device()))
655655
{
656656
/* using poll tx when the scheduler not startup or in stream mode */
657657
return _serial_poll_tx(dev, pos, buffer, size);

0 commit comments

Comments
 (0)