[components][finsh]在RT_USING_POSIX_STDIO时,使用get_console获取当前console描述符

This commit is contained in:
liuchao 2024-11-04 17:59:59 +08:00 committed by Meco Man
parent 96165a5e99
commit bdf5a1fb09
1 changed files with 6 additions and 1 deletions

View File

@ -32,6 +32,11 @@
#include <fcntl.h> #include <fcntl.h>
#endif /* DFS_USING_POSIX */ #endif /* DFS_USING_POSIX */
#ifdef RT_USING_POSIX_STDIO
#include <unistd.h>
#include <posix/stdio.h>
#endif /* RT_USING_POSIX_STDIO */
/* finsh thread */ /* finsh thread */
#ifndef RT_USING_HEAP #ifndef RT_USING_HEAP
static struct rt_thread finsh_thread; static struct rt_thread finsh_thread;
@ -154,7 +159,7 @@ int finsh_getchar(void)
#ifdef RT_USING_DEVICE #ifdef RT_USING_DEVICE
char ch = 0; char ch = 0;
#ifdef RT_USING_POSIX_STDIO #ifdef RT_USING_POSIX_STDIO
if(read(STDIN_FILENO, &ch, 1) > 0) if(read(rt_posix_stdio_get_console(), &ch, 1) > 0)
{ {
return ch; return ch;
} }