summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/library/network.WLAN.rst2
-rw-r--r--ports/esp32/network_wlan.c2
-rw-r--r--ports/esp8266/modnetwork.c2
3 files changed, 5 insertions, 1 deletions
diff --git a/docs/library/network.WLAN.rst b/docs/library/network.WLAN.rst
index bc416d1c2..c67319470 100644
--- a/docs/library/network.WLAN.rst
+++ b/docs/library/network.WLAN.rst
@@ -130,7 +130,7 @@ Methods
hidden Whether SSID is hidden (boolean)
security Security protocol supported (enumeration, see module constants)
key Access key (string)
- dhcp_hostname The DHCP hostname to use
+ hostname The hostname that will be sent to DHCP (STA interfaces) and mDNS (if supported, both STA and AP)
reconnects Number of reconnect attempts to make (integer, 0=none, -1=unlimited)
txpower Maximum transmit power in dBm (integer or float)
============= ===========
diff --git a/ports/esp32/network_wlan.c b/ports/esp32/network_wlan.c
index 48b398c8f..9b2200e4f 100644
--- a/ports/esp32/network_wlan.c
+++ b/ports/esp32/network_wlan.c
@@ -452,6 +452,7 @@ STATIC mp_obj_t network_wlan_config(size_t n_args, const mp_obj_t *args, mp_map_
cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
break;
}
+ case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: {
const char *s = mp_obj_str_get_str(kwargs->table[i].value);
esp_exceptions(tcpip_adapter_set_hostname(self->if_id, s));
@@ -538,6 +539,7 @@ STATIC mp_obj_t network_wlan_config(size_t n_args, const mp_obj_t *args, mp_map_
req_if = WIFI_IF_AP;
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
break;
+ case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: {
const char *s;
esp_exceptions(tcpip_adapter_get_hostname(self->if_id, &s));
diff --git a/ports/esp8266/modnetwork.c b/ports/esp8266/modnetwork.c
index e32a0ff0c..dbc12f74d 100644
--- a/ports/esp8266/modnetwork.c
+++ b/ports/esp8266/modnetwork.c
@@ -397,6 +397,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
cfg.ap.channel = mp_obj_get_int(kwargs->table[i].value);
break;
}
+ case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: {
req_if = STATION_IF;
if (self->if_id == STATION_IF) {
@@ -461,6 +462,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
req_if = SOFTAP_IF;
val = MP_OBJ_NEW_SMALL_INT(cfg.ap.channel);
break;
+ case MP_QSTR_hostname:
case MP_QSTR_dhcp_hostname: {
req_if = STATION_IF;
char *s = wifi_station_get_hostname();