Browse Source

extmod/network_ninaw10: Raise an error if nina_ioctl fails.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
pull/12417/head
iabdalkader 1 year ago
committed by Damien George
parent
commit
7bbf7910fe
  1. 8
      extmod/network_ninaw10.c

8
extmod/network_ninaw10.c

@ -121,7 +121,7 @@ STATIC void network_ninaw10_poll_connect(mp_sched_node_t *node) {
reason == NINA_ESP_REASON_NOT_AUTHED ||
reason == NINA_ESP_REASON_4WAY_HANDSHAKE_TIMEOUT ||
reason >= NINA_ESP_REASON_BEACON_TIMEOUT) {
debug_printf(&mp_plat_print, "poll_connect() status: %d reason %d\n", status, reason);
debug_printf("poll_connect() status: %d reason %d\n", status, reason);
if (nina_connect(self->ssid, self->security, self->key, 0) != 0) {
mp_raise_msg_varg(&mp_type_OSError,
MP_ERROR_TEXT("could not connect to ssid=%s, sec=%d, key=%s\n"),
@ -428,7 +428,11 @@ STATIC mp_obj_t network_ninaw10_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_
nina_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_buffer_info_t buf;
mp_get_buffer_raise(buf_in, &buf, MP_BUFFER_READ | MP_BUFFER_WRITE);
nina_ioctl(mp_obj_get_int(cmd_in), buf.len, buf.buf, self->itf);
int ret = nina_ioctl(mp_obj_get_int(cmd_in), buf.len, buf.buf, self->itf);
if (ret != 0) {
mp_raise_msg_varg(&mp_type_OSError,
MP_ERROR_TEXT("ioctl %d failed %d"), mp_obj_get_int(cmd_in), ret);
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(network_ninaw10_ioctl_obj, network_ninaw10_ioctl);

Loading…
Cancel
Save