/** @file\r
Helper functions for USB Keyboard Driver.\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
UINT8 KeyCode;\r
\r
UsbKeyboardDevice = (USB_KB_DEV *) Context;\r
+ if (UsbKeyboardDevice->Signature != USB_KB_DEV_SIGNATURE) {\r
+ return;\r
+ }\r
\r
//\r
// Try to get current keyboard layout from HII database\r
IN OUT USB_KB_DEV *UsbKeyboardDevice\r
)\r
{\r
- UINT8 ConfigValue;\r
+ UINT16 ConfigValue;\r
UINT8 Protocol;\r
UINT8 ReportId;\r
UINT8 Duration;\r
\r
REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
EFI_PROGRESS_CODE,\r
- PcdGet32 (PcdStatusCodeValueKeyboardSelfTest),\r
+ (EFI_PERIPHERAL_KEYBOARD | EFI_P_KEYBOARD_PC_SELF_TEST),\r
UsbKeyboardDevice->DevicePath\r
);\r
\r
InitUSBKeyBuffer (&(UsbKeyboardDevice->KeyboardBuffer));\r
\r
//\r
- // Uses default configuration to configure the USB keyboard device.\r
+ // Use the config out of the descriptor\r
+ // Assumed the first config is the correct one and this is not always the case\r
+ //\r
+ Status = UsbGetConfiguration (\r
+ UsbKeyboardDevice->UsbIo, \r
+ &ConfigValue, \r
+ &TransferResult\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ConfigValue = 0x01;\r
+ }\r
+ \r
+ //\r
+ // Uses default configuration to configure the USB Keyboard device.\r
//\r
- ConfigValue = 0x01;\r
Status = UsbSetConfiguration (\r
UsbKeyboardDevice->UsbIo,\r
- (UINT16) ConfigValue,\r
+ ConfigValue,\r
&TransferResult\r
);\r
if (EFI_ERROR (Status)) {\r
//\r
REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
- PcdGet32 (PcdStatusCodeValueKeyboardInterfaceError),\r
+ (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR),\r
UsbKeyboardDevice->DevicePath\r
);\r
\r
\r
gBS->CreateEvent (\r
EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
- TPL_NOTIFY,\r
+ TPL_CALLBACK,\r
USBKeyboardRepeatHandler,\r
UsbKeyboardDevice,\r
&UsbKeyboardDevice->RepeatTimer\r
//\r
REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
- PcdGet32 (PcdStatusCodeValueKeyboardInputError),\r
+ (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INPUT_ERROR),\r
UsbKeyboardDevice->DevicePath\r
);\r
\r