Correct UART reads to return error on timeout.

This causes read to correctly return None instead of b''.

Fixes #874
This commit is contained in:
Scott Shawcroft 2018-06-12 14:03:27 -07:00
parent ab0bc1c2f8
commit ee817a2fa8
1 changed files with 5 additions and 0 deletions

View File

@ -269,6 +269,11 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
#endif #endif
} }
if (total_read == 0) {
*errcode = EAGAIN;
return MP_STREAM_ERROR;
}
return total_read; return total_read;
} }