Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bae722f

Browse filesBrowse files
copercinime-no-dev
authored andcommitted
Makes ethernet get an IP when connected (#4234)
1 parent fa852c9 commit bae722f
Copy full SHA for bae722f

File tree

Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed

‎libraries/WiFi/src/ETH.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/ETH.cpp
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
116116
tcpipInit();
117117

118118
tcpip_adapter_set_default_eth_handlers();
119+
120+
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
121+
esp_netif_t *eth_netif = esp_netif_new(&cfg);
122+
123+
if(esp_eth_set_default_handlers(eth_netif) != ESP_OK){
124+
log_e("esp_eth_set_default_handlers failed");
125+
return false;
126+
}
127+
128+
119129
esp_eth_mac_t *eth_mac = NULL;
120130
#if CONFIG_ETH_SPI_ETHERNET_DM9051
121131
if(type == ETH_PHY_DM9051){
@@ -176,6 +186,12 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
176186
log_e("esp_eth_driver_install failed");
177187
return false;
178188
}
189+
190+
/* attach Ethernet driver to TCP/IP stack */
191+
if(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)) != ESP_OK){
192+
log_e("esp_netif_attach failed");
193+
return false;
194+
}
179195

180196
if(esp_eth_start(eth_handle) != ESP_OK){
181197
log_e("esp_eth_start failed");

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.