From 58f2dd5a6621b280cb9be07028e82f1010408dd9 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 9 Dec 2024 10:51:19 +0100 Subject: [PATCH] fix(protocol_examples_common): don't override MAC address for openeth The intention of the code block was to set MAC address for SPI Ethernet modules, however !CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET also affected the case of CONFIG_EXAMPLE_USE_OPENETH. This commit corrects the code to match the original intention. Related to https://github.com/espressif/qemu/issues/107 --- .../protocol_examples_common/eth_connect.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/common_components/protocol_examples_common/eth_connect.c b/examples/common_components/protocol_examples_common/eth_connect.c index 86e856527c..0cd105621d 100644 --- a/examples/common_components/protocol_examples_common/eth_connect.c +++ b/examples/common_components/protocol_examples_common/eth_connect.c @@ -154,7 +154,8 @@ static esp_netif_t *eth_start(void) // Install Ethernet driver esp_eth_config_t config = ETH_DEFAULT_CONFIG(s_mac, s_phy); ESP_ERROR_CHECK(esp_eth_driver_install(&config, &s_eth_handle)); -#if !CONFIG_EXAMPLE_USE_INTERNAL_ETHERNET + +#if CONFIG_EXAMPLE_USE_SPI_ETHERNET /* The SPI Ethernet module might doesn't have a burned factory MAC address, we cat to set it manually. We set the ESP_MAC_ETH mac address as the default, if you want to use ESP_MAC_EFUSE_CUSTOM mac address, please enable the configuration: `ESP_MAC_USE_CUSTOM_MAC_AS_BASE_MAC` @@ -162,7 +163,8 @@ static esp_netif_t *eth_start(void) uint8_t eth_mac[6] = {0}; ESP_ERROR_CHECK(esp_read_mac(eth_mac, ESP_MAC_ETH)); ESP_ERROR_CHECK(esp_eth_ioctl(s_eth_handle, ETH_CMD_S_MAC_ADDR, eth_mac)); -#endif +#endif // CONFIG_EXAMPLE_USE_SPI_ETHERNET + // combine driver with netif s_eth_glue = esp_eth_new_netif_glue(s_eth_handle); esp_netif_attach(netif, s_eth_glue);