From f1db0e6906ba689fd974d10813ddce378f5a8862 Mon Sep 17 00:00:00 2001 From: kopecdav Date: Tue, 11 Feb 2025 12:39:48 +0100 Subject: [PATCH] feat(core/prodtest): Allow prodtest to exit from interactive mode [no changelog] --- core/embed/projects/prodtest/README.md | 2 ++ core/embed/rtl/cli.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/core/embed/projects/prodtest/README.md b/core/embed/projects/prodtest/README.md index c3ee5202d6..69972e68fc 100644 --- a/core/embed/projects/prodtest/README.md +++ b/core/embed/projects/prodtest/README.md @@ -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. diff --git a/core/embed/rtl/cli.c b/core/embed/rtl/cli.c index ebffa2a2b0..f513fd5011 100644 --- a/core/embed/rtl/cli.c +++ b/core/embed/rtl/cli.c @@ -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);