| 505 | #endif /* RT_USING_HOOK */ |
| 506 | |
| 507 | static 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 |
nothing calls this directly
no test coverage detected