Skip to content

Commit d7595d5

Browse files
authored
Merge pull request #4437 from mysterywolf/getsize
[ioctl] 增加TIOCGWINSZ功能
2 parents 47e7999 + 0c9bcef commit d7595d5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

components/drivers/serial/serial.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,9 +1113,19 @@ static rt_err_t rt_serial_control(struct rt_device *dev,
11131113
struct winsize* p_winsize;
11141114

11151115
p_winsize = (struct winsize*)args;
1116-
rt_enter_critical();
11171116
rt_kprintf("\x1b[8;%d;%dt", p_winsize->ws_col, p_winsize->ws_row);
1118-
rt_exit_critical();
1117+
}
1118+
break;
1119+
case TIOCGWINSZ:
1120+
{
1121+
struct winsize* p_winsize;
1122+
1123+
p_winsize = (struct winsize*)args;
1124+
/* TODO: get windows size from console */
1125+
p_winsize->ws_col = 80;
1126+
p_winsize->ws_row = 24;
1127+
p_winsize->ws_xpixel = 0;/*unused*/
1128+
p_winsize->ws_ypixel = 0;/*unused*/
11191129
}
11201130
break;
11211131
#endif /*RT_USING_POSIX_TERMIOS*/

0 commit comments

Comments
 (0)