diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-09-14 15:37:46 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-14 16:11:36 +0200 |
commit | 7d8af896c7c660a8608abe5efa82b52e9d9f097c (patch) | |
tree | 77d5a4c3db72d2fc97829f109768e4e91f1bb73a /arch/sandbox/board/poweroff.c | |
parent | b81ff979a72b427ce4fc4c00c8aab2a302af41a8 (diff) | |
download | barebox-7d8af896c7c660a8608abe5efa82b52e9d9f097c.tar.gz barebox-7d8af896c7c660a8608abe5efa82b52e9d9f097c.tar.xz |
sandbox: implement simple, ^C-interruptible, restart handler
Typing reset in sandbox results in hang() while the terminal is not
cooked and ^C is ineffective. Only way to terminate barebox then is
via kill. Reinstate cooked mode on reset, so ^C termination is
possible.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/board/poweroff.c')
-rw-r--r-- | arch/sandbox/board/poweroff.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/sandbox/board/poweroff.c b/arch/sandbox/board/poweroff.c index 6b5a6dff15..5072b756e1 100644 --- a/arch/sandbox/board/poweroff.c +++ b/arch/sandbox/board/poweroff.c @@ -1,6 +1,7 @@ #include <common.h> #include <init.h> #include <poweroff.h> +#include <restart.h> #include <mach/linux.h> static void sandbox_poweroff(struct poweroff_handler *poweroff) @@ -8,9 +9,20 @@ static void sandbox_poweroff(struct poweroff_handler *poweroff) linux_exit(); } +static void sandbox_rst_hang(struct restart_handler *rst) +{ + linux_hang(); +} + +static struct restart_handler rst_hang = { + .name = "hang", + .restart = sandbox_rst_hang +}; + static int poweroff_register_feature(void) { poweroff_handler_register_fn(sandbox_poweroff); + restart_handler_register(&rst_hang); return 0; } |