sandbox: Allow Ctrl-C to work in sandbox
It is useful for Cltl-C to be handled by U-Boot as it is on other boards.
But it is also useful to be able to terminate U-Boot with Ctrl-C.
Add an option to enable signals while in raw mode, and make this the
default. Add an option to leave the terminal cooked, which is useful for
redirecting output.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index c27b5b8..51fd871 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -15,6 +15,7 @@
#include <os.h>
#include <serial.h>
#include <linux/compiler.h>
+#include <asm/state.h>
/*
*
@@ -31,7 +32,10 @@
static int sandbox_serial_init(void)
{
- os_tty_raw(0);
+ struct sandbox_state *state = state_get_current();
+
+ if (state->term_raw != STATE_TERM_COOKED)
+ os_tty_raw(0, state->term_raw == STATE_TERM_RAW_WITH_SIGS);
return 0;
}