The console driver now supports TIOCGWINSZ (getting the window size), and
"consoled" now uses this information to tell the TTY its size. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12355 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7c71cdd82d
commit
fce78d9e21
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <termios.h>
|
||||||
|
|
||||||
|
|
||||||
#define DEVICE_NAME "console"
|
#define DEVICE_NAME "console"
|
||||||
@ -705,6 +706,16 @@ console_write(void *cookie, off_t pos, const void *buffer, size_t *_length)
|
|||||||
static status_t
|
static status_t
|
||||||
console_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
|
console_ioctl(void *cookie, uint32 op, void *buffer, size_t length)
|
||||||
{
|
{
|
||||||
|
struct console_desc *console = (struct console_desc *)cookie;
|
||||||
|
|
||||||
|
if (op == TIOCGWINSZ) {
|
||||||
|
struct winsize size;
|
||||||
|
size.ws_xpixel = size.ws_col = console->columns;
|
||||||
|
size.ws_ypixel = size.ws_row = console->lines;
|
||||||
|
|
||||||
|
return user_memcpy(buffer, &size, sizeof(struct winsize));
|
||||||
|
}
|
||||||
|
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,6 +210,7 @@ start_console(struct console *con)
|
|||||||
} else {
|
} else {
|
||||||
// set default mode
|
// set default mode
|
||||||
struct termios termios;
|
struct termios termios;
|
||||||
|
struct winsize size;
|
||||||
|
|
||||||
if (tcgetattr(con->tty_slave_fd, &termios) == 0) {
|
if (tcgetattr(con->tty_slave_fd, &termios) == 0) {
|
||||||
termios.c_iflag = ICRNL;
|
termios.c_iflag = ICRNL;
|
||||||
@ -218,6 +219,11 @@ start_console(struct console *con)
|
|||||||
|
|
||||||
tcsetattr(con->tty_slave_fd, TCSANOW, &termios);
|
tcsetattr(con->tty_slave_fd, TCSANOW, &termios);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ioctl(con->console_fd, TIOCGWINSZ, &size, sizeof(struct winsize)) == 0) {
|
||||||
|
// we got the window size from the console
|
||||||
|
ioctl(con->tty_slave_fd, TIOCSWINSZ, &size, sizeof(struct winsize));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user