Date: Wed, 4 Dec 2002 18:56:28 -0800 (PST) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 21948 for review Message-ID: <200212050256.gB52uS97022264@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=21948 Change 21948 by marcel@marcel_nfs on 2002/12/04 18:55:42 Fix the "lost key" bug. When efi_cons_poll() is called to check for any pending key strokes, the signaled state of the event we are checking is cleared as a side-effect. The key stroke is still pending though. When efi_cons_getchar() is called to get the key stroke, we used to check if there's a signaled event indicating a pending keystroke. Calling efi_cons_getchar() after efi_cons_poll() would cause us to wait for a key stroke when there's already one present. The fix is to get a key stroke without checking for the event and if none is pending, wait for the event to signal the arrival of a key stroke after which we get it. Affected files ... .. //depot/projects/ia64/sys/boot/efi/libefi/efi_console.c#2 edit Differences ... ==== //depot/projects/ia64/sys/boot/efi/libefi/efi_console.c#2 (text+ko) ==== @@ -69,17 +69,23 @@ efi_cons_getchar() { EFI_INPUT_KEY key; + EFI_STATUS status; UINTN junk; - BS->WaitForEvent(1, &conin->WaitForKey, &junk); - conin->ReadKeyStroke(conin, &key); - return key.UnicodeChar; + /* Try to read a key stroke. We wait for one if none is pending. */ + status = conin->ReadKeyStroke(conin, &key); + if (status == EFI_NOT_READY) { + BS->WaitForEvent(1, &conin->WaitForKey, &junk); + status = conin->ReadKeyStroke(conin, &key); + } + return (key.UnicodeChar); } int efi_cons_poll() { - return BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS; + /* This can clear the signaled state. */ + return (BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS); } struct console efi_console = { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212050256.gB52uS97022264>