diff options
| author | CYFS <[email protected]> | 2025-11-06 17:20:23 +0800 |
|---|---|---|
| committer | R b b666 <[email protected]> | 2025-11-07 09:52:55 +0800 |
| commit | 934c8195f4f293acded38d3e5b648d65b143afc0 (patch) | |
| tree | 363f8a16f294d649d7efbe83ab973a45b4609e0f /components | |
| parent | 97f316f5d0bda09d7b612997e26614bdb7417be3 (diff) | |
[serialv2]:Fixed the issue where the serialv2 terminal did not have the enable stream mode
Diffstat (limited to 'components')
| -rw-r--r-- | components/drivers/serial/dev_serial_v2.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/components/drivers/serial/dev_serial_v2.c b/components/drivers/serial/dev_serial_v2.c index 2613cf5f2b..13007cbe5e 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); |
