Skip to content

Commit

Permalink
feat(core/prodtest): Allow prodtest to exit from interactive mode [no…
Browse files Browse the repository at this point in the history
… changelog]
  • Loading branch information
kopecdav committed Feb 12, 2025
1 parent 2774fb1 commit 4fc9811
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/embed/projects/prodtest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The prodtest includes a simple text-based command-line interface that can be con

Pressing the ENTER key twice switches the interface to interactive mode, enabling basic line editing, autocomplete functionality (using the TAB key), and text coloring.

To exit from interactive mode type `.+ENTER`.

### Commands
These commands begin with the command name and may optionally include parameters separated by spaces.

Expand Down
9 changes: 9 additions & 0 deletions core/embed/rtl/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,15 @@ void cli_run_loop(cli_t* cli) {
}
cli->empty_lines = 0;

// Quit interactive mode on `.+ENTER`
if ((strcmp(cli->cmd_name, ".") == 0)) {
if (cli->interactive) {
cli->interactive = false;
cli_trace(cli, "Exiting interactive mode...");
}
continue;
}

// Find the command handler
cli->current_cmd = cli_find_command(cli, cli->cmd_name);

Expand Down

0 comments on commit 4fc9811

Please sign in to comment.