From 4c2caed73357c2173649d5a105cad5277eaa85f7 Mon Sep 17 00:00:00 2001 From: Oxore Date: Thu, 9 Mar 2023 03:10:31 +0300 Subject: Fix UART buffering, now it works --- app/platform/stm32f0-gcc/retarget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/platform/stm32f0-gcc/retarget.cpp') diff --git a/app/platform/stm32f0-gcc/retarget.cpp b/app/platform/stm32f0-gcc/retarget.cpp index a6706d3..85e12b4 100644 --- a/app/platform/stm32f0-gcc/retarget.cpp +++ b/app/platform/stm32f0-gcc/retarget.cpp @@ -92,6 +92,12 @@ extern "C" ssize_t read(int fd, void *buf, size_t nbytes) switch (file->type) { case FileType::kUART: ret = UARTRead(reinterpret_cast(file->extra), buf, nbytes); + // XXX if fcntl support for disabling O_NONBLOCK will ever be added, + // then it has to something with this block of code + if (ret == 0) { + errno = EWOULDBLOCK; + ret = -1; + } break; case FileType::kUARTDirect: ret = UARTReadDirect(reinterpret_cast(file->extra), buf, nbytes); -- cgit v1.2.3