update serial

This commit is contained in:
Meco Man 2021-01-01 17:07:11 +08:00
parent 11fc8d27c1
commit a940728162
1 changed files with 11 additions and 9 deletions

View File

@ -133,7 +133,7 @@ static int serial_fops_read(struct dfs_fd *fd, void *buf, size_t count)
do do
{ {
size = rt_device_read(device, -1, buf, count); size = rt_device_read(device, -1, buf, count);
if (size <= 0) if (size <= 0)
{ {
if (fd->flags & O_NONBLOCK) if (fd->flags & O_NONBLOCK)
@ -1105,6 +1105,16 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
break; break;
case TCXONC: case TCXONC:
break; break;
case TIOCSWINSZ:
{
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;
#endif /*RT_USING_POSIX_TERMIOS*/ #endif /*RT_USING_POSIX_TERMIOS*/
case FIONREAD: case FIONREAD:
{ {
@ -1118,14 +1128,6 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
*(rt_size_t *)args = recved; *(rt_size_t *)args = recved;
} }
break; break;
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*/ #endif /*RT_USING_POSIX*/
default : default :
/* control device */ /* control device */