Skip to content

Commit

Permalink
Fix issue with ethernet commissioning (#27847)
Browse files Browse the repository at this point in the history
  • Loading branch information
PSONALl authored Jul 10, 2023
1 parent 657461d commit c8c0d7a
Showing 1 changed file with 17 additions and 0 deletions.
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

0 comments on commit c8c0d7a

Please sign in to comment.