Skip to content

finsh无法输入的bug #2460

@XXXXzzzz000

Description

@XXXXzzzz000

现象:
使用finsh时可以输入,有回显,按下回车时不会回显回车,而是从开头继续输入,经debug发现是此处

shell.c +137

static int finsh_getchar(void)
{
#ifdef RT_USING_POSIX
    return getchar();
#else
    int ch=0;

    RT_ASSERT(shell != RT_NULL);
    while (rt_device_read(shell->device, -1, &ch, 1) != 1)
        rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);

    return ch;
#endif
}

ch在源码中没有进行初始化,导致莫名其妙的乱码,但是回显是正确的,此处不知道有没有什么更深层次的原因.
并且此处及finsh_thread_entry中仅检查其是否小于0,而我的调试信息显示ch存储的是一个很大的数字.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions