From 66f7731acc5a100eaa08d1bfed447ee8debf9541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E6=9F=B3=E6=9E=97?= Date: Fri, 30 Jun 2023 02:22:39 +0000 Subject: [PATCH] =?UTF-8?q?update=20components/drivers/serial/serial.c.=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=89=E6=97=B6=20serial->ops->putc(serial?= =?UTF-8?q?,=20*(char*)data)=20=E5=A4=B1=E8=B4=A5=E5=90=8E=EF=BC=8Cserial-?= =?UTF-8?q?>ops->putc(serial,=20'\r')=20=E9=87=8D=E5=A4=8D=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E7=9A=84=20BUG=20=EF=BC=88=E8=A1=A8=E7=8E=B0=E4=B8=BA?= =?UTF-8?q?=E4=B8=B2=E5=8F=A3=E6=9C=89=E6=97=B6=E5=A4=9A=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E4=BA=86=E2=80=98\r=E2=80=99=EF=BC=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 蔡柳林 --- components/drivers/serial/serial.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index fe5ea0f294..21dbc1ff8e 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -352,17 +352,15 @@ rt_inline int _serial_int_tx(struct rt_serial_device *serial, const rt_uint8_t * */ if (*data == '\n' && (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM)) { - if (serial->ops->putc(serial, '\r') == -1) + while (serial->ops->putc(serial, '\r') == -1) { rt_completion_wait(&(tx->completion), RT_WAITING_FOREVER); - continue; } } - if (serial->ops->putc(serial, *(char*)data) == -1) + while (serial->ops->putc(serial, *(char*)data) == -1) { rt_completion_wait(&(tx->completion), RT_WAITING_FOREVER); - continue; } data ++; length --; -- Gitee