Today's implementation only return key state when there is a key.
But when user doesn't press any key, the key state cannot be
returned.
The patch changes the ReadKeyStrokeEx() to always return the
key state even there is no key pressed.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
/** @file\r
ConsoleOut Routines that speak VGA.\r
\r
/** @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
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
BiosKeyboardPrivate->StatusRegisterAddress = KEYBOARD_8042_STATUS_REGISTER;\r
BiosKeyboardPrivate->CommandRegisterAddress = KEYBOARD_8042_COMMAND_REGISTER;\r
BiosKeyboardPrivate->ExtendedKeyboard = TRUE;\r
BiosKeyboardPrivate->StatusRegisterAddress = KEYBOARD_8042_STATUS_REGISTER;\r
BiosKeyboardPrivate->CommandRegisterAddress = KEYBOARD_8042_COMMAND_REGISTER;\r
BiosKeyboardPrivate->ExtendedKeyboard = TRUE;\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
BiosKeyboardPrivate->Queue.Front = 0;\r
BiosKeyboardPrivate->Queue.Rear = 0;\r
BiosKeyboardPrivate->QueueForNotify.Front = 0;\r
//\r
Status = CheckQueue (&BiosKeyboardPrivate->Queue);\r
if (EFI_ERROR (Status)) {\r
//\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
gBS->RestoreTPL (OldTpl);\r
return EFI_NOT_READY;\r
}\r
}\r
\r
Enqueue (&BiosKeyboardPrivate->Queue, &KeyData);\r
}\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
//\r
// Leave critical section and return\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
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
UINT16 StatusRegisterAddress;\r
UINT16 CommandRegisterAddress;\r
BOOLEAN ExtendedKeyboard;\r
UINT16 StatusRegisterAddress;\r
UINT16 CommandRegisterAddress;\r
BOOLEAN ExtendedKeyboard;\r
+\r
+ EFI_KEY_STATE KeyState;\r
//\r
// Buffer storing EFI_KEY_DATA\r
//\r
//\r
// Buffer storing EFI_KEY_DATA\r
//\r