TianoCore EDK2 master
|
#include "KeyBoard.h"
Go to the source code of this file.
Variables | |
USB_KEYBOARD_LAYOUT_PACK_BIN | mUsbKeyboardLayoutBin |
UINT8 | EfiKeyToUsbKeyCodeConvertionTable [] |
UINT8 | ModifierValueToEfiScanCodeConvertionTable [] |
Helper functions for USB Keyboard Driver.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file KeyBoard.c.
EFI_STATUS Dequeue | ( | IN OUT USB_SIMPLE_QUEUE * | Queue, |
OUT VOID * | Item, | ||
IN UINTN | ItemSize | ||
) |
Dequeue a item from the queue.
Queue | Points to the queue. |
Item | Receives the item. |
ItemSize | Size of the item. |
EFI_SUCCESS | Item was successfully dequeued. |
EFI_DEVICE_ERROR | The queue is empty. |
Definition at line 1830 of file KeyBoard.c.
VOID DestroyQueue | ( | IN OUT USB_SIMPLE_QUEUE * | Queue | ) |
Enqueue the item to the queue.
Queue | Points to the queue. |
Item | Points to the item to be enqueued. |
ItemSize | Size of the item. |
Definition at line 1795 of file KeyBoard.c.
EFI_KEY_DESCRIPTOR * FindPhysicalKey | ( | IN USB_NS_KEY * | UsbNsKey, |
IN EFI_KEY_DESCRIPTOR * | KeyDescriptor | ||
) |
Find physical key definition for a given key descriptor.
For a specified non-spacing key, there are a list of physical keys following it. This function traverses the list of physical keys and tries to find the physical key matching the KeyDescriptor.
UsbNsKey | The non-spacing key information. |
KeyDescriptor | The key descriptor. |
Definition at line 544 of file KeyBoard.c.
USB_NS_KEY * FindUsbNsKey | ( | IN USB_KB_DEV * | UsbKeyboardDevice, |
IN EFI_KEY_DESCRIPTOR * | KeyDescriptor | ||
) |
Find Non-Spacing key for given Key descriptor.
UsbKeyboardDevice | The USB_KB_DEV instance. |
KeyDescriptor | Key descriptor. |
Definition at line 504 of file KeyBoard.c.
EFI_HII_KEYBOARD_LAYOUT * GetCurrentKeyboardLayout | ( | VOID | ) |
Get current keyboard layout from HII database.
Definition at line 405 of file KeyBoard.c.
EFI_KEY_DESCRIPTOR * GetKeyDescriptor | ( | IN USB_KB_DEV * | UsbKeyboardDevice, |
IN UINT8 | KeyCode | ||
) |
Find Key Descriptor in Key Convertion Table given its USB keycode.
UsbKeyboardDevice | The USB_KB_DEV instance. |
KeyCode | USB Keycode. |
Definition at line 467 of file KeyBoard.c.
VOID InitializeKeyState | ( | IN USB_KB_DEV * | UsbKeyboardDevice, |
OUT EFI_KEY_STATE * | KeyState | ||
) |
Initialize the key state.
UsbKeyboardDevice | The USB_KB_DEV instance. |
KeyState | A pointer to receive the key state information. |
Definition at line 1482 of file KeyBoard.c.
EFI_STATUS InitKeyboardLayout | ( | OUT USB_KB_DEV * | UsbKeyboardDevice | ) |
Initialize USB keyboard layout.
This function initializes Key Convertion Table for the USB keyboard device. It first tries to retrieve layout from HII database. If failed and default layout is enabled, then it just uses the default layout.
UsbKeyboardDevice | The USB_KB_DEV instance. |
EFI_SUCCESS | Initialization succeeded. |
EFI_NOT_READY | Keyboard layout cannot be retrieve from HII database, and default layout is disabled. |
Other | Fail to register event to EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group. |
Definition at line 737 of file KeyBoard.c.
VOID InitQueue | ( | IN OUT USB_SIMPLE_QUEUE * | Queue, |
IN UINTN | ItemSize | ||
) |
Create the queue.
Queue | Points to the queue. |
ItemSize | Size of the single item. |
Definition at line 1714 of file KeyBoard.c.
EFI_STATUS InitUSBKeyboard | ( | IN OUT USB_KB_DEV * | UsbKeyboardDevice | ) |
Initialize USB keyboard device and all private data structures.
UsbKeyboardDevice | The USB_KB_DEV instance. |
EFI_SUCCESS | Initialization is successful. |
EFI_DEVICE_ERROR | Keyboard initialization failed. |
Definition at line 803 of file KeyBoard.c.
EFI_STATUS InstallDefaultKeyboardLayout | ( | IN OUT USB_KB_DEV * | UsbKeyboardDevice | ) |
Initialize Key Convention Table by using default keyboard layout.
UsbKeyboardDevice | The USB_KB_DEV instance. |
EFI_SUCCESS | The default keyboard layout was installed successfully |
Others | Failure to install default keyboard layout. |
Definition at line 316 of file KeyBoard.c.
BOOLEAN IsQueueEmpty | ( | IN USB_SIMPLE_QUEUE * | Queue | ) |
Check whether the queue is empty.
Queue | Points to the queue. |
TRUE | Queue is empty. |
FALSE | Queue is not empty. |
Definition at line 1760 of file KeyBoard.c.
BOOLEAN IsQueueFull | ( | IN USB_SIMPLE_QUEUE * | Queue | ) |
Check whether the queue is full.
Queue | Points to the queue. |
TRUE | Queue is full. |
FALSE | Queue is not full. |
Definition at line 1780 of file KeyBoard.c.
BOOLEAN IsUSBKeyboard | ( | IN EFI_USB_IO_PROTOCOL * | UsbIo | ) |
Uses USB I/O to check whether the device is a USB keyboard device.
UsbIo | Pointer to a USB I/O protocol instance. |
TRUE | Device is a USB keyboard device. |
FALSE | Device is a not USB keyboard device. |
Definition at line 367 of file KeyBoard.c.
EFI_STATUS EFIAPI KeyboardHandler | ( | IN VOID * | Data, |
IN UINTN | DataLength, | ||
IN VOID * | Context, | ||
IN UINT32 | Result | ||
) |
Handler function for USB keyboard's asynchronous interrupt transfer.
This function is the handler function for USB keyboard's asynchronous interrupt transfer to manage the keyboard. It parses the USB keyboard input report, and inserts data to keyboard buffer according to state of modifer keys and normal keys. Timer for repeat key is also set accordingly.
Data | A pointer to a buffer that is filled with key data which is retrieved via asynchronous interrupt transfer. |
DataLength | Indicates the size of the data buffer. |
Context | Pointing to USB_KB_DEV instance. |
Result | Indicates the result of the asynchronous interrupt transfer. |
EFI_SUCCESS | Asynchronous interrupt transfer is handled successfully. |
EFI_DEVICE_ERROR | Hardware error occurs. |
Definition at line 950 of file KeyBoard.c.
VOID ReleaseKeyboardLayoutResources | ( | IN OUT USB_KB_DEV * | UsbKeyboardDevice | ) |
Destroy resources for keyboard layout.
UsbKeyboardDevice | The USB_KB_DEV instance. |
Definition at line 698 of file KeyBoard.c.
The notification function for EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID.
This function is registered to event of EFI_HII_SET_KEYBOARD_LAYOUT_EVENT_GUID group type, which will be triggered by EFI_HII_DATABASE_PROTOCOL.SetKeyboardLayout(). It tries to get current keyboard layout from HII database.
Event | Event being signaled. |
Context | Points to USB_KB_DEV instance. |
Definition at line 580 of file KeyBoard.c.
VOID SetKeyLED | ( | IN USB_KB_DEV * | UsbKeyboardDevice | ) |
Sets USB keyboard LED state.
UsbKeyboardDevice | The USB_KB_DEV instance. |
Definition at line 1859 of file KeyBoard.c.
Handler for Delayed Recovery event.
This function is the handler for Delayed Recovery event triggered by timer. After a device error occurs, the event would be triggered with interval of EFI_USB_INTERRUPT_DELAY. EFI_USB_INTERRUPT_DELAY is defined in USB standard for error handling.
Event | The Delayed Recovery event. |
Context | Points to the USB_KB_DEV instance. |
Definition at line 1950 of file KeyBoard.c.
Handler for Repeat Key event.
This function is the handler for Repeat Key event triggered by timer. After a repeatable key is pressed, the event would be triggered with interval of USBKBD_REPEAT_DELAY. Once the event is triggered, following trigger will come with interval of USBKBD_REPEAT_RATE.
Event | The Repeat Key event. |
Context | Points to the USB_KB_DEV instance. |
Definition at line 1903 of file KeyBoard.c.
EFI_STATUS UsbKeyCodeToEfiInputKey | ( | IN USB_KB_DEV * | UsbKeyboardDevice, |
IN UINT8 | KeyCode, | ||
OUT EFI_KEY_DATA * | KeyData | ||
) |
Converts USB Keycode ranging from 0x4 to 0x65 to EFI_INPUT_KEY.
UsbKeyboardDevice | The USB_KB_DEV instance. |
KeyCode | Indicates the key code that will be interpreted. |
KeyData | A pointer to a buffer that is filled in with the keystroke information for the key that was pressed. |
EFI_SUCCESS | Success. |
EFI_INVALID_PARAMETER | KeyCode is not in the range of 0x4 to 0x65. |
EFI_INVALID_PARAMETER | Translated EFI_INPUT_KEY has zero for both ScanCode and UnicodeChar. |
EFI_NOT_READY | KeyCode represents a dead key with EFI_NS_KEY_MODIFIER |
EFI_DEVICE_ERROR | Keyboard layout is invalid. |
Definition at line 1564 of file KeyBoard.c.
EFI_STATUS USBParseKey | ( | IN OUT USB_KB_DEV * | UsbKeyboardDevice, |
OUT UINT8 * | KeyCode | ||
) |
Retrieves a USB keycode after parsing the raw data in keyboard buffer.
This function parses keyboard buffer. It updates state of modifier key for USB_KB_DEV instancem, and returns keycode for output.
UsbKeyboardDevice | The USB_KB_DEV instance. |
KeyCode | Pointer to the USB keycode for output. |
EFI_SUCCESS | Keycode successfully parsed. |
EFI_NOT_READY | Keyboard buffer is not ready for a valid keycode |
Definition at line 1250 of file KeyBoard.c.
UINT8 EfiKeyToUsbKeyCodeConvertionTable[] |
Definition at line 147 of file KeyBoard.c.
UINT8 ModifierValueToEfiScanCodeConvertionTable[] |
Definition at line 259 of file KeyBoard.c.
USB_KEYBOARD_LAYOUT_PACK_BIN mUsbKeyboardLayoutBin |
Definition at line 11 of file KeyBoard.c.