On 27/03/14 08:36, Peter Pickford wrote:
The arrow keys would not work in my ipxe serial console.

The following seems to fix it but causes a busy wait while reading
escape sequences.

<snip>

Arrow keys over serial works for me. Could you try the attached (untested) patch, which preserves the cpu_nap() while changing the ordering of events such that a keypress arriving during the cpu_nap() will be detected even if the timeout has expired?

Thanks,

Michael
diff --git a/src/core/getkey.c b/src/core/getkey.c
index d69cfb4..725239e 100644
--- a/src/core/getkey.c
+++ b/src/core/getkey.c
@@ -43,14 +43,14 @@ FILE_LICENCE ( GPL2_OR_LATER );
 static int getchar_timeout ( unsigned long timeout ) {
 	unsigned long start = currticks();
 
-	while ( ( timeout == 0 ) || ( ( currticks() - start ) < timeout ) ) {
-		step();
+	while ( 1 ) {
 		if ( iskey() )
 			return getchar();
+		if ( timeout && ( ( currticks() - start ) > timeout ) )
+			return -1;
+		step();
 		cpu_nap();
 	}
-
-	return -1;
 }
 
 /**
_______________________________________________
ipxe-devel mailing list
[email protected]
https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel

Reply via email to