[ioctl] add TIOCSWINSZ

This commit is contained in:
mysterywolf 2020-12-14 01:12:24 +08:00
parent 3634621815
commit 1404d208db
1 changed files with 12 additions and 4 deletions

View File

@ -24,6 +24,7 @@
* 2018-12-08 Ernest Chen add DMA choice
* 2020-09-14 WillianChan add a line feed to the carriage return character
* when using interrupt tx
* 2020-12-14 Meco Man add function of setting window's size(TIOCSWINSZ)
*/
#include <rthw.h>
@ -1009,7 +1010,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
}
break;
#ifdef RT_USING_POSIX
#ifdef RT_USING_POSIX_TERMIOS
case TCGETA:
{
@ -1101,8 +1102,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
break;
case TCXONC:
break;
#endif
#ifdef RT_USING_POSIX
#endif /*RT_USING_POSIX_TERMIOS*/
case FIONREAD:
{
rt_size_t recved = 0;
@ -1115,7 +1115,15 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
*(rt_size_t *)args = recved;
}
break;
#endif
case TIOCSWINSZ:
{
struct winsize* p_winsize;
p_winsize = (struct winsize*)args;
rt_kprintf("\x1b[8;%d;%dt", p_winsize->ws_col, p_winsize->ws_row);
}
break;
#endif /*RT_USING_POSIX*/
default :
/* control device */
ret = serial->ops->control(serial, cmd, args);