tint: make it possible to reboot by pressing 'q' key two times

Earlier it was impossible to exit without pressing the power button.

Change-Id: Ia56d639fa8e563047fb3d2723695626a449ead40
Signed-off-by: Mike Banon <mikebdp2@gmail.com>
Reviewed-on: https://review.coreboot.org/23853
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Mike Banon 2018-02-23 19:32:15 +03:00 committed by Patrick Georgi
parent 4bdfebd4d8
commit f8b54b6315
1 changed files with 14 additions and 3 deletions

View File

@ -376,7 +376,7 @@ diff -rupN tint-0.04+nmu1/tint.c tint/tint.c
rand_init (); /* must be called before engine_init () */
engine_init (&engine,score_function); /* must be called before using engine.curshape */
finished = shownext = FALSE;
@@ -673,11 +692,20 @@ int main (int argc,char *argv[])
@@ -673,11 +692,31 @@ int main (int argc,char *argv[])
/* Restore console settings and exit */
io_close ();
+#if 0
@ -389,9 +389,20 @@ diff -rupN tint-0.04+nmu1/tint.c tint/tint.c
savescores (GETSCORE (engine.score));
}
+#endif
+ printf("Bye.\n");
+ printf("Press 'q' to reboot...\n");
+ refresh();
+ for(;;); //halt();
+ for (;;) {
+ in_flush ();
+ while ((ch = in_getch ()) == ERR) ; /* Wait for a key to be pressed */
+ if (ch == 'q') { /* reboot */
+ outb(0x6, 0xcf9);
+ for(;;); //halt();
+ }
+ else {
+ in_flush ();
+ }
+ }
+
+#if 0
exit (EXIT_SUCCESS);
+#endif