diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index 7981b0952e..d2f5b77347 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -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) { diff --git a/ports/raspberrypi/common-hal/wifi/Radio.h b/ports/raspberrypi/common-hal/wifi/Radio.h index e919c5d718..5e40e64ec6 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.h +++ b/ports/raspberrypi/common-hal/wifi/Radio.h @@ -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;