Merge pull request #4150 from mysterywolf/setwin
[ioctl] add TIOCSWINSZ
This commit is contained in:
commit
57ddea482f
|
@ -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>
|
||||
|
@ -1012,7 +1013,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
#ifdef RT_USING_POSIX
|
||||
#ifdef RT_USING_POSIX_TERMIOS
|
||||
case TCGETA:
|
||||
{
|
||||
|
@ -1104,8 +1105,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;
|
||||
|
@ -1118,7 +1118,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);
|
||||
|
|
Loading…
Reference in New Issue