/** @file\r
-Copyright (c) 2004 - 2007, Intel Corporation\r
+Copyright (c) 2004 - 2008, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#include <PiDxe.h>\r
\r
#include <Protocol/SimpleTextIn.h>\r
-#include <Guid/HotPlugDevice.h>\r
+#include <Protocol/SimpleTextInEx.h>\r
+#include <Protocol/HiiDatabase.h>\r
#include <Protocol/UsbIo.h>\r
#include <Protocol/DevicePath.h>\r
+#include <Guid/HiiKeyBoardLayout.h>\r
+#include <Guid/HotPlugDevice.h>\r
\r
#include <Library/DebugLib.h>\r
#include <Library/ReportStatusCodeLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
#include <Library/PcdLib.h>\r
#include <Library/UsbLib.h>\r
-\r
+#include <Library/BaseLib.h>\r
\r
#include <IndustryStandard/Usb.h>\r
\r
} USB_KB_BUFFER;\r
\r
#define USB_KB_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'k', 'b', 'd')\r
+#define USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE EFI_SIGNATURE_32 ('u', 'k', 'b', 'x')\r
+\r
+typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r
+ UINTN Signature;\r
+ EFI_HANDLE NotifyHandle;\r
+ EFI_KEY_DATA KeyData;\r
+ EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;\r
+ LIST_ENTRY NotifyEntry;\r
+} KEYBOARD_CONSOLE_IN_EX_NOTIFY;\r
+\r
+#define USB_NS_KEY_SIGNATURE EFI_SIGNATURE_32 ('u', 'n', 's', 'k')\r
+\r
+typedef struct {\r
+ UINTN Signature;\r
+ LIST_ENTRY Link;\r
+\r
+ //\r
+ // The number of EFI_NS_KEY_MODIFIER children definitions\r
+ //\r
+ UINTN KeyCount;\r
+\r
+ //\r
+ // NsKey[0] : Non-spacing key\r
+ // NsKey[1] ~ NsKey[KeyCount] : Physical keys\r
+ //\r
+ EFI_KEY_DESCRIPTOR *NsKey;\r
+} USB_NS_KEY;\r
+\r
+#define USB_NS_KEY_FORM_FROM_LINK(a) CR (a, USB_NS_KEY, Link, USB_NS_KEY_SIGNATURE)\r
+\r
typedef struct {\r
UINTN Signature;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
EFI_EVENT DelayedRecoveryEvent;\r
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;\r
- EFI_USB_IO_PROTOCOL *UsbIo;\r
+ EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;\r
+ EFI_USB_IO_PROTOCOL *UsbIo;\r
\r
EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;\r
EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor;\r
EFI_EVENT RepeatTimer;\r
\r
EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
-\r
+ \r
+ UINT8 LeftCtrlOn;\r
+ UINT8 LeftAltOn;\r
+ UINT8 LeftShiftOn;\r
+ UINT8 LeftLogoOn;\r
+ UINT8 RightCtrlOn;\r
+ UINT8 RightAltOn;\r
+ UINT8 RightShiftOn;\r
+ UINT8 RightLogoOn; \r
+ UINT8 MenuKeyOn;\r
+ UINT8 SysReqOn;\r
+ UINT8 AltGrOn;\r
+\r
+ EFI_KEY_STATE KeyState;\r
+ //\r
+ // Notification function list\r
+ //\r
+ LIST_ENTRY NotifyList;\r
+\r
+ //\r
+ // Non-spacing key list\r
+ //\r
+ LIST_ENTRY NsKeyList;\r
+ USB_NS_KEY *CurrentNsKey;\r
+ EFI_KEY_DESCRIPTOR *KeyConvertionTable;\r
+ EFI_EVENT KeyboardLayoutEvent;\r
} USB_KB_DEV;\r
\r
//\r
extern EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponentName;\r
extern EFI_COMPONENT_NAME2_PROTOCOL gUsbKeyboardComponentName2;\r
extern EFI_GUID gEfiUsbKeyboardDriverGuid;\r
+extern EFI_GUID gSimpleTextInExNotifyGuid;\r
\r
VOID\r
KbdReportStatusCode (\r
\r
#define USB_KB_DEV_FROM_THIS(a) \\r
CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)\r
+#define TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS(a) \\r
+ CR(a, USB_KB_DEV, SimpleInputEx, USB_KB_DEV_SIGNATURE)\r
+\r
\r
#define MOD_CONTROL_L 0x01\r
#define MOD_CONTROL_R 0x10\r
UINT8 Key;\r
} KB_MODIFIER;\r
\r
-#define USB_KEYCODE_MAX_MAKE 0x64\r
+#define USB_KEYCODE_MAX_MAKE 0x62\r
\r
#define USBKBD_VALID_KEYCODE(key) ((UINT8) (key) > 3)\r
\r
UINT8 ScrollLock : 1;\r
UINT8 Resrvd : 5;\r
} LED_MAP;\r
+\r
+//\r
+// Simple Text Input Ex protocol functions\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+USBKeyboardResetEx (\r
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+ IN BOOLEAN ExtendedVerification\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Reset the input device and optionaly run diagnostics\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ ExtendedVerification - Driver may perform diagnostics on reset.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - The device was reset.\r
+ EFI_DEVICE_ERROR - The device is not functioning properly and could \r
+ not be reset.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+USBKeyboardReadKeyStrokeEx (\r
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+ OUT EFI_KEY_DATA *KeyData\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Reads the next keystroke from the input device. The WaitForKey Event can \r
+ be used to test for existance of a keystroke via WaitForEvent () call.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ KeyData - A pointer to a buffer that is filled in with the keystroke \r
+ state data for the key that was pressed.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - The keystroke information was returned.\r
+ EFI_NOT_READY - There was no keystroke data availiable.\r
+ EFI_DEVICE_ERROR - The keystroke information was not returned due to \r
+ hardware errors.\r
+ EFI_INVALID_PARAMETER - KeyData is NULL. \r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+USBKeyboardSetState (\r
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+ IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Set certain state for the input device.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the \r
+ state for the input device.\r
+ \r
+ Returns: \r
+ EFI_SUCCESS - The device state was set successfully.\r
+ EFI_DEVICE_ERROR - The device is not functioning correctly and could \r
+ not have the setting adjusted.\r
+ EFI_UNSUPPORTED - The device does not have the ability to set its state.\r
+ EFI_INVALID_PARAMETER - KeyToggleState is NULL. \r
+\r
+--*/ \r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+USBKeyboardRegisterKeyNotify (\r
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+ IN EFI_KEY_DATA *KeyData,\r
+ IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r
+ OUT EFI_HANDLE *NotifyHandle\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Register a notification function for a particular keystroke for the input device.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer.\r
+ KeyData - A pointer to a buffer that is filled in with the keystroke \r
+ information data for the key that was pressed.\r
+ KeyNotificationFunction - Points to the function to be called when the key \r
+ sequence is typed specified by KeyData. \r
+ NotifyHandle - Points to the unique handle assigned to the registered notification. \r
+\r
+ Returns:\r
+ EFI_SUCCESS - The notification function was registered successfully.\r
+ EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.\r
+ EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL. \r
+ \r
+--*/ \r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+USBKeyboardUnregisterKeyNotify (\r
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r
+ IN EFI_HANDLE NotificationHandle\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Remove a registered notification function from a particular keystroke.\r
+\r
+ Arguments:\r
+ This - Protocol instance pointer. \r
+ NotificationHandle - The handle of the notification function being unregistered.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - The notification function was unregistered successfully.\r
+ EFI_INVALID_PARAMETER - The NotificationHandle is invalid.\r
+ EFI_NOT_FOUND - Can not find the matching entry in database. \r
+ \r
+--*/ \r
+;\r
+\r
#endif\r
+\r