TianoCore EDK2 master
|
#include "EfiKey.h"
Go to the source code of this file.
Data Structures | |
struct | USB_KEYBOARD_LAYOUT_PACK_BIN |
Macros | |
#define | USB_KEYBOARD_KEY_COUNT 105 |
#define | USB_KEYBOARD_LANGUAGE_STR_LEN 5 |
#define | USB_KEYBOARD_DESCRIPTION_STR_LEN (16 + 1) |
Function prototype for USB Keyboard Driver.
Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file KeyBoard.h.
#define USB_KEYBOARD_DESCRIPTION_STR_LEN (16 + 1) |
Definition at line 17 of file KeyBoard.h.
#define USB_KEYBOARD_KEY_COUNT 105 |
Definition at line 14 of file KeyBoard.h.
#define USB_KEYBOARD_LANGUAGE_STR_LEN 5 |
Definition at line 16 of file KeyBoard.h.
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.
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.
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 modifier 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. |
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.
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.