stty Terminal Configuration
Description
The stty command provides a standard Unix-like interface for viewing
and configuring terminal (TTY) device settings at runtime via termios.
It supports raw/cooked mode switching, individual flag control, baud
rate configuration, and VMIN/VTIME parameters.
Usage
Basic Syntax
stty [options] [settings...]
Options:
|
Operate on the specified device instead of stdin |
|
Show help message |
Settings
Setting |
Description |
|---|---|
|
Set raw mode (no input/output processing) |
|
Set cooked mode (canonical with echo) |
|
Enable echo |
|
Disable echo |
|
Enable canonical mode |
|
Disable canonical mode |
|
Map CR to NL on input |
|
Don’t map CR to NL |
|
Map NL to CR-NL on output |
|
Don’t map NL to CR-NL |
|
Enable output processing |
|
Disable output processing |
|
Enable signal characters |
|
Disable signal characters |
|
Map NL to CR on input |
|
Don’t map NL to CR on input |
|
Ignore CR on input |
|
Don’t ignore CR on input |
|
Map CR to NL on output |
|
Don’t map CR to NL on output |
|
Set baud rate |
|
Set VMIN (minimum chars for read, 0-255) |
|
Set VTIME (read timeout in 0.1s, 0-255) |
Examples
# Display current settings for /dev/ttyS0
nsh> stty -F /dev/ttyS0
# Set raw mode for binary communication
nsh> stty -F /dev/ttyS0 raw -echo
# Set cooked mode for interactive terminal
nsh> stty -F /dev/ttyS0 cooked
# Configure baud rate
nsh> stty -F /dev/ttyS1 speed 115200
# Set non-blocking read with timeout
nsh> stty -F /dev/ttyS0 min 0 time 10
# Display current settings for stdin
nsh> stty
Configuration
CONFIG_SYSTEM_STTY
Options:
CONFIG_SYSTEM_STTY_PRIORITY - Task priority (default 100)
CONFIG_SYSTEM_STTY_STACKSIZE - Stack size (default
DEFAULT_TASK_STACKSIZE)
Dependencies
CONFIG_SERIAL_TERMIOS - Required for termios support