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:
parent
ab0bc1c2f8
commit
ee817a2fa8
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue