From owner-p4-projects Wed Dec 4 19: 0:50 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BE43B37B404; Wed, 4 Dec 2002 19:00:48 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5083A37B401 for ; Wed, 4 Dec 2002 19:00:48 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3AC6C43ECD for ; Wed, 4 Dec 2002 19:00:47 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gB52uTmV022270 for ; Wed, 4 Dec 2002 18:56:29 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gB52uS97022264 for perforce@freebsd.org; Wed, 4 Dec 2002 18:56:28 -0800 (PST) Date: Wed, 4 Dec 2002 18:56:28 -0800 (PST) Message-Id: <200212050256.gB52uS97022264@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar Subject: PERFORCE change 21948 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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