USB Keyboard Driver that manages USB keyboard and produces Simple Text Input\r
Protocol and Simple Text Input Ex Protocol.\r
\r
-Copyright (c) 2004 - 2008, Intel Corporation\r
+Copyright (c) 2004 - 2010, 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
//\r
REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
EFI_PROGRESS_CODE,\r
- PcdGet32 (PcdStatusCodeValueKeyboardEnable),\r
+ (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_ENABLE),\r
UsbKeyboardDevice->DevicePath\r
);\r
\r
//\r
REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
EFI_PROGRESS_CODE,\r
- PcdGet32 (PcdStatusCodeValueKeyboardPresenceDetect),\r
+ (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_PRESENCE_DETECT),\r
UsbKeyboardDevice->DevicePath\r
);\r
\r
UsbKeyboardDevice->SimpleInputEx.ReadKeyStrokeEx = USBKeyboardReadKeyStrokeEx;\r
UsbKeyboardDevice->SimpleInputEx.SetState = USBKeyboardSetState;\r
UsbKeyboardDevice->SimpleInputEx.RegisterKeyNotify = USBKeyboardRegisterKeyNotify;\r
- UsbKeyboardDevice->SimpleInputEx.UnregisterKeyNotify = USBKeyboardUnregisterKeyNotify; \r
+ UsbKeyboardDevice->SimpleInputEx.UnregisterKeyNotify = USBKeyboardUnregisterKeyNotify;\r
\r
InitializeListHead (&UsbKeyboardDevice->NotifyList);\r
\r
UsbKeyboardDevice,\r
&(UsbKeyboardDevice->SimpleInput.WaitForKey)\r
);\r
-\r
- if (EFI_ERROR (Status)) {\r
- goto ErrorExit;\r
- }\r
-\r
- Status = InitKeyboardLayout (UsbKeyboardDevice);\r
if (EFI_ERROR (Status)) {\r
goto ErrorExit;\r
}\r
goto ErrorExit;\r
}\r
\r
+ UsbKeyboardDevice->ControllerHandle = Controller;\r
+ Status = InitKeyboardLayout (UsbKeyboardDevice);\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->UninstallMultipleProtocolInterfaces (\r
+ Controller,\r
+ &gEfiSimpleTextInProtocolGuid,\r
+ &UsbKeyboardDevice->SimpleInput,\r
+ &gEfiSimpleTextInputExProtocolGuid,\r
+ &UsbKeyboardDevice->SimpleInputEx,\r
+ NULL\r
+ );\r
+ goto ErrorExit;\r
+ }\r
+\r
+\r
//\r
// Reset USB Keyboard Device exhaustively.\r
//\r
if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {\r
gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);\r
}\r
+ if (UsbKeyboardDevice->KeyboardLayoutEvent != NULL) {\r
+ gBS->CloseEvent (UsbKeyboardDevice->KeyboardLayoutEvent);\r
+ }\r
+ if (UsbKeyboardDevice->KeyConvertionTable != NULL) {\r
+ FreePool (UsbKeyboardDevice->KeyConvertionTable);\r
+ }\r
FreePool (UsbKeyboardDevice);\r
UsbKeyboardDevice = NULL;\r
}\r
//\r
REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
EFI_PROGRESS_CODE,\r
- PcdGet32 (PcdStatusCodeValueKeyboardDisable),\r
+ (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_DISABLE),\r
UsbKeyboardDevice->DevicePath\r
);\r
\r
\r
REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
EFI_PROGRESS_CODE,\r
- PcdGet32 (PcdStatusCodeValueKeyboardReset),\r
+ (EFI_PERIPHERAL_KEYBOARD | EFI_P_PC_RESET),\r
UsbKeyboardDevice->DevicePath\r
);\r
\r
if (!ExtendedVerification) {\r
REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
EFI_PROGRESS_CODE,\r
- PcdGet32 (PcdStatusCodeValueKeyboardClearBuffer),\r
+ (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_CLEAR_BUFFER),\r
UsbKeyboardDevice->DevicePath\r
);\r
//\r
\r
@retval EFI_SUCCESS The notification function was unregistered successfully.\r
@retval EFI_INVALID_PARAMETER The NotificationHandle is invalid\r
- @retval EFI_NOT_FOUND Cannot find the matching entry in database.\r
\r
**/\r
EFI_STATUS\r
if (NotificationHandle == NULL) {\r
return EFI_INVALID_PARAMETER;\r
} \r
+\r
+ if (((KEYBOARD_CONSOLE_IN_EX_NOTIFY *) NotificationHandle)->Signature != USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE) {\r
+ return EFI_INVALID_PARAMETER;\r
+ } \r
\r
UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This);\r
\r
}\r
}\r
\r
- return EFI_NOT_FOUND; \r
+ //\r
+ // Cannot find the matching entry in database.\r
+ //\r
+ return EFI_INVALID_PARAMETER; \r
}\r
\r