system: Add stty utility for terminal control - #3724
Merged
Conversation
This commit adds a system utily 'stty' to NuttX, providing a standard Unix-like interface for configuring terminal (TTY) device settings. The command allows runtime configuration of termios attributes for serial ports and other character devices. Usage examples: # Set raw mode on ttyS0 (for binary communication) nsh> stty -F /dev/ttyS0 raw -echo # Set console mode for interactive terminal nsh> stty -F /dev/ttyS0 cooked # Display current settings nsh> stty -F /dev/ttyS0 # Configure stdin (if it's a TTY) nsh> stty echo icanon # Set baudrate (if driver support) nsh> stty -F /dev/ttyS1 speed 115200 Signed-off-by: fangpeina <fangpeina@xiaomi.com>
acassis
requested changes
Aug 13, 2026
acassis
left a comment
Contributor
There was a problem hiding this comment.
@fangpeina nice addition! Please add the Documentation about this new command
xiaoxiang781216
approved these changes
Aug 14, 2026
Contributor
Author
Done. Related PR: #19845 |
acassis
approved these changes
Aug 14, 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
Add a
sttycommand to NuttX, providing a standard Unix-like interface forviewing and configuring terminal (TTY) device settings at runtime via termios.
Impact
sttyutility for runtime terminal configurationCONFIG_SYSTEM_STTYoption, depends onCONFIG_SERIAL_TERMIOSTesting
Testing on sim, qemu and physical device.
Configuration:
CONFIG_SIM_UART_NUMBER=1,CONFIG_SIM_UART_PTY=y,CONFIG_SERIAL_TERMIOS=y,CONFIG_SYSTEM_STTY=yRuntime Test Results(sim):
Runtime Test Results(goldfish-armv7a-ap):