summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-06-12 18:41:18 -0400
committerGitHub <noreply@github.com>2018-06-12 18:41:18 -0400
commit144c0597e9f1a6e246ddfa5994b780d191f3221f (patch)
tree70a56233bd907ddd54ef3cfe9a895c4b51aa9c7b
parentab0bc1c2f83edbce36693dc3e3c622ec7f37aa4e (diff)
parentee817a2fa841a3f56c41c85db45dcaa37c7416dc (diff)
Merge pull request #928 from tannewt/fix_uart_timeout
Correct UART reads to return error on timeout.
-rw-r--r--ports/atmel-samd/common-hal/busio/UART.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c
index a95ccf3ac..090232b41 100644
--- a/ports/atmel-samd/common-hal/busio/UART.c
+++ b/ports/atmel-samd/common-hal/busio/UART.c
@@ -269,6 +269,11 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
#endif
}
+ if (total_read == 0) {
+ *errcode = EAGAIN;
+ return MP_STREAM_ERROR;
+ }
+
return total_read;
}