mirror of https://github.com/acidanthera/audk.git
modify coding style to pass ecc tool
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5551 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
68077ae338
commit
a7022cec4e
|
@ -1,6 +1,8 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2004 - 2007, Intel Corporation
|
UEFI Component Name(2) protocol implementation for Usb Keyboard driver.
|
||||||
|
|
||||||
|
Copyright (c) 2004 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -9,17 +11,10 @@ http://opensource.org/licenses/bsd-license.php
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
ComponentName.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
#include "keyboard.h"
|
#include "KeyBoard.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// EFI Component Name Functions
|
// EFI Component Name Functions
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
|
USB Keyboard Driver that includes the implementation of interface.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2008, Intel Corporation
|
Copyright (c) 2004 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -9,26 +11,21 @@ http://opensource.org/licenses/bsd-license.php
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
EfiKey.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
USB Keyboard Driver
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "efikey.h"
|
#include "EfiKey.h"
|
||||||
#include "keyboard.h"
|
#include "KeyBoard.h"
|
||||||
|
|
||||||
//
|
/**
|
||||||
// Prototypes
|
The Usb Keyboard Driver Entry Point.
|
||||||
// Driver model protocol interface
|
|
||||||
//
|
@param ImageHandle The driver image handle.
|
||||||
|
@param SystemTable The system table.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS The component name protocol is installed.
|
||||||
|
@return Others Failed to install.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardDriverBindingEntryPoint (
|
USBKeyboardDriverBindingEntryPoint (
|
||||||
|
@ -36,6 +33,16 @@ USBKeyboardDriverBindingEntryPoint (
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check whether USB keyboard driver support this device.
|
||||||
|
|
||||||
|
@param This The USB keyboard driver binding protocol.
|
||||||
|
@param Controller The controller handle to check.
|
||||||
|
@param RemainingDevicePath The remaining device path.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The driver supports this controller.
|
||||||
|
@retval EFI_UNSUPPORTED This device isn't supported.
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardDriverBindingSupported (
|
USBKeyboardDriverBindingSupported (
|
||||||
|
@ -44,6 +51,17 @@ USBKeyboardDriverBindingSupported (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Start running driver on the controller.
|
||||||
|
|
||||||
|
@param This The USB keyboard driver binding instance.
|
||||||
|
@param Controller The controller to check.
|
||||||
|
@param RemainingDevicePath The remaining device patch.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The controller is controlled by the usb keyboard driver.
|
||||||
|
@return Other The keyboard driver doesn't support this controller.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardDriverBindingStart (
|
USBKeyboardDriverBindingStart (
|
||||||
|
@ -52,6 +70,18 @@ USBKeyboardDriverBindingStart (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Stop handle the controller by this USB keyboard driver.
|
||||||
|
|
||||||
|
@param This The USB keyboard driver binding protocol.
|
||||||
|
@param Controller The controller to release.
|
||||||
|
@param NumberOfChildren The number of handles in ChildHandleBuffer.
|
||||||
|
@param ChildHandleBuffer The array of child handle.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The controller or children are stopped.
|
||||||
|
@retval EFI_DEVICE_ERROR Failed to stop the driver.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardDriverBindingStop (
|
USBKeyboardDriverBindingStop (
|
||||||
|
@ -61,10 +91,16 @@ USBKeyboardDriverBindingStop (
|
||||||
IN EFI_HANDLE *ChildHandleBuffer
|
IN EFI_HANDLE *ChildHandleBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
/**
|
||||||
// Simple Text In Protocol Interface
|
Reset Usb Keyboard.
|
||||||
//
|
|
||||||
STATIC
|
@param This The protocol instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL.
|
||||||
|
@param ExtendedVerification Whether completely reset keyboard or not.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Reset keyboard successfully.
|
||||||
|
@retval EFI_DEVICE_ERROR Reset keyboard failed.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardReset (
|
USBKeyboardReset (
|
||||||
|
@ -72,7 +108,17 @@ USBKeyboardReset (
|
||||||
IN BOOLEAN ExtendedVerification
|
IN BOOLEAN ExtendedVerification
|
||||||
);
|
);
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
Implements EFI_SIMPLE_TEXT_INPUT_PROTOCOL.ReadKeyStroke() function.
|
||||||
|
|
||||||
|
@param This The EFI_SIMPLE_TEXT_INPUT_PROTOCOL instance.
|
||||||
|
@param Key A pointer to a buffer that is filled in with the keystroke
|
||||||
|
information for the key that was pressed.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Read key stroke successfully.
|
||||||
|
@retval Other Read key stroke failed.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardReadKeyStroke (
|
USBKeyboardReadKeyStroke (
|
||||||
|
@ -80,7 +126,14 @@ USBKeyboardReadKeyStroke (
|
||||||
OUT EFI_INPUT_KEY *Key
|
OUT EFI_INPUT_KEY *Key
|
||||||
);
|
);
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
Handler function for WaitForKey event.
|
||||||
|
|
||||||
|
@param Event Event to be signaled when a key is pressed.
|
||||||
|
@param Context Points to USB_KB_DEV instance.
|
||||||
|
|
||||||
|
@return None.
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardWaitForKey (
|
USBKeyboardWaitForKey (
|
||||||
|
@ -88,11 +141,17 @@ USBKeyboardWaitForKey (
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
/**
|
||||||
// Helper functions
|
Check whether there is key pending.
|
||||||
//
|
|
||||||
STATIC
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Have key pending to read.
|
||||||
|
@retval Other Parse key failed.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
USBKeyboardCheckForKey (
|
USBKeyboardCheckForKey (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
);
|
);
|
||||||
|
@ -100,13 +159,36 @@ USBKeyboardCheckForKey (
|
||||||
EFI_GUID gEfiUsbKeyboardDriverGuid = {
|
EFI_GUID gEfiUsbKeyboardDriverGuid = {
|
||||||
0xa05f5f78, 0xfb3, 0x4d10, {0x90, 0x90, 0xac, 0x4, 0x6e, 0xeb, 0x7c, 0x3c}
|
0xa05f5f78, 0xfb3, 0x4d10, {0x90, 0x90, 0xac, 0x4, 0x6e, 0xeb, 0x7c, 0x3c}
|
||||||
};
|
};
|
||||||
STATIC
|
|
||||||
|
/**
|
||||||
|
Free keyboard notify list.
|
||||||
|
|
||||||
|
@param ListHead The list head.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Free the notify list successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER ListHead is invalid.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
KbdFreeNotifyList (
|
KbdFreeNotifyList (
|
||||||
IN OUT LIST_ENTRY *ListHead
|
IN OUT LIST_ENTRY *ListHead
|
||||||
);
|
);
|
||||||
STATIC
|
|
||||||
|
/**
|
||||||
|
Whether the pressed key matches a registered key or not.
|
||||||
|
|
||||||
|
@param RegsiteredData A pointer to a buffer that is filled in with the keystroke
|
||||||
|
state data for the key that was registered.
|
||||||
|
@param InputData A pointer to a buffer that is filled in with the keystroke
|
||||||
|
state data for the key that was pressed.
|
||||||
|
|
||||||
|
@retval TRUE Key pressed matches a registered key.
|
||||||
|
@retval FLASE Match failed.
|
||||||
|
|
||||||
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
IsKeyRegistered (
|
IsKeyRegistered (
|
||||||
IN EFI_KEY_DATA *RegsiteredData,
|
IN EFI_KEY_DATA *RegsiteredData,
|
||||||
IN EFI_KEY_DATA *InputData
|
IN EFI_KEY_DATA *InputData
|
||||||
|
@ -125,24 +207,22 @@ EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
The Usb Keyboard Driver Entry Point.
|
||||||
|
|
||||||
|
@param ImageHandle The driver image handle.
|
||||||
|
@param SystemTable The system table.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS The component name protocol is installed.
|
||||||
|
@return Others Failed to install.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardDriverBindingEntryPoint (
|
USBKeyboardDriverBindingEntryPoint (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Driver Entry Point.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
ImageHandle - EFI_HANDLE
|
|
||||||
SystemTable - EFI_SYSTEM_TABLE
|
|
||||||
Returns:
|
|
||||||
EFI_STATUS
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
return EfiLibInstallDriverBindingComponentName2 (
|
return EfiLibInstallDriverBindingComponentName2 (
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
|
@ -154,16 +234,15 @@ USBKeyboardDriverBindingEntryPoint (
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Supported.
|
Check whether USB keyboard driver support this device.
|
||||||
|
|
||||||
@param This EFI_DRIVER_BINDING_PROTOCOL
|
@param This The USB keyboard driver binding protocol.
|
||||||
@param Controller Controller handle
|
@param Controller The controller handle to check.
|
||||||
@param RemainingDevicePath EFI_DEVICE_PATH_PROTOCOL
|
@param RemainingDevicePath The remaining device path.
|
||||||
EFI_STATUS
|
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The driver supports this controller.
|
||||||
|
@retval EFI_UNSUPPORTED This device isn't supported.
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
|
@ -212,17 +291,15 @@ USBKeyboardDriverBindingSupported (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start.
|
Start running driver on the controller.
|
||||||
|
|
||||||
@param This EFI_DRIVER_BINDING_PROTOCOL
|
@param This The USB keyboard driver binding instance.
|
||||||
@param Controller Controller handle
|
@param Controller The controller to check.
|
||||||
@param RemainingDevicePath EFI_DEVICE_PATH_PROTOCOL
|
@param RemainingDevicePath The remaining device patch.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
@retval EFI_SUCCESS The controller is controlled by the usb keyboard driver.
|
||||||
@retval EFI_OUT_OF_RESOURCES Can't allocate memory
|
@return Other The keyboard driver doesn't support this controller.
|
||||||
@retval EFI_UNSUPPORTED The Start routine fail
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -546,17 +623,16 @@ ErrorExit:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Stop.
|
Stop handle the controller by this USB keyboard driver.
|
||||||
|
|
||||||
@param This EFI_DRIVER_BINDING_PROTOCOL
|
@param This The USB keyboard driver binding protocol.
|
||||||
@param Controller Controller handle
|
@param Controller The controller to release.
|
||||||
@param NumberOfChildren Child handle number
|
@param NumberOfChildren The number of handles in ChildHandleBuffer.
|
||||||
@param ChildHandleBuffer Child handle buffer
|
@param ChildHandleBuffer The array of child handle.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
@retval EFI_SUCCESS The controller or children are stopped.
|
||||||
@retval EFI_UNSUPPORTED Can't support
|
@retval EFI_DEVICE_ERROR Failed to stop the driver.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -668,31 +744,27 @@ USBKeyboardDriverBindingStop (
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
Reads the next keystroke from the input device. The WaitForKey Event can
|
||||||
|
be used to test for existance of a keystroke via WaitForEvent () call.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice Usb keyboard's private structure.
|
||||||
|
@param KeyData A pointer to a buffer that is filled in with the keystroke
|
||||||
|
state data for the key that was pressed.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS The keystroke information was returned.
|
||||||
|
@return EFI_NOT_READY There was no keystroke data availiable.
|
||||||
|
@return EFI_DEVICE_ERROR The keystroke information was not returned due to
|
||||||
|
hardware errors.
|
||||||
|
@return EFI_INVALID_PARAMETER KeyData is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
USBKeyboardReadKeyStrokeWorker (
|
USBKeyboardReadKeyStrokeWorker (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice,
|
IN USB_KB_DEV *UsbKeyboardDevice,
|
||||||
OUT EFI_KEY_DATA *KeyData
|
OUT EFI_KEY_DATA *KeyData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Reads the next keystroke from the input device. The WaitForKey Event can
|
|
||||||
be used to test for existance of a keystroke via WaitForEvent () call.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
UsbKeyboardDevice - Usb keyboard private structure.
|
|
||||||
KeyData - A pointer to a buffer that is filled in with the keystroke
|
|
||||||
state data for the key that was pressed.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The keystroke information was returned.
|
|
||||||
EFI_NOT_READY - There was no keystroke data availiable.
|
|
||||||
EFI_DEVICE_ERROR - The keystroke information was not returned due to
|
|
||||||
hardware errors.
|
|
||||||
EFI_INVALID_PARAMETER - KeyData is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
@ -741,9 +813,9 @@ USBKeyboardReadKeyStrokeWorker (
|
||||||
// their corresponding control value (ctrl-a = 0x0001 through ctrl-Z = 0x001A), here switch them back for notification function.
|
// their corresponding control value (ctrl-a = 0x0001 through ctrl-Z = 0x001A), here switch them back for notification function.
|
||||||
//
|
//
|
||||||
CopyMem (&OriginalKeyData, KeyData, sizeof (EFI_KEY_DATA));
|
CopyMem (&OriginalKeyData, KeyData, sizeof (EFI_KEY_DATA));
|
||||||
if (UsbKeyboardDevice->CtrlOn) {
|
if (UsbKeyboardDevice->CtrlOn != 0) {
|
||||||
if (OriginalKeyData.Key.UnicodeChar >= 0x01 && OriginalKeyData.Key.UnicodeChar <= 0x1A) {
|
if (OriginalKeyData.Key.UnicodeChar >= 0x01 && OriginalKeyData.Key.UnicodeChar <= 0x1A) {
|
||||||
if (UsbKeyboardDevice->CapsOn) {
|
if (UsbKeyboardDevice->CapsOn != 0) {
|
||||||
OriginalKeyData.Key.UnicodeChar = (CHAR16)(OriginalKeyData.Key.UnicodeChar + 'A' - 1);
|
OriginalKeyData.Key.UnicodeChar = (CHAR16)(OriginalKeyData.Key.UnicodeChar + 'A' - 1);
|
||||||
} else {
|
} else {
|
||||||
OriginalKeyData.Key.UnicodeChar = (CHAR16)(OriginalKeyData.Key.UnicodeChar + 'a' - 1);
|
OriginalKeyData.Key.UnicodeChar = (CHAR16)(OriginalKeyData.Key.UnicodeChar + 'a' - 1);
|
||||||
|
@ -769,6 +841,17 @@ USBKeyboardReadKeyStrokeWorker (
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reset Usb Keyboard.
|
||||||
|
|
||||||
|
@param This The protocol instance of EFI_SIMPLE_TEXT_INPUT_PROTOCOL.
|
||||||
|
@param ExtendedVerification Whether completely reset keyboard or not.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Reset keyboard successfully.
|
||||||
|
@retval EFI_DEVICE_ERROR Reset keyboard failed.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardReset (
|
USBKeyboardReset (
|
||||||
|
@ -822,14 +905,14 @@ USBKeyboardReset (
|
||||||
/**
|
/**
|
||||||
Implements EFI_SIMPLE_TEXT_INPUT_PROTOCOL.ReadKeyStroke() function.
|
Implements EFI_SIMPLE_TEXT_INPUT_PROTOCOL.ReadKeyStroke() function.
|
||||||
|
|
||||||
This The EFI_SIMPLE_TEXT_INPUT_PROTOCOL instance.
|
@param This The EFI_SIMPLE_TEXT_INPUT_PROTOCOL instance.
|
||||||
Key A pointer to a buffer that is filled in with the keystroke
|
@param Key A pointer to a buffer that is filled in with the keystroke
|
||||||
information for the key that was pressed.
|
information for the key that was pressed.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
@retval EFI_SUCCESS Read key stroke successfully.
|
||||||
|
@retval Other Read key stroke failed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
STATIC
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardReadKeyStroke (
|
USBKeyboardReadKeyStroke (
|
||||||
|
@ -858,13 +941,11 @@ USBKeyboardReadKeyStroke (
|
||||||
/**
|
/**
|
||||||
Handler function for WaitForKey event.
|
Handler function for WaitForKey event.
|
||||||
|
|
||||||
Event Event to be signaled when a key is pressed.
|
@param Event Event to be signaled when a key is pressed.
|
||||||
Context Points to USB_KB_DEV instance.
|
@param Context Points to USB_KB_DEV instance.
|
||||||
|
|
||||||
@return VOID
|
|
||||||
|
|
||||||
|
@return None.
|
||||||
**/
|
**/
|
||||||
STATIC
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardWaitForKey (
|
USBKeyboardWaitForKey (
|
||||||
|
@ -889,17 +970,17 @@ USBKeyboardWaitForKey (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether there is key pending.
|
Check whether there is key pending.
|
||||||
|
|
||||||
UsbKeyboardDevice The USB_KB_DEV instance.
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
@retval EFI_SUCCESS Have key pending to read.
|
||||||
|
@retval Other Parse key failed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
STATIC
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
USBKeyboardCheckForKey (
|
USBKeyboardCheckForKey (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
)
|
)
|
||||||
|
@ -920,18 +1001,18 @@ USBKeyboardCheckForKey (
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Report Status Code in Usb Bot Driver
|
Report Status Code in Usb Keyboard Driver.
|
||||||
|
|
||||||
@param DevicePath Use this to get Device Path
|
@param DevicePath Use this to get Device Path.
|
||||||
@param CodeType Status Code Type
|
@param CodeType Status Code Type.
|
||||||
@param CodeValue Status Code Value
|
@param CodeValue Status Code Value.
|
||||||
|
|
||||||
@return None
|
@return None.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
KbdReportStatusCode (
|
KbdReportStatusCode (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||||
|
@ -945,25 +1026,21 @@ KbdReportStatusCode (
|
||||||
DevicePath
|
DevicePath
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
STATIC
|
|
||||||
|
/**
|
||||||
|
Free keyboard notify list.
|
||||||
|
|
||||||
|
@param ListHead The list head.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Free the notify list successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER ListHead is invalid.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
KbdFreeNotifyList (
|
KbdFreeNotifyList (
|
||||||
IN OUT LIST_ENTRY *ListHead
|
IN OUT LIST_ENTRY *ListHead
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
ListHead - The list head
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
EFI_SUCCESS - Free the notify list successfully
|
|
||||||
EFI_INVALID_PARAMETER - ListHead is invalid.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
KEYBOARD_CONSOLE_IN_EX_NOTIFY *NotifyNode;
|
KEYBOARD_CONSOLE_IN_EX_NOTIFY *NotifyNode;
|
||||||
|
|
||||||
|
@ -984,28 +1061,24 @@ Returns:
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC
|
/**
|
||||||
|
Whether the pressed key matches a registered key or not.
|
||||||
|
|
||||||
|
@param RegsiteredData A pointer to a buffer that is filled in with the keystroke
|
||||||
|
state data for the key that was registered.
|
||||||
|
@param InputData A pointer to a buffer that is filled in with the keystroke
|
||||||
|
state data for the key that was pressed.
|
||||||
|
|
||||||
|
@retval TRUE Key pressed matches a registered key.
|
||||||
|
@retval FLASE Match failed.
|
||||||
|
|
||||||
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
IsKeyRegistered (
|
IsKeyRegistered (
|
||||||
IN EFI_KEY_DATA *RegsiteredData,
|
IN EFI_KEY_DATA *RegsiteredData,
|
||||||
IN EFI_KEY_DATA *InputData
|
IN EFI_KEY_DATA *InputData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
RegsiteredData - A pointer to a buffer that is filled in with the keystroke
|
|
||||||
state data for the key that was registered.
|
|
||||||
InputData - A pointer to a buffer that is filled in with the keystroke
|
|
||||||
state data for the key that was pressed.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
TRUE - Key be pressed matches a registered key.
|
|
||||||
FLASE - Match failed.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
ASSERT (RegsiteredData != NULL && InputData != NULL);
|
ASSERT (RegsiteredData != NULL && InputData != NULL);
|
||||||
|
|
||||||
|
@ -1033,27 +1106,23 @@ Returns:
|
||||||
//
|
//
|
||||||
// Simple Text Input Ex protocol functions
|
// Simple Text Input Ex protocol functions
|
||||||
//
|
//
|
||||||
|
/**
|
||||||
|
The extension routine to reset the input device.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ExtendedVerification Driver may perform diagnostics on reset.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The device was reset.
|
||||||
|
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
|
||||||
|
not be reset.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardResetEx (
|
USBKeyboardResetEx (
|
||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
IN BOOLEAN ExtendedVerification
|
IN BOOLEAN ExtendedVerification
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Reset the input device and optionaly run diagnostics
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
ExtendedVerification - Driver may perform diagnostics on reset.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The device was reset.
|
|
||||||
EFI_DEVICE_ERROR - The device is not functioning properly and could
|
|
||||||
not be reset.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
USB_KB_DEV *UsbKeyboardDevice;
|
USB_KB_DEV *UsbKeyboardDevice;
|
||||||
|
@ -1076,31 +1145,25 @@ USBKeyboardResetEx (
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads the next keystroke from the input device. The WaitForKey Event can
|
||||||
|
be used to test for existance of a keystroke via WaitForEvent () call.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param KeyData A pointer to a buffer that is filled in with the keystroke
|
||||||
|
state data for the key that was pressed.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS The keystroke information was returned successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER KeyData is NULL.
|
||||||
|
@retval Other Read key stroke information failed.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardReadKeyStrokeEx (
|
USBKeyboardReadKeyStrokeEx (
|
||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
OUT EFI_KEY_DATA *KeyData
|
OUT EFI_KEY_DATA *KeyData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Reads the next keystroke from the input device. The WaitForKey Event can
|
|
||||||
be used to test for existance of a keystroke via WaitForEvent () call.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
KeyData - A pointer to a buffer that is filled in with the keystroke
|
|
||||||
state data for the key that was pressed.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The keystroke information was returned.
|
|
||||||
EFI_NOT_READY - There was no keystroke data availiable.
|
|
||||||
EFI_DEVICE_ERROR - The keystroke information was not returned due to
|
|
||||||
hardware errors.
|
|
||||||
EFI_INVALID_PARAMETER - KeyData is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
USB_KB_DEV *UsbKeyboardDevice;
|
USB_KB_DEV *UsbKeyboardDevice;
|
||||||
|
|
||||||
|
@ -1114,30 +1177,24 @@ USBKeyboardReadKeyStrokeEx (
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set certain state for the input device.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the
|
||||||
|
state for the input device.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The device state was set successfully.
|
||||||
|
@retval EFI_UNSUPPORTED The device does not have the ability to set its state.
|
||||||
|
@retval EFI_INVALID_PARAMETER KeyToggleState is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardSetState (
|
USBKeyboardSetState (
|
||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Set certain state for the input device.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the
|
|
||||||
state for the input device.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The device state was set successfully.
|
|
||||||
EFI_DEVICE_ERROR - The device is not functioning correctly and could
|
|
||||||
not have the setting adjusted.
|
|
||||||
EFI_UNSUPPORTED - The device does not have the ability to set its state.
|
|
||||||
EFI_INVALID_PARAMETER - KeyToggleState is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
USB_KB_DEV *UsbKeyboardDevice;
|
USB_KB_DEV *UsbKeyboardDevice;
|
||||||
|
|
||||||
|
@ -1178,33 +1235,29 @@ USBKeyboardSetState (
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Register a notification function for a particular keystroke for the input device.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param KeyData A pointer to a buffer that is filled in with the keystroke
|
||||||
|
information data for the key that was pressed.
|
||||||
|
@param KeyNotificationFunction Points to the function to be called when the key
|
||||||
|
sequence is typed specified by KeyData.
|
||||||
|
@param NotifyHandle Points to the unique handle assigned to the registered notification.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The notification function was registered successfully.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data structures.
|
||||||
|
@retval EFI_INVALID_PARAMETER KeyData or NotifyHandle is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardRegisterKeyNotify (
|
USBKeyboardRegisterKeyNotify (
|
||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
IN EFI_KEY_DATA *KeyData,
|
IN EFI_KEY_DATA *KeyData,
|
||||||
IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
|
IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
|
||||||
OUT EFI_HANDLE *NotifyHandle
|
OUT EFI_HANDLE *NotifyHandle
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Register a notification function for a particular keystroke for the input device.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
KeyData - A pointer to a buffer that is filled in with the keystroke
|
|
||||||
information data for the key that was pressed.
|
|
||||||
KeyNotificationFunction - Points to the function to be called when the key
|
|
||||||
sequence is typed specified by KeyData.
|
|
||||||
NotifyHandle - Points to the unique handle assigned to the registered notification.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The notification function was registered successfully.
|
|
||||||
EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.
|
|
||||||
EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
USB_KB_DEV *UsbKeyboardDevice;
|
USB_KB_DEV *UsbKeyboardDevice;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
@ -1266,27 +1319,24 @@ USBKeyboardRegisterKeyNotify (
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Remove a registered notification function from a particular keystroke.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param NotificationHandle The handle of the notification function being unregistered.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The notification function was unregistered successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER The NotificationHandle is invalid or opening gSimpleTextInExNotifyGuid
|
||||||
|
on NotificationHandle fails.
|
||||||
|
@retval EFI_NOT_FOUND Can not find the matching entry in database.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardUnregisterKeyNotify (
|
USBKeyboardUnregisterKeyNotify (
|
||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
IN EFI_HANDLE NotificationHandle
|
IN EFI_HANDLE NotificationHandle
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Remove a registered notification function from a particular keystroke.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
NotificationHandle - The handle of the notification function being unregistered.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The notification function was unregistered successfully.
|
|
||||||
EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
|
|
||||||
EFI_NOT_FOUND - Can not find the matching entry in database.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
USB_KB_DEV *UsbKeyboardDevice;
|
USB_KB_DEV *UsbKeyboardDevice;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
|
@ -1,4 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
|
Header file for USB Keyboard Driver's Data Structures.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2008, Intel Corporation
|
Copyright (c) 2004 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -8,19 +11,9 @@ http://opensource.org/licenses/bsd-license.php
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
EfiKey.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Header file for USB Keyboard Driver's Data Structures
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#ifndef _USB_KB_H
|
#ifndef _EFI_USB_KB_H_
|
||||||
#define _USB_KB_H
|
#define _EFI_USB_KB_H_
|
||||||
|
|
||||||
|
|
||||||
#include <PiDxe.h>
|
#include <PiDxe.h>
|
||||||
|
@ -164,7 +157,18 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gUsbKeyboardComponentName2;
|
||||||
extern EFI_GUID gEfiUsbKeyboardDriverGuid;
|
extern EFI_GUID gEfiUsbKeyboardDriverGuid;
|
||||||
extern EFI_GUID gSimpleTextInExNotifyGuid;
|
extern EFI_GUID gSimpleTextInExNotifyGuid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Report Status Code in Usb Keyboard Driver.
|
||||||
|
|
||||||
|
@param DevicePath Use this to get Device Path.
|
||||||
|
@param CodeType Status Code Type.
|
||||||
|
@param CodeValue Status Code Value.
|
||||||
|
|
||||||
|
@return None.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
KbdReportStatusCode (
|
KbdReportStatusCode (
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||||
IN EFI_STATUS_CODE_TYPE CodeType,
|
IN EFI_STATUS_CODE_TYPE CodeType,
|
||||||
|
@ -205,82 +209,81 @@ typedef struct {
|
||||||
//
|
//
|
||||||
// Simple Text Input Ex protocol functions
|
// Simple Text Input Ex protocol functions
|
||||||
//
|
//
|
||||||
|
/**
|
||||||
|
The extension routine to reset the input device.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param ExtendedVerification Driver may perform diagnostics on reset.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The device was reset.
|
||||||
|
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
|
||||||
|
not be reset.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardResetEx (
|
USBKeyboardResetEx (
|
||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
IN BOOLEAN ExtendedVerification
|
IN BOOLEAN ExtendedVerification
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Reset the input device and optionaly run diagnostics
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
ExtendedVerification - Driver may perform diagnostics on reset.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The device was reset.
|
|
||||||
EFI_DEVICE_ERROR - The device is not functioning properly and could
|
|
||||||
not be reset.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads the next keystroke from the input device. The WaitForKey Event can
|
||||||
|
be used to test for existance of a keystroke via WaitForEvent () call.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param KeyData A pointer to a buffer that is filled in with the keystroke
|
||||||
|
state data for the key that was pressed.
|
||||||
|
|
||||||
|
@return EFI_SUCCESS The keystroke information was returned successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER KeyData is NULL.
|
||||||
|
@retval Other Read key stroke information failed.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardReadKeyStrokeEx (
|
USBKeyboardReadKeyStrokeEx (
|
||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
OUT EFI_KEY_DATA *KeyData
|
OUT EFI_KEY_DATA *KeyData
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Reads the next keystroke from the input device. The WaitForKey Event can
|
|
||||||
be used to test for existance of a keystroke via WaitForEvent () call.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
KeyData - A pointer to a buffer that is filled in with the keystroke
|
|
||||||
state data for the key that was pressed.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The keystroke information was returned.
|
|
||||||
EFI_NOT_READY - There was no keystroke data availiable.
|
|
||||||
EFI_DEVICE_ERROR - The keystroke information was not returned due to
|
|
||||||
hardware errors.
|
|
||||||
EFI_INVALID_PARAMETER - KeyData is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set certain state for the input device.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the
|
||||||
|
state for the input device.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The device state was set successfully.
|
||||||
|
@retval EFI_UNSUPPORTED The device does not have the ability to set its state.
|
||||||
|
@retval EFI_INVALID_PARAMETER KeyToggleState is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardSetState (
|
USBKeyboardSetState (
|
||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Set certain state for the input device.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the
|
|
||||||
state for the input device.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The device state was set successfully.
|
|
||||||
EFI_DEVICE_ERROR - The device is not functioning correctly and could
|
|
||||||
not have the setting adjusted.
|
|
||||||
EFI_UNSUPPORTED - The device does not have the ability to set its state.
|
|
||||||
EFI_INVALID_PARAMETER - KeyToggleState is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Register a notification function for a particular keystroke for the input device.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param KeyData A pointer to a buffer that is filled in with the keystroke
|
||||||
|
information data for the key that was pressed.
|
||||||
|
@param KeyNotificationFunction Points to the function to be called when the key
|
||||||
|
sequence is typed specified by KeyData.
|
||||||
|
@param NotifyHandle Points to the unique handle assigned to the registered notification.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The notification function was registered successfully.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data structures.
|
||||||
|
@retval EFI_INVALID_PARAMETER KeyData or NotifyHandle is NULL.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardRegisterKeyNotify (
|
USBKeyboardRegisterKeyNotify (
|
||||||
|
@ -289,48 +292,26 @@ USBKeyboardRegisterKeyNotify (
|
||||||
IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
|
IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
|
||||||
OUT EFI_HANDLE *NotifyHandle
|
OUT EFI_HANDLE *NotifyHandle
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Register a notification function for a particular keystroke for the input device.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
KeyData - A pointer to a buffer that is filled in with the keystroke
|
|
||||||
information data for the key that was pressed.
|
|
||||||
KeyNotificationFunction - Points to the function to be called when the key
|
|
||||||
sequence is typed specified by KeyData.
|
|
||||||
NotifyHandle - Points to the unique handle assigned to the registered notification.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The notification function was registered successfully.
|
|
||||||
EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.
|
|
||||||
EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Remove a registered notification function from a particular keystroke.
|
||||||
|
|
||||||
|
@param This Protocol instance pointer.
|
||||||
|
@param NotificationHandle The handle of the notification function being unregistered.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The notification function was unregistered successfully.
|
||||||
|
@retval EFI_INVALID_PARAMETER The NotificationHandle is invalid or opening gSimpleTextInExNotifyGuid
|
||||||
|
on NotificationHandle fails.
|
||||||
|
@retval EFI_NOT_FOUND Can not find the matching entry in database.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
USBKeyboardUnregisterKeyNotify (
|
USBKeyboardUnregisterKeyNotify (
|
||||||
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
|
||||||
IN EFI_HANDLE NotificationHandle
|
IN EFI_HANDLE NotificationHandle
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Remove a registered notification function from a particular keystroke.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
This - Protocol instance pointer.
|
|
||||||
NotificationHandle - The handle of the notification function being unregistered.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - The notification function was unregistered successfully.
|
|
||||||
EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
|
|
||||||
EFI_NOT_FOUND - Can not find the matching entry in database.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,5 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
|
Helper functions for USB Keyboard Driver.
|
||||||
|
|
||||||
Copyright (c) 2004 - 2008, Intel Corporation
|
Copyright (c) 2004 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -9,20 +11,9 @@ http://opensource.org/licenses/bsd-license.php
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
Keyboard.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Helper functions for USB Keyboard Driver
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "keyboard.h"
|
#include "KeyBoard.h"
|
||||||
#include <Library/UsbLib.h>
|
#include <Library/UsbLib.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -140,22 +131,18 @@ UINT8 KeyboardLayoutTable[USB_KEYCODE_MAX_MAKE + 8][5] = {
|
||||||
{EfiKeyA3, 0, 0, EFI_RIGHT_LOGO_MODIFIER, 0}, // 0xe7
|
{EfiKeyA3, 0, 0, EFI_RIGHT_LOGO_MODIFIER, 0}, // 0xe7
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize KeyConvertionTable by using default keyboard layout.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
@retval None.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
LoadDefaultKeyboardLayout (
|
LoadDefaultKeyboardLayout (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Initialize KeyConvertionTable by using default keyboard layout.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
UsbKeyboardDevice The USB_KB_DEV instance.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
None.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
EFI_KEY_DESCRIPTOR *KeyDescriptor;
|
EFI_KEY_DESCRIPTOR *KeyDescriptor;
|
||||||
|
@ -350,11 +337,12 @@ STATIC KB_MODIFIER KB_Mod[8] = {
|
||||||
/**
|
/**
|
||||||
Uses USB I/O to check whether the device is a USB Keyboard device.
|
Uses USB I/O to check whether the device is a USB Keyboard device.
|
||||||
|
|
||||||
UsbIo: Points to a USB I/O protocol instance.
|
@param UsbIo Points to a USB I/O protocol instance.
|
||||||
|
@retval None
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
IsUSBKeyboard (
|
IsUSBKeyboard (
|
||||||
IN EFI_USB_IO_PROTOCOL *UsbIo
|
IN EFI_USB_IO_PROTOCOL *UsbIo
|
||||||
)
|
)
|
||||||
|
@ -386,23 +374,17 @@ IsUSBKeyboard (
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get current keyboard layout from HII database.
|
||||||
|
|
||||||
|
@retval Pointer to EFI_HII_KEYBOARD_LAYOUT.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_HII_KEYBOARD_LAYOUT *
|
EFI_HII_KEYBOARD_LAYOUT *
|
||||||
|
EFIAPI
|
||||||
GetCurrentKeyboardLayout (
|
GetCurrentKeyboardLayout (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Get current keyboard layout from HII database.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
None.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Pointer to EFI_HII_KEYBOARD_LAYOUT.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||||
|
@ -451,24 +433,21 @@ GetCurrentKeyboardLayout (
|
||||||
return KeyboardLayout;
|
return KeyboardLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Find Key Descriptor in KeyConvertionTable given its scan code.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
@param ScanCode USB scan code.
|
||||||
|
|
||||||
|
@return The Key descriptor in KeyConvertionTable.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_KEY_DESCRIPTOR *
|
EFI_KEY_DESCRIPTOR *
|
||||||
|
EFIAPI
|
||||||
GetKeyDescriptor (
|
GetKeyDescriptor (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice,
|
IN USB_KB_DEV *UsbKeyboardDevice,
|
||||||
IN UINT8 ScanCode
|
IN UINT8 ScanCode
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Find Key Descriptor in KeyConvertionTable given its scan code.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
UsbKeyboardDevice - The USB_KB_DEV instance.
|
|
||||||
ScanCode - USB scan code.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
The Key descriptor in KeyConvertionTable.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINT8 Index;
|
UINT8 Index;
|
||||||
|
|
||||||
|
@ -485,24 +464,22 @@ GetKeyDescriptor (
|
||||||
return &UsbKeyboardDevice->KeyConvertionTable[Index];
|
return &UsbKeyboardDevice->KeyConvertionTable[Index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Find Non-Spacing key for given KeyDescriptor.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
@param KeyDescriptor Key descriptor.
|
||||||
|
|
||||||
|
@retval NULL Key list is empty.
|
||||||
|
@return Other The Non-Spacing key.
|
||||||
|
|
||||||
|
**/
|
||||||
USB_NS_KEY *
|
USB_NS_KEY *
|
||||||
|
EFIAPI
|
||||||
FindUsbNsKey (
|
FindUsbNsKey (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice,
|
IN USB_KB_DEV *UsbKeyboardDevice,
|
||||||
IN EFI_KEY_DESCRIPTOR *KeyDescriptor
|
IN EFI_KEY_DESCRIPTOR *KeyDescriptor
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Find Non-Spacing key for given KeyDescriptor.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
UsbKeyboardDevice - The USB_KB_DEV instance.
|
|
||||||
KeyDescriptor - Key descriptor.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
The Non-Spacing key.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
USB_NS_KEY *UsbNsKey;
|
USB_NS_KEY *UsbNsKey;
|
||||||
|
@ -521,24 +498,21 @@ FindUsbNsKey (
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Find physical key definition for a given Key stroke.
|
||||||
|
|
||||||
|
@param UsbNsKey The Non-Spacing key information.
|
||||||
|
@param KeyDescriptor The key stroke.
|
||||||
|
|
||||||
|
@return The physical key definition.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_KEY_DESCRIPTOR *
|
EFI_KEY_DESCRIPTOR *
|
||||||
|
EFIAPI
|
||||||
FindPhysicalKey (
|
FindPhysicalKey (
|
||||||
IN USB_NS_KEY *UsbNsKey,
|
IN USB_NS_KEY *UsbNsKey,
|
||||||
IN EFI_KEY_DESCRIPTOR *KeyDescriptor
|
IN EFI_KEY_DESCRIPTOR *KeyDescriptor
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Find physical key definition for a given Key stroke.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
UsbNsKey - The Non-Spacing key information.
|
|
||||||
KeyDescriptor - The key stroke.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
The physical key definition.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
EFI_KEY_DESCRIPTOR *PhysicalKey;
|
EFI_KEY_DESCRIPTOR *PhysicalKey;
|
||||||
|
@ -558,22 +532,19 @@ FindPhysicalKey (
|
||||||
return KeyDescriptor;
|
return KeyDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The notification function for SET_KEYBOARD_LAYOUT_EVENT.
|
||||||
|
|
||||||
|
@param Event The instance of EFI_EVENT.
|
||||||
|
@param Context passing parameter.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SetKeyboardLayoutEvent (
|
SetKeyboardLayoutEvent (
|
||||||
EFI_EVENT Event,
|
EFI_EVENT Event,
|
||||||
VOID *Context
|
VOID *Context
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
The notification function for SET_KEYBOARD_LAYOUT_EVENT.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
USB_KB_DEV *UsbKeyboardDevice;
|
USB_KB_DEV *UsbKeyboardDevice;
|
||||||
EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout;
|
EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout;
|
||||||
|
@ -668,22 +639,17 @@ SetKeyboardLayoutEvent (
|
||||||
gBS->FreePool (KeyboardLayout);
|
gBS->FreePool (KeyboardLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroy resources for Keyboard layout.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
|
||||||
|
**/
|
||||||
VOID
|
VOID
|
||||||
|
EFIAPI
|
||||||
ReleaseKeyboardLayoutResources (
|
ReleaseKeyboardLayoutResources (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Destroy resources for Keyboard layout.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
UsbKeyboardDevice - The USB_KB_DEV instance.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
None.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
USB_NS_KEY *UsbNsKey;
|
USB_NS_KEY *UsbNsKey;
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
|
@ -701,22 +667,20 @@ ReleaseKeyboardLayoutResources (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize USB Keyboard layout.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Initialization Success.
|
||||||
|
@retval Other Keyboard layout initial failed.
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
InitKeyboardLayout (
|
InitKeyboardLayout (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
)
|
)
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
Initialize USB Keyboard layout.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
UsbKeyboardDevice The USB_KB_DEV instance.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
EFI_SUCCESS - Success
|
|
||||||
Other - Keyboard layout initial failed.
|
|
||||||
--*/
|
|
||||||
{
|
{
|
||||||
EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout;
|
EFI_HII_KEYBOARD_LAYOUT *KeyboardLayout;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
@ -772,13 +736,14 @@ InitKeyboardLayout (
|
||||||
/**
|
/**
|
||||||
Initialize USB Keyboard device and all private data structures.
|
Initialize USB Keyboard device and all private data structures.
|
||||||
|
|
||||||
UsbKeyboardDevice The USB_KB_DEV instance.
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
@retval EFI_SUCCESS Initialization is successful.
|
||||||
@retval EFI_DEVICE_ERROR Hardware Error
|
@retval EFI_DEVICE_ERROR Configure hardware failed.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
InitUSBKeyboard (
|
InitUSBKeyboard (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
)
|
)
|
||||||
|
@ -895,7 +860,7 @@ InitUSBKeyboard (
|
||||||
//
|
//
|
||||||
// Set a timer for repeat keys' generation.
|
// Set a timer for repeat keys' generation.
|
||||||
//
|
//
|
||||||
if (UsbKeyboardDevice->RepeatTimer) {
|
if (UsbKeyboardDevice->RepeatTimer != NULL) {
|
||||||
gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);
|
gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);
|
||||||
UsbKeyboardDevice->RepeatTimer = 0;
|
UsbKeyboardDevice->RepeatTimer = 0;
|
||||||
}
|
}
|
||||||
|
@ -908,7 +873,7 @@ InitUSBKeyboard (
|
||||||
&UsbKeyboardDevice->RepeatTimer
|
&UsbKeyboardDevice->RepeatTimer
|
||||||
);
|
);
|
||||||
|
|
||||||
if (UsbKeyboardDevice->DelayedRecoveryEvent) {
|
if (UsbKeyboardDevice->DelayedRecoveryEvent != NULL) {
|
||||||
gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);
|
gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);
|
||||||
UsbKeyboardDevice->DelayedRecoveryEvent = 0;
|
UsbKeyboardDevice->DelayedRecoveryEvent = 0;
|
||||||
}
|
}
|
||||||
|
@ -928,14 +893,14 @@ InitUSBKeyboard (
|
||||||
/**
|
/**
|
||||||
Handler function for USB Keyboard's asynchronous interrupt transfer.
|
Handler function for USB Keyboard's asynchronous interrupt transfer.
|
||||||
|
|
||||||
Data A pointer to a buffer that is filled with key data which is
|
@param Data A pointer to a buffer that is filled with key data which is
|
||||||
retrieved via asynchronous interrupt transfer.
|
retrieved via asynchronous interrupt transfer.
|
||||||
DataLength Indicates the size of the data buffer.
|
@param DataLength Indicates the size of the data buffer.
|
||||||
Context Pointing to USB_KB_DEV instance.
|
@param Context Pointing to USB_KB_DEV instance.
|
||||||
Result Indicates the result of the asynchronous interrupt transfer.
|
@param Result Indicates the result of the asynchronous interrupt transfer.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
@retval EFI_SUCCESS Handler is successful.
|
||||||
@retval EFI_DEVICE_ERROR Hardware Error
|
@retval EFI_DEVICE_ERROR Hardware Error
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -1182,7 +1147,7 @@ KeyboardHandler (
|
||||||
|
|
||||||
case EFI_LEFT_CONTROL_MODIFIER:
|
case EFI_LEFT_CONTROL_MODIFIER:
|
||||||
case EFI_RIGHT_CONTROL_MODIFIER:
|
case EFI_RIGHT_CONTROL_MODIFIER:
|
||||||
if (UsbKey.Down) {
|
if (UsbKey.Down != 0) {
|
||||||
UsbKeyboardDevice->CtrlOn = 1;
|
UsbKeyboardDevice->CtrlOn = 1;
|
||||||
} else {
|
} else {
|
||||||
UsbKeyboardDevice->CtrlOn = 0;
|
UsbKeyboardDevice->CtrlOn = 0;
|
||||||
|
@ -1191,7 +1156,7 @@ KeyboardHandler (
|
||||||
|
|
||||||
case EFI_LEFT_ALT_MODIFIER:
|
case EFI_LEFT_ALT_MODIFIER:
|
||||||
case EFI_RIGHT_ALT_MODIFIER:
|
case EFI_RIGHT_ALT_MODIFIER:
|
||||||
if (UsbKey.Down) {
|
if (UsbKey.Down != 0) {
|
||||||
UsbKeyboardDevice->AltOn = 1;
|
UsbKeyboardDevice->AltOn = 1;
|
||||||
} else {
|
} else {
|
||||||
UsbKeyboardDevice->AltOn = 0;
|
UsbKeyboardDevice->AltOn = 0;
|
||||||
|
@ -1199,7 +1164,7 @@ KeyboardHandler (
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_ALT_GR_MODIFIER:
|
case EFI_ALT_GR_MODIFIER:
|
||||||
if (UsbKey.Down) {
|
if (UsbKey.Down != 0) {
|
||||||
UsbKeyboardDevice->AltGrOn = 1;
|
UsbKeyboardDevice->AltGrOn = 1;
|
||||||
} else {
|
} else {
|
||||||
UsbKeyboardDevice->AltGrOn = 0;
|
UsbKeyboardDevice->AltGrOn = 0;
|
||||||
|
@ -1210,8 +1175,8 @@ KeyboardHandler (
|
||||||
// Del Key Code
|
// Del Key Code
|
||||||
//
|
//
|
||||||
case EFI_DELETE_MODIFIER:
|
case EFI_DELETE_MODIFIER:
|
||||||
if (UsbKey.Down) {
|
if (UsbKey.Down != 0) {
|
||||||
if (UsbKeyboardDevice->CtrlOn && UsbKeyboardDevice->AltOn) {
|
if ((UsbKeyboardDevice->CtrlOn != 0) && (UsbKeyboardDevice->AltOn != 0)) {
|
||||||
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
|
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1258,14 +1223,15 @@ KeyboardHandler (
|
||||||
/**
|
/**
|
||||||
Retrieves a key character after parsing the raw data in keyboard buffer.
|
Retrieves a key character after parsing the raw data in keyboard buffer.
|
||||||
|
|
||||||
UsbKeyboardDevice The USB_KB_DEV instance.
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
KeyChar Points to the Key character after key parsing.
|
@param KeyChar Points to the Key character after key parsing.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
@retval EFI_SUCCESS Parse key is successful.
|
||||||
@retval EFI_NOT_READY Device is not ready
|
@retval EFI_NOT_READY Device is not ready.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
USBParseKey (
|
USBParseKey (
|
||||||
IN OUT USB_KB_DEV *UsbKeyboardDevice,
|
IN OUT USB_KB_DEV *UsbKeyboardDevice,
|
||||||
OUT UINT8 *KeyChar
|
OUT UINT8 *KeyChar
|
||||||
|
@ -1283,7 +1249,7 @@ USBParseKey (
|
||||||
RemoveKeyCode (&(UsbKeyboardDevice->KeyboardBuffer), &UsbKey);
|
RemoveKeyCode (&(UsbKeyboardDevice->KeyboardBuffer), &UsbKey);
|
||||||
|
|
||||||
KeyDescriptor = GetKeyDescriptor (UsbKeyboardDevice, UsbKey.KeyCode);
|
KeyDescriptor = GetKeyDescriptor (UsbKeyboardDevice, UsbKey.KeyCode);
|
||||||
if (!UsbKey.Down) {
|
if (UsbKey.Down == 0) {
|
||||||
switch (KeyDescriptor->Modifier) {
|
switch (KeyDescriptor->Modifier) {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1498,7 +1464,7 @@ USBParseKey (
|
||||||
// When encountered Del Key...
|
// When encountered Del Key...
|
||||||
//
|
//
|
||||||
if (KeyDescriptor->Modifier == EFI_DELETE_MODIFIER) {
|
if (KeyDescriptor->Modifier == EFI_DELETE_MODIFIER) {
|
||||||
if (UsbKeyboardDevice->CtrlOn && UsbKeyboardDevice->AltOn) {
|
if ((UsbKeyboardDevice->CtrlOn != 0) && (UsbKeyboardDevice->AltOn != 0)) {
|
||||||
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
|
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1511,21 +1477,21 @@ USBParseKey (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts USB Keyboard code to EFI Scan Code.
|
Converts USB Keyboard code to EFI Scan Code.
|
||||||
|
|
||||||
UsbKeyboardDevice The USB_KB_DEV instance.
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
KeyChar Indicates the key code that will be interpreted.
|
@param KeyChar Indicates the key code that will be interpreted.
|
||||||
Key A pointer to a buffer that is filled in with
|
@param Key A pointer to a buffer that is filled in with
|
||||||
the keystroke information for the key that
|
the keystroke information for the key that
|
||||||
was pressed.
|
was pressed.
|
||||||
|
|
||||||
@retval EFI_NOT_READY Device is not ready
|
@retval EFI_NOT_READY Device is not ready
|
||||||
@retval EFI_SUCCESS Success
|
@retval EFI_SUCCESS Success.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
USBKeyCodeToEFIScanCode (
|
USBKeyCodeToEFIScanCode (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice,
|
IN USB_KB_DEV *UsbKeyboardDevice,
|
||||||
IN UINT8 KeyChar,
|
IN UINT8 KeyChar,
|
||||||
|
@ -1570,7 +1536,7 @@ USBKeyCodeToEFIScanCode (
|
||||||
Key->UnicodeChar = KeyDescriptor->Unicode;
|
Key->UnicodeChar = KeyDescriptor->Unicode;
|
||||||
|
|
||||||
if (KeyDescriptor->AffectedAttribute & EFI_AFFECTED_BY_STANDARD_SHIFT) {
|
if (KeyDescriptor->AffectedAttribute & EFI_AFFECTED_BY_STANDARD_SHIFT) {
|
||||||
if (UsbKeyboardDevice->ShiftOn) {
|
if (UsbKeyboardDevice->ShiftOn != 0) {
|
||||||
Key->UnicodeChar = KeyDescriptor->ShiftedUnicode;
|
Key->UnicodeChar = KeyDescriptor->ShiftedUnicode;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1582,7 +1548,7 @@ USBKeyCodeToEFIScanCode (
|
||||||
UsbKeyboardDevice->RightShiftOn = 0;
|
UsbKeyboardDevice->RightShiftOn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsbKeyboardDevice->AltGrOn) {
|
if (UsbKeyboardDevice->AltGrOn != 0) {
|
||||||
Key->UnicodeChar = KeyDescriptor->ShiftedAltGrUnicode;
|
Key->UnicodeChar = KeyDescriptor->ShiftedAltGrUnicode;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1591,14 +1557,14 @@ USBKeyCodeToEFIScanCode (
|
||||||
//
|
//
|
||||||
Key->UnicodeChar = KeyDescriptor->Unicode;
|
Key->UnicodeChar = KeyDescriptor->Unicode;
|
||||||
|
|
||||||
if (UsbKeyboardDevice->AltGrOn) {
|
if (UsbKeyboardDevice->AltGrOn != 0) {
|
||||||
Key->UnicodeChar = KeyDescriptor->AltGrUnicode;
|
Key->UnicodeChar = KeyDescriptor->AltGrUnicode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KeyDescriptor->AffectedAttribute & EFI_AFFECTED_BY_CAPS_LOCK) {
|
if (KeyDescriptor->AffectedAttribute & EFI_AFFECTED_BY_CAPS_LOCK) {
|
||||||
if (UsbKeyboardDevice->CapsOn) {
|
if (UsbKeyboardDevice->CapsOn != 0) {
|
||||||
|
|
||||||
if (Key->UnicodeChar == KeyDescriptor->Unicode) {
|
if (Key->UnicodeChar == KeyDescriptor->Unicode) {
|
||||||
|
|
||||||
|
@ -1615,7 +1581,7 @@ USBKeyCodeToEFIScanCode (
|
||||||
//
|
//
|
||||||
// Translate the CTRL-Alpha characters to their corresponding control value (ctrl-a = 0x0001 through ctrl-Z = 0x001A)
|
// Translate the CTRL-Alpha characters to their corresponding control value (ctrl-a = 0x0001 through ctrl-Z = 0x001A)
|
||||||
//
|
//
|
||||||
if (UsbKeyboardDevice->CtrlOn) {
|
if (UsbKeyboardDevice->CtrlOn != 0) {
|
||||||
if (Key->UnicodeChar >= 'a' && Key->UnicodeChar <= 'z') {
|
if (Key->UnicodeChar >= 'a' && Key->UnicodeChar <= 'z') {
|
||||||
Key->UnicodeChar = (UINT8) (Key->UnicodeChar - 'a' + 1);
|
Key->UnicodeChar = (UINT8) (Key->UnicodeChar - 'a' + 1);
|
||||||
} else if (Key->UnicodeChar >= 'A' && Key->UnicodeChar <= 'Z') {
|
} else if (Key->UnicodeChar >= 'A' && Key->UnicodeChar <= 'Z') {
|
||||||
|
@ -1625,7 +1591,7 @@ USBKeyCodeToEFIScanCode (
|
||||||
|
|
||||||
if (KeyDescriptor->AffectedAttribute & EFI_AFFECTED_BY_NUM_LOCK) {
|
if (KeyDescriptor->AffectedAttribute & EFI_AFFECTED_BY_NUM_LOCK) {
|
||||||
|
|
||||||
if (UsbKeyboardDevice->NumLockOn && !UsbKeyboardDevice->ShiftOn) {
|
if ((UsbKeyboardDevice->NumLockOn != 0) && (UsbKeyboardDevice->ShiftOn == 0)) {
|
||||||
|
|
||||||
Key->ScanCode = SCAN_NULL;
|
Key->ScanCode = SCAN_NULL;
|
||||||
|
|
||||||
|
@ -1696,16 +1662,16 @@ USBKeyCodeToEFIScanCode (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Resets USB Keyboard Buffer.
|
Resets USB Keyboard Buffer.
|
||||||
|
|
||||||
@param KeyboardBuffer Points to the USB Keyboard Buffer.
|
@param KeyboardBuffer Points to the USB Keyboard Buffer.
|
||||||
|
|
||||||
@retval EFI_SUCCESS Success
|
@retval EFI_SUCCESS Init key buffer successfully.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
InitUSBKeyBuffer (
|
InitUSBKeyBuffer (
|
||||||
IN OUT USB_KB_BUFFER *KeyboardBuffer
|
IN OUT USB_KB_BUFFER *KeyboardBuffer
|
||||||
)
|
)
|
||||||
|
@ -1723,9 +1689,12 @@ InitUSBKeyBuffer (
|
||||||
|
|
||||||
@param KeyboardBuffer USB Keyboard Buffer.
|
@param KeyboardBuffer USB Keyboard Buffer.
|
||||||
|
|
||||||
|
@retval TRUE Key buffer is empty.
|
||||||
|
@retval FALSE Key buffer is not empty.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
IsUSBKeyboardBufferEmpty (
|
IsUSBKeyboardBufferEmpty (
|
||||||
IN USB_KB_BUFFER *KeyboardBuffer
|
IN USB_KB_BUFFER *KeyboardBuffer
|
||||||
)
|
)
|
||||||
|
@ -1737,15 +1706,17 @@ IsUSBKeyboardBufferEmpty (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether USB Keyboard buffer is full.
|
Check whether USB Keyboard buffer is full.
|
||||||
|
|
||||||
@param KeyboardBuffer USB Keyboard Buffer.
|
@param KeyboardBuffer USB Keyboard Buffer.
|
||||||
|
|
||||||
|
@retval TRUE Key buffer is full.
|
||||||
|
@retval FALSE Key buffer is not full.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
IsUSBKeyboardBufferFull (
|
IsUSBKeyboardBufferFull (
|
||||||
IN USB_KB_BUFFER *KeyboardBuffer
|
IN USB_KB_BUFFER *KeyboardBuffer
|
||||||
)
|
)
|
||||||
|
@ -1755,7 +1726,6 @@ IsUSBKeyboardBufferFull (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Inserts a key code into keyboard buffer.
|
Inserts a key code into keyboard buffer.
|
||||||
|
|
||||||
|
@ -1767,6 +1737,7 @@ IsUSBKeyboardBufferFull (
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
InsertKeyCode (
|
InsertKeyCode (
|
||||||
IN OUT USB_KB_BUFFER *KeyboardBuffer,
|
IN OUT USB_KB_BUFFER *KeyboardBuffer,
|
||||||
IN UINT8 Key,
|
IN UINT8 Key,
|
||||||
|
@ -1806,6 +1777,7 @@ InsertKeyCode (
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
RemoveKeyCode (
|
RemoveKeyCode (
|
||||||
IN OUT USB_KB_BUFFER *KeyboardBuffer,
|
IN OUT USB_KB_BUFFER *KeyboardBuffer,
|
||||||
OUT USB_KEY *UsbKey
|
OUT USB_KEY *UsbKey
|
||||||
|
@ -1836,6 +1808,7 @@ RemoveKeyCode (
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
SetKeyLED (
|
SetKeyLED (
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
)
|
)
|
|
@ -0,0 +1,260 @@
|
||||||
|
/** @file
|
||||||
|
|
||||||
|
Function prototype for USB Keyboard Driver.
|
||||||
|
|
||||||
|
Copyright (c) 2004 - 2008, Intel Corporation
|
||||||
|
All rights reserved. This program and the accompanying materials
|
||||||
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _EFI_KEYBOARD_H_
|
||||||
|
#define _EFI_KEYBOARD_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include "EfiKey.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
Uses USB I/O to check whether the device is a USB Keyboard device.
|
||||||
|
|
||||||
|
@param UsbIo Points to a USB I/O protocol instance.
|
||||||
|
@retval None
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
IsUSBKeyboard (
|
||||||
|
IN EFI_USB_IO_PROTOCOL *UsbIo
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize USB Keyboard device and all private data structures.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Initialization is successful.
|
||||||
|
@retval EFI_DEVICE_ERROR Configure hardware failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
InitUSBKeyboard (
|
||||||
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Initialize USB Keyboard layout.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Initialization Success.
|
||||||
|
@retval Other Keyboard layout initial failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
InitKeyboardLayout (
|
||||||
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Destroy resources for Keyboard layout.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
ReleaseKeyboardLayoutResources (
|
||||||
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Handler function for USB Keyboard's asynchronous interrupt transfer.
|
||||||
|
|
||||||
|
@param Data A pointer to a buffer that is filled with key data which is
|
||||||
|
retrieved via asynchronous interrupt transfer.
|
||||||
|
@param DataLength Indicates the size of the data buffer.
|
||||||
|
@param Context Pointing to USB_KB_DEV instance.
|
||||||
|
@param Result Indicates the result of the asynchronous interrupt transfer.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Handler is successful.
|
||||||
|
@retval EFI_DEVICE_ERROR Hardware Error
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
KeyboardHandler (
|
||||||
|
IN VOID *Data,
|
||||||
|
IN UINTN DataLength,
|
||||||
|
IN VOID *Context,
|
||||||
|
IN UINT32 Result
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Timer handler for Delayed Recovery timer.
|
||||||
|
|
||||||
|
@param Event The Delayed Recovery event.
|
||||||
|
@param Context Points to the USB_KB_DEV instance.
|
||||||
|
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
USBKeyboardRecoveryHandler (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves a key character after parsing the raw data in keyboard buffer.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
@param KeyChar Points to the Key character after key parsing.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Parse key is successful.
|
||||||
|
@retval EFI_NOT_READY Device is not ready.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
USBParseKey (
|
||||||
|
IN OUT USB_KB_DEV *UsbKeyboardDevice,
|
||||||
|
OUT UINT8 *KeyChar
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Converts USB Keyboard code to EFI Scan Code.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
@param KeyChar Indicates the key code that will be interpreted.
|
||||||
|
@param Key A pointer to a buffer that is filled in with
|
||||||
|
the keystroke information for the key that
|
||||||
|
was pressed.
|
||||||
|
|
||||||
|
@retval EFI_NOT_READY Device is not ready
|
||||||
|
@retval EFI_SUCCESS Success.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
USBKeyCodeToEFIScanCode (
|
||||||
|
IN USB_KB_DEV *UsbKeyboardDevice,
|
||||||
|
IN UINT8 KeyChar,
|
||||||
|
OUT EFI_INPUT_KEY *Key
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Resets USB Keyboard Buffer.
|
||||||
|
|
||||||
|
@param KeyboardBuffer Points to the USB Keyboard Buffer.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Init key buffer successfully.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
InitUSBKeyBuffer (
|
||||||
|
IN OUT USB_KB_BUFFER *KeyboardBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check whether USB Keyboard buffer is empty.
|
||||||
|
|
||||||
|
@param KeyboardBuffer USB Keyboard Buffer.
|
||||||
|
|
||||||
|
@retval TRUE Key buffer is empty.
|
||||||
|
@retval FALSE Key buffer is not empty.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
IsUSBKeyboardBufferEmpty (
|
||||||
|
IN USB_KB_BUFFER *KeyboardBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Check whether USB Keyboard buffer is full.
|
||||||
|
|
||||||
|
@param KeyboardBuffer USB Keyboard Buffer.
|
||||||
|
|
||||||
|
@retval TRUE Key buffer is full.
|
||||||
|
@retval FALSE Key buffer is not full.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
IsUSBKeyboardBufferFull (
|
||||||
|
IN USB_KB_BUFFER *KeyboardBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Inserts a key code into keyboard buffer.
|
||||||
|
|
||||||
|
@param KeyboardBuffer Points to the USB Keyboard Buffer.
|
||||||
|
@param Key Key code
|
||||||
|
@param Down Special key
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Success
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
InsertKeyCode (
|
||||||
|
IN OUT USB_KB_BUFFER *KeyboardBuffer,
|
||||||
|
IN UINT8 Key,
|
||||||
|
IN UINT8 Down
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pops a key code off from keyboard buffer.
|
||||||
|
|
||||||
|
@param KeyboardBuffer Points to the USB Keyboard Buffer.
|
||||||
|
@param UsbKey Points to the buffer that contains a usb key code.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Success
|
||||||
|
@retval EFI_DEVICE_ERROR Hardware Error
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
RemoveKeyCode (
|
||||||
|
IN OUT USB_KB_BUFFER *KeyboardBuffer,
|
||||||
|
OUT USB_KEY *UsbKey
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Timer handler for Repeat Key timer.
|
||||||
|
|
||||||
|
@param Event The Repeat Key event.
|
||||||
|
@param Context Points to the USB_KB_DEV instance.
|
||||||
|
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
USBKeyboardRepeatHandler (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets USB Keyboard LED state.
|
||||||
|
|
||||||
|
@param UsbKeyboardDevice The USB_KB_DEV instance.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Success
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
SetKeyLED (
|
||||||
|
IN USB_KB_DEV *UsbKeyboardDevice
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
|
@ -33,11 +33,11 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
[Sources.common]
|
[Sources.common]
|
||||||
efikey.c
|
EfiKey.c
|
||||||
efikey.h
|
EfiKey.h
|
||||||
keyboard.c
|
KeyBoard.c
|
||||||
ComponentName.c
|
ComponentName.c
|
||||||
keyboard.h
|
KeyBoard.h
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
|
@ -1,118 +0,0 @@
|
||||||
/** @file
|
|
||||||
Copyright (c) 2004 - 2005, Intel Corporation
|
|
||||||
All rights reserved. This program and the accompanying materials
|
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
Keyboard.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Function prototype for USB Keyboard Driver
|
|
||||||
|
|
||||||
Revision History
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef _KEYBOARD_H
|
|
||||||
#define _KEYBOARD_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "efikey.h"
|
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
IsUSBKeyboard (
|
|
||||||
IN EFI_USB_IO_PROTOCOL *UsbIo
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
InitUSBKeyboard (
|
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
InitKeyboardLayout (
|
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
ReleaseKeyboardLayoutResources (
|
|
||||||
USB_KB_DEV *UsbKeyboardDevice
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
KeyboardHandler (
|
|
||||||
IN VOID *Data,
|
|
||||||
IN UINTN DataLength,
|
|
||||||
IN VOID *Context,
|
|
||||||
IN UINT32 Result
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
USBKeyboardRecoveryHandler (
|
|
||||||
IN EFI_EVENT Event,
|
|
||||||
IN VOID *Context
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
USBParseKey (
|
|
||||||
IN OUT USB_KB_DEV *UsbKeyboardDevice,
|
|
||||||
OUT UINT8 *KeyChar
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
USBKeyCodeToEFIScanCode (
|
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice,
|
|
||||||
IN UINT8 KeyChar,
|
|
||||||
OUT EFI_INPUT_KEY *Key
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
InitUSBKeyBuffer (
|
|
||||||
IN OUT USB_KB_BUFFER *KeyboardBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
IsUSBKeyboardBufferEmpty (
|
|
||||||
IN USB_KB_BUFFER *KeyboardBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
BOOLEAN
|
|
||||||
IsUSBKeyboardBufferFull (
|
|
||||||
IN USB_KB_BUFFER *KeyboardBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
InsertKeyCode (
|
|
||||||
IN OUT USB_KB_BUFFER *KeyboardBuffer,
|
|
||||||
IN UINT8 Key,
|
|
||||||
IN UINT8 Down
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
RemoveKeyCode (
|
|
||||||
IN OUT USB_KB_BUFFER *KeyboardBuffer,
|
|
||||||
OUT USB_KEY *UsbKey
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
USBKeyboardRepeatHandler (
|
|
||||||
IN EFI_EVENT Event,
|
|
||||||
IN VOID *Context
|
|
||||||
);
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
SetKeyLED (
|
|
||||||
IN USB_KB_DEV *UsbKeyboardDevice
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue