Skip to content

Commit 1456a7e

Browse files
authored
[ESP32] Fix issue with ethernet commissioning (#27808)
1 parent 9f664e1 commit 1456a7e

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/platform/ESP32/CHIPDevicePlatformConfig.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP | CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
7373
#endif // CONFIG_IDF_TARGET_ESP32H2
7474

75-
#define CHIP_DEVICE_CONFIG_ENABLE_SED CONFIG_WIFI_POWER_SAVE_MIN || CONFIG_WIFI_POWER_SAVE_MAX
75+
#define CHIP_DEVICE_CONFIG_ENABLE_SED \
76+
!CONFIG_ENABLE_ETHERNET_TELEMETRY && (CONFIG_WIFI_POWER_SAVE_MIN || CONFIG_WIFI_POWER_SAVE_MAX)
7677

7778
#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE CONFIG_ENABLE_CHIPOBLE
7879
#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY CONFIG_ENABLE_EXTENDED_DISCOVERY

src/platform/ESP32/NetworkCommissioningDriver_Ethernet.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ namespace chip {
2525
namespace DeviceLayer {
2626
namespace NetworkCommissioning {
2727

28+
static void on_eth_event(void * esp_netif, esp_event_base_t event_base, int32_t event_id, void * event_data)
29+
{
30+
switch (event_id)
31+
{
32+
case ETHERNET_EVENT_CONNECTED: {
33+
esp_netif_t * eth_netif = (esp_netif_t *) esp_netif;
34+
ChipLogProgress(DeviceLayer, "Ethernet Connected");
35+
ESP_ERROR_CHECK(esp_netif_create_ip6_linklocal(eth_netif));
36+
}
37+
break;
38+
default:
39+
break;
40+
}
41+
}
42+
2843
CHIP_ERROR ESPEthernetDriver::Init(NetworkStatusChangeCallback * networkStatusChangeCallback)
2944
{
3045
/* Currently default ethernet board supported is IP101, if you want to use other types of
@@ -50,6 +65,8 @@ CHIP_ERROR ESPEthernetDriver::Init(NetworkStatusChangeCallback * networkStatusCh
5065
/* attach Ethernet driver to TCP/IP stack */
5166
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)));
5267

68+
ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ETHERNET_EVENT_CONNECTED, &on_eth_event, eth_netif));
69+
5370
ESP_ERROR_CHECK(esp_eth_start(eth_handle));
5471

5572
return CHIP_NO_ERROR;

0 commit comments

Comments
 (0)