summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanicampora <daniel@wipy.io>2015-10-20 09:27:21 +0200
committerdanicampora <daniel@wipy.io>2015-10-21 15:30:56 +0200
commit7ff585333e97a355aef3ff1b4255b50b65d6d1dd (patch)
tree1c8555bcdd943f50e5eadbd81b4940cc1b2274b5
parent9a507c67ad301d3f610708e8c11d39c3a19b43d9 (diff)
cc3200: uart.read() returns EGAIN if no chars available.
-rw-r--r--cc3200/mods/pybuart.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cc3200/mods/pybuart.c b/cc3200/mods/pybuart.c
index 351bc6389..0c4170fcd 100644
--- a/cc3200/mods/pybuart.c
+++ b/cc3200/mods/pybuart.c
@@ -599,9 +599,9 @@ STATIC mp_uint_t pyb_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, i
// wait for first char to become available
if (!uart_rx_wait(self)) {
- // we can either return 0 to indicate EOF (then read() method returns b'')
- // or return EAGAIN error to indicate non-blocking (then read() method returns None)
- return 0;
+ // return EAGAIN error to indicate non-blocking (then read() method returns None)
+ *errcode = EAGAIN;
+ return MP_STREAM_ERROR;
}
// read the data