Add hostname setting

This commit is contained in:
Jeff Epler 2022-09-29 09:08:45 -05:00
parent c6d3163841
commit 71a00157ba
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
2 changed files with 5 additions and 1 deletions

View File

@ -81,7 +81,10 @@ mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) {
}
void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname) {
ro_attribute(MP_QSTR_hostname);
self->hostname = mp_obj_new_str(hostname, strlen(hostname));
hostname = mp_obj_str_get_str(self->hostname);
netif_set_hostname(NETIF_STA, hostname);
netif_set_hostname(NETIF_AP, hostname);
}
mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self) {

View File

@ -33,6 +33,7 @@
typedef struct {
mp_obj_base_t base;
mp_obj_t hostname;
wifi_scannednetworks_obj_t *current_scan;
} wifi_radio_obj_t;