[U-Boot] [PATCH 2/2] sandbox: Don't disable ctrlc() on sandbox if in raw mode

Joe Hershberger joe.hershberger at ni.com
Tue Jul 3 01:06:49 UTC 2018


In raw mode, handle ctrl-c as normal. This allows normal ctrl-c behavior
such as aborting a command that is timing out without completely
terminating the sandbox executable.

In [1], Simon disabled this.  His reason for it was that it interferes
with piping test scripts. Piping should be done in cooked mode, so this
change should still not interfere.

[1] commit 8969ea3e9f2db04a6b3675 ("sandbox: Disable Ctrl-C")

Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>

---

 common/console.c         | 2 --
 drivers/serial/sandbox.c | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/console.c b/common/console.c
index 36c0568dbf..7aa58d0a63 100644
--- a/common/console.c
+++ b/common/console.c
@@ -604,7 +604,6 @@ static int ctrlc_disabled = 0;	/* see disable_ctrl() */
 static int ctrlc_was_pressed = 0;
 int ctrlc(void)
 {
-#ifndef CONFIG_SANDBOX
 	if (!ctrlc_disabled && gd->have_console) {
 		if (tstc()) {
 			switch (getc()) {
@@ -616,7 +615,6 @@ int ctrlc(void)
 			}
 		}
 	}
-#endif
 
 	return 0;
 }
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index d2e007284c..771f8f0a44 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -69,6 +69,9 @@ static int sandbox_serial_probe(struct udevice *dev)
 		os_tty_raw(0, state->term_raw == STATE_TERM_RAW_WITH_SIGS);
 	priv->start_of_line = 0;
 
+	if (state->term_raw != STATE_TERM_RAW)
+		disable_ctrlc(1);
+
 	return 0;
 }
 
-- 
2.11.0



More information about the U-Boot mailing list