From 0c9bcefc6c0297e0f0935cb006461b61c46810ac Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Wed, 10 Mar 2021 20:29:13 +0800 Subject: [PATCH] =?UTF-8?q?[ioctl]=20=E5=A2=9E=E5=8A=A0TIOCGWINSZ=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/serial/serial.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index 5743155e37..be68f578eb 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -1113,9 +1113,19 @@ static rt_err_t rt_serial_control(struct rt_device *dev, struct winsize* p_winsize; p_winsize = (struct winsize*)args; - rt_enter_critical(); rt_kprintf("\x1b[8;%d;%dt", p_winsize->ws_col, p_winsize->ws_row); - rt_exit_critical(); + } + break; + case TIOCGWINSZ: + { + struct winsize* p_winsize; + + p_winsize = (struct winsize*)args; + /* TODO: get windows size from console */ + p_winsize->ws_col = 80; + p_winsize->ws_row = 24; + p_winsize->ws_xpixel = 0;/*unused*/ + p_winsize->ws_ypixel = 0;/*unused*/ } break; #endif /*RT_USING_POSIX_TERMIOS*/