You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/04/19 14:07:15 UTC

[incubator-nuttx-apps] 01/09: nshlib: Ensure nsh_initscript always follow usbtrace_enable immediately

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

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

commit 6c4dc44e048b7fed047c1501f89d41789ed2e3a5
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Apr 17 02:14:05 2020 +0800

    nshlib: Ensure nsh_initscript always follow usbtrace_enable immediately
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 nshlib/nsh_consolemain.c | 12 ++++++------
 nshlib/nsh_telnetd.c     | 18 +++++++++---------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/nshlib/nsh_consolemain.c b/nshlib/nsh_consolemain.c
index 60e1f6e..61aabf3 100644
--- a/nshlib/nsh_consolemain.c
+++ b/nshlib/nsh_consolemain.c
@@ -86,6 +86,12 @@ int nsh_consolemain(int argc, char *argv[])
 
   DEBUGASSERT(pstate != NULL);
 
+#ifdef CONFIG_NSH_USBDEV_TRACE
+  /* Initialize any USB tracing options that were requested */
+
+  usbtrace_enable(TRACE_BITSET);
+#endif
+
 #ifdef CONFIG_NSH_ROMFSETC
   /* Execute the start-up script */
 
@@ -104,12 +110,6 @@ int nsh_consolemain(int argc, char *argv[])
   netinit_bringup();
 #endif
 
-#ifdef CONFIG_NSH_USBDEV_TRACE
-  /* Initialize any USB tracing options that were requested */
-
-  usbtrace_enable(TRACE_BITSET);
-#endif
-
 #if defined(CONFIG_NSH_ARCHINIT) && defined(CONFIG_BOARDCTL_FINALINIT)
   /* Perform architecture-specific final-initialization (if configured) */
 
diff --git a/nshlib/nsh_telnetd.c b/nshlib/nsh_telnetd.c
index bfea5b6..a168549 100644
--- a/nshlib/nsh_telnetd.c
+++ b/nshlib/nsh_telnetd.c
@@ -127,15 +127,6 @@ static int nsh_telnetmain(int argc, char *argv[])
 
   fflush(pstate->cn_outstream);
 
-  /* Execute the startup script.  If standard console is also defined, then
-   * we will not bother with the initscript here (although it is safe to
-   * call nshinitscript multiple times).
-   */
-
-#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_CONSOLE)
-  nsh_initscript(vtbl);
-#endif
-
   /* Execute the login script */
 
 #ifdef CONFIG_NSH_ROMFSRC
@@ -266,6 +257,15 @@ int nsh_telnetstart(sa_family_t family)
       usbtrace_enable(TRACE_BITSET);
 #endif
 
+      /* Execute the startup script.  If standard console is also defined, then
+      * we will not bother with the initscript here (although it is safe to
+      * call nshinitscript multiple times).
+      */
+
+#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_CONSOLE)
+      nsh_initscript(vtbl);
+#endif
+
       /* Configure the telnet daemon */
 
       config.d_port      = HTONS(CONFIG_NSH_TELNETD_PORT);