Repository navigation
system/cu: drop remote CR, keep local ONLCR - #4290
Open
shenjunyuan-2 wants to merge 2 commits into
Open
shenjunyuan-2 wants to merge 2 commits into
shenjunyuan-2 wants to merge 2 commits into
Conversation
4 of 5 tasks
added 2 commits
December 4, 2026 13:18
Add the missing blank line after the declaration in cu_exit() and indent the case labels of the switch in cu_cmd() as the coding standard asks. Signed-off-by: shenjunyuan <shenjunyuan@xiaomi.com>
cu forced its local console to raw (c_oflag = 0), which also cleared OPOST/ONLCR on a console that may be shared with a background syslog writer (e.g. the dfx log daemon on the same physical UART). Concurrent bare-LF log lines then lost their CR and staggered inside a cu session. Keep the local console's output post-processing (OPOST/ONLCR) enabled so the shared console keeps translating NL->CR-LF for every writer. The remote may itself be a console that already does NL->CR-LF (e.g. an rpmsg virtual console on another core); set IGNCR on the remote line so the incoming CR is discarded and the forwarded stream carries bare LF. The local ONLCR then re-inserts a single CR instead of doubling it (\r\r\n). Signed-off-by: shenjunyuan <shenjunyuan@xiaomi.com>
shenjunyuan-2
force-pushed
the
cu-local-crlf
branch
from
December 4, 2026 05:25
952aa8d to
6bfbe7d
Compare
xiaoxiang781216
approved these changes
Dec 4, 2026
simbit18
approved these changes
Dec 4, 2026
jerpelea
approved these changes
Dec 4, 2026
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.
Summary
cuputs the local console into raw mode (c_oflag = 0), whichalso clears OPOST/ONLCR on a console that may be shared with a
background writer such as a syslog daemon on the same UART. That
writer's bare-LF lines then lose their CR and stagger for the whole cu
session.
cu_main.c(missingblank line after a declaration, case label indentation), which
checkpatch otherwise reports for any change to the file. No
functional change.
and sets
IGNCRon the device line. A remote that is itself aconsole already sends CR-LF; its CR is dropped and the local ONLCR
adds a single CR back, instead of producing CR CR LF.
Impact
console keeps its NL -> CR-LF conversion, and CR characters received
from the device are discarded.
indicators, line redraw) is now shown without it.
Testing
I confirm that changes are verified on local setup and works as intended:
CONFIG_SYSTEM_CUTERM=yCONFIG_SERIAL_TERMIOS=yCONFIG_SIM_UART_NUMBER=1CONFIG_SIM_UART_PTY=ycu -l /dev/ttySIM0in nsh; the host writesREM1\r\nP10%\rP99%\r\nREM2\nto the host side of the sim UART PTY.Bytes that reached the NuttX console:
Testing logs before change (master):
Testing logs after change:
The remote CR-LF ends up as a single CR-LF, the bare LF gets its CR from
the console, and the bare CR is dropped.
Also:
tools/checkpatch.sh -mclean, sim:nsh +CONFIG_SYSTEM_CUTERMmake and CMake builds pass, ostest exits with status 0. Verified on sim
only.
PR verification Self-Check