File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
components/drivers/serial Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 2424 * 2018-12-08 Ernest Chen add DMA choice
2525 * 2020-09-14 WillianChan add a line feed to the carriage return character
2626 * when using interrupt tx
27+ * 2020-12-14 Meco Man add function of setting window's size(TIOCSWINSZ)
2728 */
2829
2930#include <rthw.h>
@@ -1012,7 +1013,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
10121013 }
10131014
10141015 break ;
1015-
1016+ #ifdef RT_USING_POSIX
10161017#ifdef RT_USING_POSIX_TERMIOS
10171018 case TCGETA :
10181019 {
@@ -1104,8 +1105,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
11041105 break ;
11051106 case TCXONC :
11061107 break ;
1107- #endif
1108- #ifdef RT_USING_POSIX
1108+ #endif /*RT_USING_POSIX_TERMIOS*/
11091109 case FIONREAD :
11101110 {
11111111 rt_size_t recved = 0 ;
@@ -1118,7 +1118,15 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
11181118 * (rt_size_t * )args = recved ;
11191119 }
11201120 break ;
1121- #endif
1121+ case TIOCSWINSZ :
1122+ {
1123+ struct winsize * p_winsize ;
1124+
1125+ p_winsize = (struct winsize * )args ;
1126+ rt_kprintf ("\x1b[8;%d;%dt" , p_winsize -> ws_col , p_winsize -> ws_row );
1127+ }
1128+ break ;
1129+ #endif /*RT_USING_POSIX*/
11221130 default :
11231131 /* control device */
11241132 ret = serial -> ops -> control (serial , cmd , args );
You can’t perform that action at this time.
0 commit comments