diff options
| author | LiuKang <[email protected]> | 2022-03-15 16:56:59 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-15 16:56:59 +0800 |
| commit | aa80ba25d40f086c64497cd2453f1cd7879fb709 (patch) | |
| tree | 042c38706523aa91ae2ce06c2d060d39a702e407 /components/finsh | |
| parent | 75a7cb69292243adfdff15722ea9b07b1642438c (diff) | |
[update] fix finsh bug (#5676)
* [update] fix finsh bug
* [update] format code
Diffstat (limited to 'components/finsh')
| -rw-r--r-- | components/finsh/shell.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 824c60392d..3304733496 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -168,8 +168,17 @@ int finsh_getchar(void) } while (rt_device_read(device, -1, &ch, 1) != 1) + { rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER); - + if (shell->device != device) + { + device = shell->device; + if (device == RT_NULL) + { + return -1; + } + } + } return ch; #endif /* RT_USING_POSIX_STDIO */ #else |
