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 <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-10-15 16:31:12 +08:00 committed by hartmannathan
parent 893387b2c5
commit cf70d8f95b
2 changed files with 20 additions and 9 deletions

View File

@ -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;

View File

@ -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 (; ; )