no1wudi commented on issue #8731: URL: https://github.com/apache/nuttx/issues/8731#issuecomment-1461288702
I guess this issue with cle is relative to esp32c3's usb-serial driver. You can checkout to previous point of https://github.com/apache/nuttx-apps/commit/95f32fd018be7a66354942647d9e1c778ad5d488,such as 6a686ba93d082cf098cd1dc70943dad30e20d90d, nuttx still use the master, you will find the nsh works well. Beacuse that commit remove the stdio, then nsh prompt will write direct to the driver instead of the stdio's buffer first, but it seems the driver is not ready in this time. `readline` works since `cle` is more complex, `cle` will send some vt100 command sequence to terminal and wait the response but `readline` does not, if the uart is not really ready, maybe some bytes lost from command sequence, then you get the `nsh: nsh_session: cle failed: Invalid argument`, but can get works by type more enter. Another way to validate the root case is by adding a short sleep in `apps/system/nsh/nsh_main.c:56` in latest code: ```c int main(int argc, FAR char *argv[]) { struct sched_param param; int ret = 0; // Sleep 1ms, new added to debug usleep(1000); /* Check the task priority that we were started with */ sched_getparam(0, ¶m); if (param.sched_priority != CONFIG_SYSTEM_NSH_PRIORITY) { /* If not then set the priority to the configured priority */ param.sched_priority = CONFIG_SYSTEM_NSH_PRIORITY; sched_setparam(0, ¶m); } /* Initialize the NSH library */ nsh_initialize(); #ifdef CONFIG_NSH_CONSOLE /* If the serial console front end is selected, run it on this thread */ ret = nsh_consolemain(argc, argv); /* nsh_consolemain() should not return. So if we get here, something * is wrong. */ dprintf(STDERR_FILENO, "ERROR: nsh_consolemain() returned: %d\n", ret); ret = 1; #endif return ret; } ``` Then the nsh works correctly. @xiaoxiang781216 @janantos @gustavonihei What's your opinion? BTW, @gustavonihei Is there any way to check the usb-serial is really ready for use ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org