Skip to content

Commit 38ecf5b

Browse files
jimparisnashif
authored andcommitted
shell: Consume all input data
A transport may receive multiple bytes of data between shell_thread wakeups, but state_collect is only called once per wakeup. So it must process all data, and only return when all data from the transport has been consumed. This is mostly handled correctly, but there were two places where state_collect would return early instead. Signed-off-by: Jim Paris <jim@jtan.com>
1 parent d38ffed commit 38ecf5b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/shell/shell.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ static void state_collect(const struct shell *shell)
882882
* on received NL.
883883
*/
884884
state_set(shell, SHELL_STATE_ACTIVE);
885-
return;
885+
continue;
886886
}
887887

888888
switch (data) {
@@ -950,7 +950,7 @@ static void state_collect(const struct shell *shell)
950950
receive_state_change(shell, SHELL_RECEIVE_DEFAULT);
951951

952952
if (!flag_echo_get(shell)) {
953-
return;
953+
continue;
954954
}
955955

956956
switch (data) {

0 commit comments

Comments
 (0)