diff options
author | Oxore <oxore@protonmail.com> | 2023-03-09 03:10:31 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2023-03-09 03:10:31 +0300 |
commit | 4c2caed73357c2173649d5a105cad5277eaa85f7 (patch) | |
tree | 74ce01d223c592d2fbadfc295761be2d74d5dab5 /app/platform/stm32f0-gcc/retarget.cpp | |
parent | 7a0b96bf5c46521d6d8d2b527eb7099420a97aad (diff) |
Fix UART buffering, now it works
Diffstat (limited to 'app/platform/stm32f0-gcc/retarget.cpp')
-rw-r--r-- | app/platform/stm32f0-gcc/retarget.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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<UART*>(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<UART*>(file->extra), buf, nbytes); |