Merge branch 'bugfix/lwip_sta_ap_netif_names' into 'master'

give the AP and STA netifs different names for ease of debugging lwip

Both AP and STA netifs used to be called "en". This changes the name to "st" for STA and "ap" for AP.

Ref https://github.com/espressif/esp-idf/pull/456.

See merge request !653
This commit is contained in:
Jiang Jiang Jian 2017-04-13 14:43:13 +08:00
commit 82b7ca92ad
3 changed files with 18 additions and 7 deletions

View file

@ -26,7 +26,8 @@
extern "C" {
#endif
err_t wlanif_init(struct netif *netif);
err_t wlanif_init_ap(struct netif *netif);
err_t wlanif_init_sta(struct netif *netif);
void wlanif_input(struct netif *netif, void *buffer, u16_t len, void* eb);

View file

@ -52,9 +52,6 @@
#include "tcpip_adapter.h"
/* Define those to better describe your network interface. */
#define IFNAME0 'e'
#define IFNAME1 'n'
/**
* In this function, the hardware should be initialized.
@ -216,8 +213,6 @@ wlanif_init(struct netif *netif)
*/
NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, 100);
netif->name[0] = IFNAME0;
netif->name[1] = IFNAME1;
/* We directly use etharp_output() here to save a function call.
* You can instead declare your own function an call etharp_output()
* from it if you have to do some checks before sending (e.g. if link
@ -233,3 +228,17 @@ wlanif_init(struct netif *netif)
return ERR_OK;
}
err_t wlanif_init_sta(struct netif *netif) {
netif->name[0] = 's';
netif->name[1] = 't';
return wlanif_init(netif);
}
err_t wlanif_init_ap(struct netif *netif) {
netif->name[0] = 'a';
netif->name[1] = 'p';
return wlanif_init(netif);
}

View file

@ -100,8 +100,9 @@ static netif_init_fn tcpip_if_to_netif_init_fn(tcpip_adapter_if_t tcpip_if)
switch(tcpip_if) {
#ifdef CONFIG_WIFI_ENABLED
case TCPIP_ADAPTER_IF_AP:
return wlanif_init_ap;
case TCPIP_ADAPTER_IF_STA:
return wlanif_init;
return wlanif_init_sta;
#endif
#ifdef CONFIG_ETHERNET
case TCPIP_ADAPTER_IF_ETH: