fangpeina opened a new pull request, #3724:
URL: https://github.com/apache/nuttx-apps/pull/3724

   
   ## Summary
   
   Add a `stty` command to NuttX, providing a standard Unix-like interface for
   viewing and configuring terminal (TTY) device settings at runtime via 
termios.
   
   ## Impact
   
   - **Features**: Adds `stty` utility for runtime terminal configuration
   - **User Experience**: Users can inspect and modify TTY settings from NSH
   - **Build**: No build system changes; new `CONFIG_SYSTEM_STTY` option, 
depends on `CONFIG_SERIAL_TERMIOS`
   
   ## Testing
   
   Testing on sim, qemu and physical device. 
   
   ###  Configuration:
   - **Board**: sim:nsh (Linux host)
   - **Config**: `CONFIG_SIM_UART_NUMBER=1`, `CONFIG_SIM_UART_PTY=y`, 
`CONFIG_SERIAL_TERMIOS=y`, `CONFIG_SYSTEM_STTY=y`
   
   ### Runtime Test Results(sim):
   ```
   nsh> stty -F /dev/ttySIM0
   /dev/ttySIM0 connected to pseudotty: /dev/pts/31
   Terminal settings for /dev/ttySIM0:
     speed unknown or not supported by driver; min = 1; time = 0;
     c_iflag: 0x00000000 -icrnl -igncr -inlcr
     c_oflag: 0x00000000 -opost -onlcr -ocrnl
     c_lflag: 0x00000000 -echo -icanon -isig
     c_cflag: 0x000000bf -clocal cread -cstopb
   nsh> stty -F /dev/ttySIM0 cooked
   /dev/ttySIM0 connected to pseudotty: /dev/pts/31
   Settings applied to /dev/ttySIM0
   nsh> stty -F /dev/ttySIM0
   /dev/ttySIM0 connected to pseudotty: /dev/pts/31
   Terminal settings for /dev/ttySIM0:
     speed unknown or not supported by driver; min = 1; time = 0;
     c_iflag: 0x00000100 icrnl -igncr -inlcr
     c_oflag: 0x00000005 opost onlcr -ocrnl
     c_lflag: 0x0000000b echo icanon isig
     c_cflag: 0x000000bf -clocal cread -cstopb
   nsh> stty -F /dev/ttySIM0 raw -echo
   /dev/ttySIM0 connected to pseudotty: /dev/pts/31
   Settings applied to /dev/ttySIM0
   nsh> stty -F /dev/ttySIM0
   /dev/ttySIM0 connected to pseudotty: /dev/pts/31
   Terminal settings for /dev/ttySIM0:
     speed unknown or not supported by driver; min = 1; time = 0;
     c_iflag: 0x00000000 -icrnl -igncr -inlcr
     c_oflag: 0x00000004 -opost onlcr -ocrnl
     c_lflag: 0x00000000 -echo -icanon -isig
     c_cflag: 0x000000bf -clocal cread -cstopb
   nsh> 
   nsh> stty
   Terminal settings for stdin:
     speed unknown or not supported by driver; min = 1; time = 0;
     c_iflag: 0x00000100 icrnl -igncr -inlcr
     c_oflag: 0x00000005 opost onlcr -ocrnl
     c_lflag: 0x0000000b echo icanon isig
     c_cflag: 0x000000bf -clocal cread -cstopb
   nsh> stty -F /dev/null
   ERROR: /dev/null is not a TTY
   nsh> stty -F /dev/noexist
   ERROR: Failed to open /dev/noexist: 2
   ```
   
   ### Runtime Test Results(goldfish-armv7a-ap):
   ```
   goldfish-armv7a-ap> stty -F /dev/ttyS1
   Terminal settings for /dev/ttyS1:
     speed 115200 baud; min = 1; time = 0;
     c_iflag: 0x00000100 icrnl -igncr -inlcr
     c_oflag: 0x00000005 opost onlcr -ocrnl
     c_lflag: 0x0000000b echo icanon isig
     c_cflag: 0x000000b0 -clocal cread -cstopb
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to