From d4bce7f042c4a8e11bd7bdc4994518e7f24fbf59 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 15 Mar 2026 17:16:21 -1000 Subject: [PATCH] [ethernet] Guard per-chip PHY/MAC includes with IDF >= 6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On IDF 5.x these headers don't exist as standalone files — they are included internally via esp_eth.h. On IDF 6.0 they moved to registry components and need explicit includes. LAN867x is unchanged (external component since IDF 5.3). --- .../ethernet/ethernet_component_esp32.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/esphome/components/ethernet/ethernet_component_esp32.cpp b/esphome/components/ethernet/ethernet_component_esp32.cpp index 9afa46f310..fb69a901aa 100644 --- a/esphome/components/ethernet/ethernet_component_esp32.cpp +++ b/esphome/components/ethernet/ethernet_component_esp32.cpp @@ -10,6 +10,10 @@ #include #include "esp_event.h" +// IDF 6.0 moved per-chip PHY/MAC drivers to the Espressif Component Registry; +// they are no longer included via esp_eth.h and need explicit includes. +// On IDF 5.x these headers don't exist as standalone files. +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0) #ifdef USE_ETHERNET_LAN8720 #include "esp_eth_phy_lan87xx.h" #endif @@ -25,9 +29,6 @@ #ifdef USE_ETHERNET_KSZ8081 #include "esp_eth_phy_ksz80xx.h" #endif -#ifdef USE_ETHERNET_LAN8670 -#include "esp_eth_phy_lan867x.h" -#endif #ifdef USE_ETHERNET_W5500 #include "esp_eth_mac_w5500.h" #include "esp_eth_phy_w5500.h" @@ -36,6 +37,12 @@ #include "esp_eth_mac_dm9051.h" #include "esp_eth_phy_dm9051.h" #endif +#endif // ESP_IDF_VERSION >= 6.0.0 + +// LAN867x header exists on all IDF versions (external component since IDF 5.3) +#ifdef USE_ETHERNET_LAN8670 +#include "esp_eth_phy_lan867x.h" +#endif #ifdef USE_ETHERNET_SPI #include