]> granicus.if.org Git - esp-idf/commitdiff
give the AP and STA netifs different names for ease of debugging lwip
authorEdmund Huber <me@ehuber.info>
Sat, 25 Mar 2017 00:57:48 +0000 (17:57 -0700)
committerIvan Grokhotkov <ivan@espressif.com>
Tue, 11 Apr 2017 12:40:36 +0000 (20:40 +0800)
components/lwip/include/lwip/port/netif/wlanif.h
components/lwip/port/netif/wlanif.c
components/tcpip_adapter/tcpip_adapter_lwip.c

index 5a93640f191a5b6408633191aef6eae3bd64a9bd..9c79f5b0aff2aa5d07c6afed3779f4a88e635481 100755 (executable)
@@ -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);
 
index 9f454230ab2049736c23625e74f8ef78e1c3f86e..50a23602083522a557a580926381a04986fa88a8 100644 (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);
+}
+
+
index bc50c79b9765f968dde931565c6776a0105d683f..93cf8e93e5d6df4510fdce64716069ed95670ad7 100644 (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: