From 7ff585333e97a355aef3ff1b4255b50b65d6d1dd Mon Sep 17 00:00:00 2001 From: danicampora Date: Tue, 20 Oct 2015 09:27:21 +0200 Subject: [PATCH] cc3200: uart.read() returns EGAIN if no chars available. --- cc3200/mods/pybuart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cc3200/mods/pybuart.c b/cc3200/mods/pybuart.c index 351bc63899..0c4170fcd9 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