You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ha...@apache.org on 2022/10/16 19:39:17 UTC

[incubator-nuttx-apps] 01/04: nshlib: Call nsh_sysinitscript in usb or alt console like normal one

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

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

commit cf70d8f95bccb265ba84acc5e3957ada64cdf379
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 15 16:31:12 2022 +0800

    nshlib: Call nsh_sysinitscript in usb or alt console like normal one
    
    forget in the pull request:
    https://github.com/apache/incubator-nuttx-apps/pull/1142
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 nshlib/nsh_altconsole.c | 17 +++++++++++------
 nshlib/nsh_usbconsole.c | 12 +++++++++---
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/nshlib/nsh_altconsole.c b/nshlib/nsh_altconsole.c
index f003f4276..f407ceffd 100644
--- a/nshlib/nsh_altconsole.c
+++ b/nshlib/nsh_altconsole.c
@@ -257,12 +257,10 @@ int nsh_consolemain(int argc, FAR char *argv[])
   usbtrace_enable(TRACE_BITSET);
 #endif
 
-  /* Execute the one-time start-up script.
-   * Any output will go to /dev/console.
-   */
+#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_DISABLESCRIPT)
+  /* Execute the system init script */
 
-#ifdef CONFIG_NSH_ROMFSETC
-  nsh_initscript(&pstate->cn_vtbl);
+  nsh_sysinitscript(&pstate->cn_vtbl);
 #endif
 
 #ifdef CONFIG_NSH_NETINIT
@@ -277,10 +275,17 @@ int nsh_consolemain(int argc, FAR char *argv[])
   boardctl(BOARDIOC_FINALINIT, 0);
 #endif
 
+  /* Execute the one-time start-up script.
+   * Any output will go to /dev/console.
+   */
+
+#ifdef CONFIG_NSH_ROMFSETC
+  nsh_initscript(&pstate->cn_vtbl);
+#endif
+
   /* First map stderr and stdout to alternative devices */
 
   ret = nsh_clone_console(pstate);
-
   if (ret < 0)
     {
       return ret;
diff --git a/nshlib/nsh_usbconsole.c b/nshlib/nsh_usbconsole.c
index 5ec2ac4c9..bdde01986 100644
--- a/nshlib/nsh_usbconsole.c
+++ b/nshlib/nsh_usbconsole.c
@@ -284,10 +284,10 @@ int nsh_consolemain(int argc, FAR char *argv[])
   nsh_nullstdio();
 #endif
 
-  /* Execute the one-time start-up script (output may go to /dev/null) */
+#if defined(CONFIG_NSH_ROMFSETC) && !defined(CONFIG_NSH_DISABLESCRIPT)
+  /* Execute the system init script */
 
-#ifdef CONFIG_NSH_ROMFSETC
-  nsh_initscript(&pstate->cn_vtbl);
+  nsh_sysinitscript(&pstate->cn_vtbl);
 #endif
 
 #ifdef CONFIG_NSH_NETINIT
@@ -302,6 +302,12 @@ int nsh_consolemain(int argc, FAR char *argv[])
   boardctl(BOARDIOC_FINALINIT, 0);
 #endif
 
+  /* Execute the one-time start-up script (output may go to /dev/null) */
+
+#ifdef CONFIG_NSH_ROMFSETC
+  nsh_initscript(&pstate->cn_vtbl);
+#endif
+
   /* Now loop, executing creating a session for each USB connection */
 
   for (; ; )