This is an automated email from the ASF dual-hosted git repository.

aguettouche pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 86bfe1339969606d1101d1d3d1d3d7bb07705bbe
Author: chao.an <anc...@xiaomi.com>
AuthorDate: Wed Feb 19 20:34:52 2020 +0800

    net/bringup: late net init after nsh script done
---
 nshlib/nsh_altconsole.c  | 8 ++++++++
 nshlib/nsh_consolemain.c | 8 ++++++++
 nshlib/nsh_init.c        | 7 -------
 nshlib/nsh_usbconsole.c  | 8 ++++++++
 4 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/nshlib/nsh_altconsole.c b/nshlib/nsh_altconsole.c
index 0d5d628..dd574be 100644
--- a/nshlib/nsh_altconsole.c
+++ b/nshlib/nsh_altconsole.c
@@ -50,6 +50,8 @@
 #include "nsh.h"
 #include "nsh_console.h"
 
+#include "netutils/netinit.h"
+
 #if defined(CONFIG_NSH_ALTCONDEV) && !defined(HAVE_USB_CONSOLE)
 
 /****************************************************************************
@@ -284,6 +286,12 @@ int nsh_consolemain(int argc, char *argv[])
   nsh_initscript(&pstate->cn_vtbl);
 #endif
 
+#ifdef CONFIG_NSH_NETINIT
+  /* Bring up the network */
+
+  netinit_bringup();
+#endif
+
 #if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT)
   /* Perform architecture-specific final-initialization (if configured) */
 
diff --git a/nshlib/nsh_consolemain.c b/nshlib/nsh_consolemain.c
index 9ed118f..60e1f6e 100644
--- a/nshlib/nsh_consolemain.c
+++ b/nshlib/nsh_consolemain.c
@@ -47,6 +47,8 @@
 #include "nsh.h"
 #include "nsh_console.h"
 
+#include "netutils/netinit.h"
+
 #if !defined(CONFIG_NSH_ALTCONDEV) && !defined(HAVE_USB_CONSOLE) && \
     !defined(HAVE_USB_KEYBOARD)
 
@@ -96,6 +98,12 @@ int nsh_consolemain(int argc, char *argv[])
 #endif
 #endif
 
+#ifdef CONFIG_NSH_NETINIT
+  /* Bring up the network */
+
+  netinit_bringup();
+#endif
+
 #ifdef CONFIG_NSH_USBDEV_TRACE
   /* Initialize any USB tracing options that were requested */
 
diff --git a/nshlib/nsh_init.c b/nshlib/nsh_init.c
index ce6d409..7ac91a0 100644
--- a/nshlib/nsh_init.c
+++ b/nshlib/nsh_init.c
@@ -42,7 +42,6 @@
 #include <sys/boardctl.h>
 
 #include "system/readline.h"
-#include "netutils/netinit.h"
 #include "nshlib/nshlib.h"
 
 #include "nsh.h"
@@ -103,10 +102,4 @@ void nsh_initialize(void)
 
   boardctl(BOARDIOC_INIT, 0);
 #endif
-
-#ifdef CONFIG_NSH_NETINIT
-  /* Bring up the network */
-
-  netinit_bringup();
-#endif
 }
diff --git a/nshlib/nsh_usbconsole.c b/nshlib/nsh_usbconsole.c
index c21fc2f..11c1602 100644
--- a/nshlib/nsh_usbconsole.c
+++ b/nshlib/nsh_usbconsole.c
@@ -59,6 +59,8 @@
 #include "nsh.h"
 #include "nsh_console.h"
 
+#include "netutils/netinit.h"
+
 #ifdef HAVE_USB_CONSOLE
 
 /****************************************************************************
@@ -317,6 +319,12 @@ int nsh_consolemain(int argc, char *argv[])
   nsh_initscript(&pstate->cn_vtbl);
 #endif
 
+#ifdef CONFIG_NSH_NETINIT
+  /* Bring up the network */
+
+  netinit_bringup();
+#endif
+
 #if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT)
   /* Perform architecture-specific final-initialization (if configured) */
 

Reply via email to