MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / finsh_thread_entry

Function finsh_thread_entry

components/finsh/shell.c:507–906  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505#endif /* RT_USING_HOOK */
506
507static void finsh_thread_entry(void *parameter)
508{
509 int ch;
510
511 RT_OBJECT_HOOK_CALL(_finsh_thread_entry_hook, ());
512
513 /* normal is echo mode */
514#ifndef FINSH_ECHO_DISABLE_DEFAULT
515 shell->echo_mode = 1;
516#else
517 shell->echo_mode = 0;
518#endif
519
520#if !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE)
521 /* set console device as shell device */
522 if (shell->device == RT_NULL)
523 {
524 rt_device_t console = rt_console_get_device();
525 if (console)
526 {
527 finsh_set_device(console->parent.name);
528 }
529 }
530#endif /* !defined(RT_USING_POSIX_STDIO) && defined(RT_USING_DEVICE) */
531
532#ifdef FINSH_USING_AUTH
533 /* set the default password when the password isn't setting */
534 if (rt_strlen(finsh_get_password()) == 0)
535 {
536 if (finsh_set_password(FINSH_DEFAULT_PASSWORD) != RT_EOK)
537 {
538 rt_kprintf("Finsh password set failed.\n");
539 }
540 }
541 /* waiting authenticate success */
542 finsh_wait_auth();
543#endif
544
545 rt_kprintf(FINSH_PROMPT);
546
547 while (1)
548 {
549 ch = (int)finsh_getchar();
550 if (ch < 0)
551 {
552 continue;
553 }
554
555 /*
556 * handle control key
557 * up key : 0x1b 0x5b 0x41
558 * down key: 0x1b 0x5b 0x42
559 * right key:0x1b 0x5b 0x43
560 * left key: 0x1b 0x5b 0x44
561 * home : 0x1b 0x5b 0x31 0x7E
562 * insert : 0x1b 0x5b 0x32 0x7E
563 * del : 0x1b 0x5b 0x33 0x7E
564 * end : 0x1b 0x5b 0x34 0x7E

Callers

nothing calls this directly

Calls 15

rt_console_get_deviceFunction · 0.85
finsh_set_deviceFunction · 0.85
rt_strlenFunction · 0.85
finsh_get_passwordFunction · 0.85
finsh_set_passwordFunction · 0.85
rt_kprintfFunction · 0.85
finsh_wait_authFunction · 0.85
finsh_getcharFunction · 0.85
rt_memcpyFunction · 0.85
shell_handle_historyFunction · 0.85
rt_memmoveFunction · 0.85
shell_auto_completeFunction · 0.85

Tested by

no test coverage detected