diff --git a/cc3200/mods/modusocket.c b/cc3200/mods/modusocket.c index 35964fa053..56e0946a7f 100644 --- a/cc3200/mods/modusocket.c +++ b/cc3200/mods/modusocket.c @@ -276,7 +276,7 @@ STATIC int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp ret |= MP_STREAM_POLL_HUP; } } else { - *_errno = EINVAL; + *_errno = MP_EINVAL; ret = MP_STREAM_ERROR; } return ret; @@ -519,7 +519,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) { int _errno; mp_int_t ret = wlan_socket_recv(self, (byte*)vstr.buf, len, &_errno); if (ret < 0) { - if (_errno == EAGAIN && self->sock_base.has_timeout) { + if (_errno == MP_EAGAIN && self->sock_base.has_timeout) { mp_raise_msg(&mp_type_TimeoutError, "timed out"); } mp_raise_OSError(-_errno); @@ -565,7 +565,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) { int _errno; mp_int_t ret = wlan_socket_recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno); if (ret < 0) { - if (_errno == EAGAIN && self->sock_base.has_timeout) { + if (_errno == MP_EAGAIN && self->sock_base.has_timeout) { mp_raise_msg(&mp_type_TimeoutError, "timed out"); } mp_raise_OSError(-_errno); diff --git a/cc3200/mods/pybuart.c b/cc3200/mods/pybuart.c index dceb842d52..f28af9063a 100644 --- a/cc3200/mods/pybuart.c +++ b/cc3200/mods/pybuart.c @@ -596,8 +596,8 @@ 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)) { - // return EAGAIN error to indicate non-blocking (then read() method returns None) - *errcode = EAGAIN; + // return MP_EAGAIN error to indicate non-blocking (then read() method returns None) + *errcode = MP_EAGAIN; return MP_STREAM_ERROR; } @@ -639,7 +639,7 @@ STATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t a ret |= MP_STREAM_POLL_WR; } } else { - *errcode = EINVAL; + *errcode = MP_EINVAL; ret = MP_STREAM_ERROR; } return ret; diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h index 944a6c0716..91d14dd1e3 100644 --- a/cc3200/mpconfigport.h +++ b/cc3200/mpconfigport.h @@ -75,6 +75,7 @@ #define MICROPY_STREAMS_NON_BLOCK (1) #define MICROPY_MODULE_WEAK_LINKS (1) #define MICROPY_CAN_OVERRIDE_BUILTINS (1) +#define MICROPY_USE_INTERNAL_ERRNO (1) #define MICROPY_VFS (1) #define MICROPY_VFS_FAT (1) #define MICROPY_PY_ASYNC_AWAIT (0)