+/**\r
+ Initialize the key state.\r
+\r
+ @param UsbKeyboardDevice The USB_KB_DEV instance.\r
+ @param KeyState A pointer to receive the key state information.\r
+**/\r
+VOID\r
+InitializeKeyState (\r
+ IN USB_KB_DEV *UsbKeyboardDevice,\r
+ OUT EFI_KEY_STATE *KeyState\r
+ )\r
+{\r
+ KeyState->KeyShiftState = EFI_SHIFT_STATE_VALID;\r
+ KeyState->KeyToggleState = EFI_TOGGLE_STATE_VALID;\r
+\r
+ if (UsbKeyboardDevice->LeftCtrlOn) {\r
+ KeyState->KeyShiftState |= EFI_LEFT_CONTROL_PRESSED;\r
+ }\r
+ if (UsbKeyboardDevice->RightCtrlOn) {\r
+ KeyState->KeyShiftState |= EFI_RIGHT_CONTROL_PRESSED;\r
+ }\r
+ if (UsbKeyboardDevice->LeftAltOn) {\r
+ KeyState->KeyShiftState |= EFI_LEFT_ALT_PRESSED;\r
+ }\r
+ if (UsbKeyboardDevice->RightAltOn) {\r
+ KeyState->KeyShiftState |= EFI_RIGHT_ALT_PRESSED;\r
+ }\r
+ if (UsbKeyboardDevice->LeftShiftOn) {\r
+ KeyState->KeyShiftState |= EFI_LEFT_SHIFT_PRESSED;\r
+ }\r
+ if (UsbKeyboardDevice->RightShiftOn) {\r
+ KeyState->KeyShiftState |= EFI_RIGHT_SHIFT_PRESSED;\r
+ }\r
+ if (UsbKeyboardDevice->LeftLogoOn) {\r
+ KeyState->KeyShiftState |= EFI_LEFT_LOGO_PRESSED;\r
+ }\r
+ if (UsbKeyboardDevice->RightLogoOn) {\r
+ KeyState->KeyShiftState |= EFI_RIGHT_LOGO_PRESSED;\r
+ }\r
+ if (UsbKeyboardDevice->MenuKeyOn) {\r
+ KeyState->KeyShiftState |= EFI_MENU_KEY_PRESSED;\r
+ }\r
+ if (UsbKeyboardDevice->SysReqOn) {\r
+ KeyState->KeyShiftState |= EFI_SYS_REQ_PRESSED;\r
+ }\r
+\r
+ if (UsbKeyboardDevice->ScrollOn) {\r
+ KeyState->KeyToggleState |= EFI_SCROLL_LOCK_ACTIVE;\r
+ }\r
+ if (UsbKeyboardDevice->NumLockOn) {\r
+ KeyState->KeyToggleState |= EFI_NUM_LOCK_ACTIVE;\r
+ }\r
+ if (UsbKeyboardDevice->CapsOn) {\r
+ KeyState->KeyToggleState |= EFI_CAPS_LOCK_ACTIVE;\r
+ }\r
+ if (UsbKeyboardDevice->IsSupportPartialKey) {\r
+ KeyState->KeyToggleState |= EFI_KEY_STATE_EXPOSED;\r
+ }\r
+}\r