fix(prodtest): resolve unreliable USB VCP transmission
What changed, and why it matters
This commit fixes a minor reliability issue in Trezor's production-test firmware (a factory diagnostic tool, not the main wallet firmware). The change adjusts how long the device waits when sending text over a USB virtual serial port, so it doesn't get stuck if no computer is listening. There is no direct evidence this is a security vulnerability or that it affects end-user devices.
No immediate security action required. Treat as a normal reliability fix. If reviewing, verify the timeout logic does not introduce partial-write handling bugs in the CLI layer above console_write.
Security signals we found
No security-relevant keywords in commit title or message
No CVE, advisory, or security-credit references in commit
Change is in production-test firmware, not main wallet firmware
Behavioral change is a timeout/backoff workaround for unconnected host
No memory corruption, cryptographic, authentication, or privilege-escalation signals visible in diff
Evidence from the diff
In core/embed/projects/prodtest/main.c, console_write() now uses a 2000 ms timeout for the first write attempt to syshandle_write_blocking(SYSHANDLE_USB_VCP, …). If fewer bytes were sent than requested, the timeout is reduced to 100 ms for subsequent calls. This is described in code comments as a workaround for the host not being connected. The accompanying changelog fragment says ‘Fixed issues with USB VCP stability.’ The change is in the prodtest (production test) project only, not in the main Trezor firmware runtime used by consumers.
Changed components
core/embed/projects/prodtest/main.cUSB VCP console write path in production-test firmwareInspect captured patch +7 / −1
diff --git a/core/embed/projects/prodtest/.changelog.d/5940.fixed b/core/embed/projects/prodtest/.changelog.d/5940.fixed
new file mode 100644
index 000000000..fb4bfdb81
--- /dev/null
+++ b/core/embed/projects/prodtest/.changelog.d/5940.fixed
@@ -0,0 +1 @@
+Fixed issues with USB VCP stability.
diff --git a/core/embed/projects/prodtest/main.c b/core/embed/projects/prodtest/main.c
index e57db00f8..c89cd930c 100644
--- a/core/embed/projects/prodtest/main.c
+++ b/core/embed/projects/prodtest/main.c
@@ -129,7 +129,12 @@ static ssize_t console_read(void *context, char *buf, size_t size) {
}
static ssize_t console_write(void *context, const char *buf, size_t size) {
- return syshandle_write_blocking(SYSHANDLE_USB_VCP, buf, size, 100);
+ static uint32_t timeout = 2000;
+ int rc = syshandle_write_blocking(SYSHANDLE_USB_VCP, buf, size, timeout);
+ // Do not wait too long if the host is not connected.
+ // This is a workaround that needs to be fixed properly later.
+ timeout = rc < size ? 100 : 2000;
+ return rc;
}
static void usb_vcp_intr_callback(void) { cli_abort(&g_cli); }
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.