We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 75a7cb6 commit d99193eCopy full SHA for d99193e
components/finsh/shell.c
@@ -162,14 +162,19 @@ int finsh_getchar(void)
162
RT_ASSERT(shell != RT_NULL);
163
164
device = shell->device;
165
- if (device == RT_NULL)
166
- {
167
- return -1; /* EOF */
168
- }
169
170
while (rt_device_read(device, -1, &ch, 1) != 1)
+ {
171
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
172
-
+ if (shell->device != device)
+ device = shell->device;
+ if (device == RT_NULL)
173
174
+ return -1;
175
+ }
176
177
178
return ch;
179
#endif /* RT_USING_POSIX_STDIO */
180
#else
0 commit comments