Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ESP32] Fix issue with ethernet commissioning #27808

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/platform/ESP32/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
#define CHIP_DEVICE_CONFIG_ENABLE_WIFI CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP | CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
#endif // CONFIG_IDF_TARGET_ESP32H2

#define CHIP_DEVICE_CONFIG_ENABLE_SED CONFIG_WIFI_POWER_SAVE_MIN || CONFIG_WIFI_POWER_SAVE_MAX
#define CHIP_DEVICE_CONFIG_ENABLE_SED \
!CONFIG_ENABLE_ETHERNET_TELEMETRY && (CONFIG_WIFI_POWER_SAVE_MIN || CONFIG_WIFI_POWER_SAVE_MAX)

#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE CONFIG_ENABLE_CHIPOBLE
#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY CONFIG_ENABLE_EXTENDED_DISCOVERY
Expand Down
17 changes: 17 additions & 0 deletions src/platform/ESP32/NetworkCommissioningDriver_Ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ namespace chip {
namespace DeviceLayer {
namespace NetworkCommissioning {

static void on_eth_event(void * esp_netif, esp_event_base_t event_base, int32_t event_id, void * event_data)
{
switch (event_id)
{
case ETHERNET_EVENT_CONNECTED: {
esp_netif_t * eth_netif = (esp_netif_t *) esp_netif;
ChipLogProgress(DeviceLayer, "Ethernet Connected");
ESP_ERROR_CHECK(esp_netif_create_ip6_linklocal(eth_netif));
}
break;
default:
break;
}
}

CHIP_ERROR ESPEthernetDriver::Init(NetworkStatusChangeCallback * networkStatusChangeCallback)
{
/* Currently default ethernet board supported is IP101, if you want to use other types of
Expand All @@ -50,6 +65,8 @@ CHIP_ERROR ESPEthernetDriver::Init(NetworkStatusChangeCallback * networkStatusCh
/* attach Ethernet driver to TCP/IP stack */
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)));

ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ETHERNET_EVENT_CONNECTED, &on_eth_event, eth_netif));

ESP_ERROR_CHECK(esp_eth_start(eth_handle));

return CHIP_NO_ERROR;
Expand Down