feat(prodtest): ping command with an argument
What changed, and why it matters
This commit adds an optional text argument to the Trezor production-test firmware's 'ping' command. Previously, 'ping' always replied with just 'OK'. Now, if you type 'ping ABC', the device replies 'OK ABC'. It is a small feature change in a diagnostic/testing tool, not a security fix or vulnerability.
No security action needed. Treat as a normal feature commit. If reviewing, verify that cli_arg() returns an empty string (not NULL) when the optional argument is omitted, so cli_ok(cli, "%s", ...) remains safe.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change updates prodtest_ping.c to accept zero or one argument instead of zero, and echoes the argument back via cli_ok() using a ‘%s’ format string. The argument count check changes from >0 to >1, and the command’s args metadata changes from empty to ‘[
Changed components
core/embed/projects/prodtest/cmd/prodtest_ping.ccore/embed/projects/prodtest/README.mdInspect captured patch +8 / −5
diff --git a/core/embed/projects/prodtest/.changelog.d/5940.added b/core/embed/projects/prodtest/.changelog.d/5940.added
new file mode 100644
index 00000000..e13e2941
--- /dev/null
+++ b/core/embed/projects/prodtest/.changelog.d/5940.added
@@ -0,0 +1 @@
+Added an argument to the ping command.
diff --git a/core/embed/projects/prodtest/README.md b/core/embed/projects/prodtest/README.md
index 6a569130..fa9e533f 100644
--- a/core/embed/projects/prodtest/README.md
+++ b/core/embed/projects/prodtest/README.md
@@ -98,10 +98,12 @@ OK
### ping
The `ping` command serves as a no-operation request, and the device responds with `OK` to acknowledge receipt.
+`ping [<text>]`
+
Example:
```
-ping
-OK
+ping ABC
+OK ABC
```
### reboot
diff --git a/core/embed/projects/prodtest/cmd/prodtest_ping.c b/core/embed/projects/prodtest/cmd/prodtest_ping.c
index 4e41d5e1..d8f95c1f 100644
--- a/core/embed/projects/prodtest/cmd/prodtest_ping.c
+++ b/core/embed/projects/prodtest/cmd/prodtest_ping.c
@@ -22,13 +22,13 @@
#include <rtl/cli.h>
static void prodtest_ping(cli_t* cli) {
- if (cli_arg_count(cli) > 0) {
+ if (cli_arg_count(cli) > 1) {
cli_error_arg_count(cli);
return;
}
// Respond with an OK message
- cli_ok(cli, "");
+ cli_ok(cli, "%s", cli_arg(cli, "text"));
}
// clang-format off
@@ -37,5 +37,5 @@ PRODTEST_CLI_CMD(
.name = "ping",
.func = prodtest_ping,
.info = "Send a ping to the device",
- .args = ""
+ .args = "[<text>]"
);
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.