Skip to content

Commit 9dfabcd

Browse files
iabdalkaderdpgeorge
authored andcommitted
extmod/network_cyw43: Add hostname config option.
1 parent b6c2196 commit 9dfabcd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

extmod/network_cyw43.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,11 @@ STATIC mp_obj_t network_cyw43_config(size_t n_args, const mp_obj_t *args, mp_map
381381
cyw43_ioctl(self->cyw, CYW43_IOCTL_GET_VAR, 13, buf, self->itf);
382382
return MP_OBJ_NEW_SMALL_INT(nw_get_le32(buf) / 4);
383383
}
384+
#if !MICROPY_PY_NETWORK_CYW43_USE_LIB_DRIVER
385+
case MP_QSTR_hostname: {
386+
return mp_obj_new_str(self->cyw->hostname, strlen(self->cyw->hostname));
387+
}
388+
#endif
384389
default:
385390
mp_raise_ValueError(MP_ERROR_TEXT("unknown config param"));
386391
}
@@ -453,6 +458,14 @@ STATIC mp_obj_t network_cyw43_config(size_t n_args, const mp_obj_t *args, mp_map
453458
cyw43_ioctl(self->cyw, CYW43_IOCTL_SET_VAR, 9 + 4, buf, self->itf);
454459
break;
455460
}
461+
#if !MICROPY_PY_NETWORK_CYW43_USE_LIB_DRIVER
462+
case MP_QSTR_hostname: {
463+
const char *hostname = mp_obj_str_get_str(e->value);
464+
strncpy(self->cyw->hostname, hostname, MICROPY_BOARD_HOSTNAME_LENGTH);
465+
self->cyw->hostname[MICROPY_BOARD_HOSTNAME_LENGTH - 1] = 0;
466+
break;
467+
}
468+
#endif
456469
default:
457470
mp_raise_ValueError(MP_ERROR_TEXT("unknown config param"));
458471
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy