IN EFI_HANDLE *ChildHandleBuffer\r
);\r
\r
-//\r
-// Global variables\r
-//\r
+STATIC\r
+EFI_STATUS\r
+KbdFreeNotifyList (\r
+ IN OUT LIST_ENTRY *ListHead\r
+ ); \r
+\r
//\r
// DriverBinding Protocol Instance\r
//\r
ConsoleIn->Alted = FALSE;\r
ConsoleIn->DevicePath = ParentDevicePath;\r
\r
+ ConsoleIn->ConInEx.Reset = KeyboardEfiResetEx;\r
+ ConsoleIn->ConInEx.ReadKeyStrokeEx = KeyboardReadKeyStrokeEx;\r
+ ConsoleIn->ConInEx.SetState = KeyboardSetState;\r
+ ConsoleIn->ConInEx.RegisterKeyNotify = KeyboardRegisterKeyNotify;\r
+ ConsoleIn->ConInEx.UnregisterKeyNotify = KeyboardUnregisterKeyNotify; \r
+ \r
+ InitializeListHead (&ConsoleIn->NotifyList);\r
//\r
// Setup the WaitForKey event\r
//\r
goto ErrorExit;\r
}\r
//\r
+ // Setup the WaitForKeyEx event\r
+ // \r
+ Status = gBS->CreateEvent (\r
+ EVT_NOTIFY_WAIT,\r
+ TPL_NOTIFY,\r
+ KeyboardWaitForKeyEx,\r
+ &(ConsoleIn->ConInEx),\r
+ &(ConsoleIn->ConInEx.WaitForKeyEx)\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ StatusCode = EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_CONTROLLER_ERROR;\r
+ goto ErrorExit;\r
+ }\r
// Setup a periodic timer, used for reading keystrokes at a fixed interval\r
//\r
Status = gBS->CreateEvent (\r
&Controller,\r
&gEfiSimpleTextInProtocolGuid,\r
&ConsoleIn->ConIn,\r
+ &gEfiSimpleTextInputExProtocolGuid,\r
+ &ConsoleIn->ConInEx,\r
NULL\r
);\r
if (EFI_ERROR (Status)) {\r
if ((ConsoleIn != NULL) && (ConsoleIn->TimerEvent != NULL)) {\r
gBS->CloseEvent (ConsoleIn->TimerEvent);\r
}\r
-\r
+ if ((ConsoleIn != NULL) && (ConsoleIn->ConInEx.WaitForKeyEx != NULL)) {\r
+ gBS->CloseEvent (ConsoleIn->ConInEx.WaitForKeyEx);\r
+ }\r
+ KbdFreeNotifyList (&ConsoleIn->NotifyList);\r
if ((ConsoleIn != NULL) && (ConsoleIn->ControllerNameTable != NULL)) {\r
FreeUnicodeStringTable (ConsoleIn->ControllerNameTable);\r
}\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
-\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiSimpleTextInputExProtocolGuid,\r
+ NULL,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ \r
ConsoleIn = KEYBOARD_CONSOLE_IN_DEV_FROM_THIS (ConIn);\r
\r
//\r
Status = KeyboardRead (ConsoleIn, &Data);;\r
}\r
//\r
- // Uninstall the Simple TextIn Protocol\r
+ // Uninstall the SimpleTextIn and SimpleTextInEx protocols\r
//\r
- Status = gBS->UninstallProtocolInterface (\r
+ Status = gBS->UninstallMultipleProtocolInterfaces (\r
Controller,\r
&gEfiSimpleTextInProtocolGuid,\r
- &ConsoleIn->ConIn\r
+ &ConsoleIn->ConIn,\r
+ &gEfiSimpleTextInputExProtocolGuid,\r
+ &ConsoleIn->ConInEx,\r
+ NULL\r
);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
gBS->CloseEvent ((ConsoleIn->ConIn).WaitForKey);\r
(ConsoleIn->ConIn).WaitForKey = NULL;\r
}\r
-\r
+ if (ConsoleIn->ConInEx.WaitForKeyEx != NULL) {\r
+ gBS->CloseEvent (ConsoleIn->ConInEx.WaitForKeyEx);\r
+ ConsoleIn->ConInEx.WaitForKeyEx = NULL;\r
+ }\r
+ KbdFreeNotifyList (&ConsoleIn->NotifyList);\r
FreeUnicodeStringTable (ConsoleIn->ControllerNameTable);\r
gBS->FreePool (ConsoleIn);\r
\r
return EFI_SUCCESS;\r
}\r
\r
+STATIC\r
+EFI_STATUS\r
+KbdFreeNotifyList (\r
+ IN OUT LIST_ENTRY *ListHead\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+Arguments:\r
+\r
+ ListHead - The list head\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - Free the notify list successfully\r
+ EFI_INVALID_PARAMETER - ListHead is invalid.\r
+\r
+--*/\r
+{\r
+ KEYBOARD_CONSOLE_IN_EX_NOTIFY *NotifyNode;\r
+\r
+ if (ListHead == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ while (!IsListEmpty (ListHead)) {\r
+ NotifyNode = CR (\r
+ ListHead->ForwardLink, \r
+ KEYBOARD_CONSOLE_IN_EX_NOTIFY, \r
+ NotifyEntry, \r
+ KEYBOARD_CONSOLE_IN_EX_NOTIFY_SIGNATURE\r
+ );\r
+ RemoveEntryList (ListHead->ForwardLink);\r
+ gBS->FreePool (NotifyNode);\r
+ }\r
+ \r
+ return EFI_SUCCESS;\r
+}\r
\r
/**\r
The user Entry Point for module Ps2Keyboard. The user code starts with this function.\r