]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c
IntelFrameworkModule/ThunkKb: ReadKeyStrokeEx always return key state
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / BiosThunk / KeyboardDxe / BiosKeyboard.c
index ec525891dc7a5659af89d1151a008ee1cc84fd4f..ac8e2364c8f48319aa0f782695e894a0db672ee3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   ConsoleOut Routines that speak VGA.\r
 \r
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -269,7 +269,9 @@ BiosKeyboardDriverBindingStart (
   BiosKeyboardPrivate->StatusRegisterAddress      = KEYBOARD_8042_STATUS_REGISTER;\r
   BiosKeyboardPrivate->CommandRegisterAddress     = KEYBOARD_8042_COMMAND_REGISTER;\r
   BiosKeyboardPrivate->ExtendedKeyboard           = TRUE;\r
-  \r
+\r
+  BiosKeyboardPrivate->KeyState.KeyShiftState     = 0;\r
+  BiosKeyboardPrivate->KeyState.KeyToggleState    = 0;\r
   BiosKeyboardPrivate->Queue.Front                = 0;\r
   BiosKeyboardPrivate->Queue.Rear                 = 0;\r
   BiosKeyboardPrivate->QueueForNotify.Front       = 0;\r
@@ -978,6 +980,8 @@ KeyboardReadKeyStrokeWorker (
   //\r
   Status = CheckQueue (&BiosKeyboardPrivate->Queue);\r
   if (EFI_ERROR (Status)) {\r
+    ZeroMem (&KeyData->Key, sizeof (KeyData->Key));\r
+    CopyMem (&KeyData->KeyState, &BiosKeyboardPrivate->KeyState, sizeof (EFI_KEY_STATE));\r
     gBS->RestoreTPL (OldTpl);\r
     return EFI_NOT_READY;\r
   }\r
@@ -1986,6 +1990,12 @@ BiosKeyboardTimerHandler (
   }\r
 \r
   Enqueue (&BiosKeyboardPrivate->Queue, &KeyData);\r
+\r
+  //\r
+  // Save the current key state\r
+  //\r
+  CopyMem (&BiosKeyboardPrivate->KeyState, &KeyData.KeyState, sizeof (EFI_KEY_STATE));\r
+\r
   //\r
   // Leave critical section and return\r
   //\r