Repository navigation
Stop losing USB console output on Zephyr boards - #11586
Merged
Merged
Conversation
The CDC ACM driver drops poll_out bytes when its TX buffer is full and flow control is off, so a long print lost a few hundred characters even with a terminal reading. Turn the driver flow control on for the console while USB is configured, not suspended, and the host holds DTR, and off otherwise. This matches TinyUSB, which only overwrites its TX FIFO when the host is not connected, so a closed, suspended or unplugged port still never blocks output. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
While a terminal is open, the USB console now waits instead of dropping output.
Why
A long print lost about 800 characters with a terminal reading.
TinyUSB ports only drop output when no terminal is open.
The lost USB output mentioned in #11578.
Tests
nRF54LM20 DK, Linux host.
print('L' * 20000), port opencode.pyprints 120 KBPico W (
raspberrypi_rpi_pico_w_zephyr, no VBUS detection), 20000 characters as 20 prints of 1000:Not tested: host suspend with the port open.
usb_cdc.datais unchanged and still drops when full.Written with Claude; tested on hardware by me.
🤖 Generated with Claude Code