Module Name:    src
Committed By:   jakllsch
Date:           Wed May 16 19:53:54 UTC 2018

Modified Files:
        src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
During awaitkey(), move the cursor back to the beginning of the
countdown with '\b' only after waiting.

Some UEFI implementations have a destructive/erasing backspace,
and will not show the countdown if we move the cursor back before the
wait.

My ThinkPad T430 w/ Lenovo's UEFI exhibited this whiteout-backspace,
while my Gigabyte Brix GB-BXBT-2807 did not.

Should fix PR #53292.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/eficons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.5 src/sys/arch/i386/stand/efiboot/eficons.c:1.6
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.5	Tue Mar 27 14:15:05 2018
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Wed May 16 19:53:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.5 2018/03/27 14:15:05 nonaka Exp $	*/
+/*	$NetBSD: eficons.c,v 1.6 2018/05/16 19:53:54 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <non...@netbsd.org>
@@ -328,10 +328,10 @@ awaitkey(int timeout, int tell)
 	char c = 0;
 
 	for (;;) {
-		if (tell && timeout) {
-			char numbuf[32];
-			int len;
+		char numbuf[32];
+		int len;
 
+		if (tell && timeout) {
 			len = snprintf(numbuf, sizeof(numbuf), "%d seconds. ",
 			    timeout);
 			if (len > 0 && len < sizeof(numbuf)) {
@@ -340,7 +340,6 @@ awaitkey(int timeout, int tell)
 				printf("%s", numbuf);
 				while (*p)
 					*p++ = '\b';
-				printf("%s", numbuf);
 			}
 		}
 		if (iskey(1)) {
@@ -355,6 +354,8 @@ awaitkey(int timeout, int tell)
 			internal_waitforinputevent(10000000);
 		else
 			break;
+		if (tell)
+			printf("%s", numbuf);
 	}
 
 out:

Reply via email to