esp32/network_lan: Register the hostname setting for Ethernet.
Fixes issue #12817. Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
@@ -44,6 +44,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "modnetwork.h"
|
#include "modnetwork.h"
|
||||||
|
#include "extmod/modnetwork.h"
|
||||||
|
|
||||||
typedef struct _lan_if_obj_t {
|
typedef struct _lan_if_obj_t {
|
||||||
base_if_obj_t base;
|
base_if_obj_t base;
|
||||||
@@ -302,6 +303,7 @@ STATIC mp_obj_t lan_active(size_t n_args, const mp_obj_t *args) {
|
|||||||
|
|
||||||
if (n_args > 1) {
|
if (n_args > 1) {
|
||||||
if (mp_obj_is_true(args[1])) {
|
if (mp_obj_is_true(args[1])) {
|
||||||
|
esp_netif_set_hostname(self->base.netif, mod_network_hostname_data);
|
||||||
self->base.active = (esp_eth_start(self->eth_handle) == ESP_OK);
|
self->base.active = (esp_eth_start(self->eth_handle) == ESP_OK);
|
||||||
if (!self->base.active) {
|
if (!self->base.active) {
|
||||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("ethernet enable failed"));
|
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("ethernet enable failed"));
|
||||||
|
|||||||
Reference in New Issue
Block a user