From 120c8066042f09d347ffa8b520bf8af96e1cc257 Mon Sep 17 00:00:00 2001 From: Download-Fritz Date: Sun, 3 Nov 2019 21:34:36 +0100 Subject: [PATCH] OcBootManagementLib: Fix key polling issue with PollAppleHotKeys=true --- .../OcBootManagementLib/OcBootManagementLib.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Library/OcBootManagementLib/OcBootManagementLib.c b/Library/OcBootManagementLib/OcBootManagementLib.c index 4f84a6f3..20c8e7e4 100644 --- a/Library/OcBootManagementLib/OcBootManagementLib.c +++ b/Library/OcBootManagementLib/OcBootManagementLib.c @@ -977,23 +977,23 @@ OcWaitForAppleKeyIndex ( return OC_INPUT_INVALID; } - NumKeys = ARRAY_SIZE (Keys); - Status = KeyMap->GetKeyStrokes ( - KeyMap, - &Modifiers, - &NumKeys, - Keys - ); - - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "OCB: GetKeyStrokes - %r\n", Status)); - return OC_INPUT_INVALID; - } - CurrTime = GetTimeInNanoSecond (GetPerformanceCounter ()); EndTime = CurrTime + Timeout * 1000000000ULL; while (Timeout == 0 || CurrTime == 0 || CurrTime < EndTime) { + NumKeys = ARRAY_SIZE (Keys); + Status = KeyMap->GetKeyStrokes ( + KeyMap, + &Modifiers, + &NumKeys, + Keys + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "OCB: GetKeyStrokes - %r\n", Status)); + return OC_INPUT_INVALID; + } + CurrTime = GetTimeInNanoSecond (GetPerformanceCounter ()); HasCommand = (Modifiers & (APPLE_MODIFIER_LEFT_COMMAND | APPLE_MODIFIER_RIGHT_COMMAND)) != 0;