kboot: Make console raw when we start
Put the console into raw mode on startup. This allows the menus to work as expected. Boot is now interruptable. Note: Likely should restore the terminal settings on most exists. It's not clear the best way to do this, and most shells have an auto stty sane anyway, so note it for future improvement. Sponsored by: Netflix
This commit is contained in:
parent
963037786f
commit
9579540144
@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "bootstrap.h"
|
#include "bootstrap.h"
|
||||||
#include "host_syscall.h"
|
#include "host_syscall.h"
|
||||||
|
#include "termios.h"
|
||||||
|
|
||||||
static void hostcons_probe(struct console *cp);
|
static void hostcons_probe(struct console *cp);
|
||||||
static int hostcons_init(int arg);
|
static int hostcons_init(int arg);
|
||||||
@ -47,6 +48,8 @@ struct console hostconsole = {
|
|||||||
hostcons_poll,
|
hostcons_poll,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct host_termios old_settings;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hostcons_probe(struct console *cp)
|
hostcons_probe(struct console *cp)
|
||||||
{
|
{
|
||||||
@ -57,9 +60,12 @@ hostcons_probe(struct console *cp)
|
|||||||
static int
|
static int
|
||||||
hostcons_init(int arg)
|
hostcons_init(int arg)
|
||||||
{
|
{
|
||||||
|
struct host_termios new_settings;
|
||||||
|
|
||||||
/* XXX: set nonblocking */
|
host_tcgetattr(0, &old_settings);
|
||||||
/* tcsetattr(~(ICANON | ECHO)) */
|
new_settings = old_settings;
|
||||||
|
host_cfmakeraw(&new_settings);
|
||||||
|
host_tcsetattr(0, HOST_TCSANOW, &new_settings);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -94,4 +100,3 @@ hostcons_poll()
|
|||||||
ret = host_select(32, &fds, NULL, NULL, &tv);
|
ret = host_select(32, &fds, NULL, NULL, &tv);
|
||||||
return (ret > 0);
|
return (ret > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user