Skip to content

Commit ee817a2

Browse files
committed
Correct UART reads to return error on timeout.
This causes read to correctly return None instead of b''. Fixes #874
1 parent ab0bc1c commit ee817a2

File tree

1 file changed

+5
-0
lines changed
  • ports/atmel-samd/common-hal/busio

1 file changed

+5
-0
lines changed

ports/atmel-samd/common-hal/busio/UART.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
269269
#endif
270270
}
271271

272+
if (total_read == 0) {
273+
*errcode = EAGAIN;
274+
return MP_STREAM_ERROR;
275+
}
276+
272277
return total_read;
273278
}
274279

0 commit comments

Comments
 (0)