diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2018-06-12 14:03:27 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2018-06-12 14:03:27 -0700 |
| commit | ee817a2fa841a3f56c41c85db45dcaa37c7416dc (patch) | |
| tree | 70a56233bd907ddd54ef3cfe9a895c4b51aa9c7b | |
| parent | ab0bc1c2f83edbce36693dc3e3c622ec7f37aa4e (diff) | |
Correct UART reads to return error on timeout.
This causes read to correctly return None instead of b''.
Fixes #874
| -rw-r--r-- | ports/atmel-samd/common-hal/busio/UART.c | 5 |
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; } |
