kopia lustrzana https://github.com/micropython/micropython
esp32/network_lan: Fix setting MAC address of ethernet devices.
`esp_eth_ioctl(ETH_CMD_S_MAC_ADDR)` sets the MAC address of the hardware device, but we also need to notify the upper layers of the change so that e.g. DHCP work properly.pull/10420/head
rodzic
e982c1d8de
commit
c7301b8d03
|
@ -374,7 +374,12 @@ STATIC mp_obj_t lan_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
|
|||
if (bufinfo.len != 6) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("invalid buffer length"));
|
||||
}
|
||||
esp_eth_ioctl(self->eth_handle, ETH_CMD_S_MAC_ADDR, bufinfo.buf);
|
||||
if (
|
||||
(esp_eth_ioctl(self->eth_handle, ETH_CMD_S_MAC_ADDR, bufinfo.buf) != ESP_OK) ||
|
||||
(esp_netif_set_mac(self->eth_netif, bufinfo.buf) != ESP_OK)
|
||||
) {
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("failed setting MAC address"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
Ładowanie…
Reference in New Issue