Path: blob/main/sys/contrib/edk2/Include/Protocol/SimpleTextInEx.h
48383 views
/** @file1Simple Text Input Ex protocol from the UEFI 2.0 specification.23This protocol defines an extension to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL4which exposes much more state and modifier information from the input device,5also allows one to register a notification for a particular keystroke.67Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>8SPDX-License-Identifier: BSD-2-Clause-Patent910**/1112#ifndef __SIMPLE_TEXT_IN_EX_H__13#define __SIMPLE_TEXT_IN_EX_H__1415#include <Protocol/SimpleTextIn.h>1617#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \18{0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }1920typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL;2122/**23The Reset() function resets the input device hardware. As part24of initialization process, the firmware/device will make a quick25but reasonable attempt to verify that the device is functioning.26If the ExtendedVerification flag is TRUE the firmware may take27an extended amount of time to verify the device is operating on28reset. Otherwise the reset operation is to occur as quickly as29possible. The hardware verification process is not defined by30this specification and is left up to the platform firmware or31driver to implement.3233@param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.3435@param ExtendedVerification Indicates that the driver may36perform a more exhaustive37verification operation of the38device during reset.394041@retval EFI_SUCCESS The device was reset.4243@retval EFI_DEVICE_ERROR The device is not functioning44correctly and could not be reset.4546**/47typedef48EFI_STATUS49(EFIAPI *EFI_INPUT_RESET_EX)(50IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,51IN BOOLEAN ExtendedVerification52);5354///55/// EFI_KEY_TOGGLE_STATE. The toggle states are defined.56/// They are: EFI_TOGGLE_STATE_VALID, EFI_SCROLL_LOCK_ACTIVE57/// EFI_NUM_LOCK_ACTIVE, EFI_CAPS_LOCK_ACTIVE58///59typedef UINT8 EFI_KEY_TOGGLE_STATE;6061typedef struct _EFI_KEY_STATE {62///63/// Reflects the currently pressed shift64/// modifiers for the input device. The65/// returned value is valid only if the high66/// order bit has been set.67///68UINT32 KeyShiftState;69///70/// Reflects the current internal state of71/// various toggled attributes. The returned72/// value is valid only if the high order73/// bit has been set.74///75EFI_KEY_TOGGLE_STATE KeyToggleState;76} EFI_KEY_STATE;7778typedef struct {79///80/// The EFI scan code and Unicode value returned from the input device.81///82EFI_INPUT_KEY Key;83///84/// The current state of various toggled attributes as well as input modifier values.85///86EFI_KEY_STATE KeyState;87} EFI_KEY_DATA;8889//90// Any Shift or Toggle State that is valid should have91// high order bit set.92//93// Shift state94//95#define EFI_SHIFT_STATE_VALID 0x8000000096#define EFI_RIGHT_SHIFT_PRESSED 0x0000000197#define EFI_LEFT_SHIFT_PRESSED 0x0000000298#define EFI_RIGHT_CONTROL_PRESSED 0x0000000499#define EFI_LEFT_CONTROL_PRESSED 0x00000008100#define EFI_RIGHT_ALT_PRESSED 0x00000010101#define EFI_LEFT_ALT_PRESSED 0x00000020102#define EFI_RIGHT_LOGO_PRESSED 0x00000040103#define EFI_LEFT_LOGO_PRESSED 0x00000080104#define EFI_MENU_KEY_PRESSED 0x00000100105#define EFI_SYS_REQ_PRESSED 0x00000200106107//108// Toggle state109//110#define EFI_TOGGLE_STATE_VALID 0x80111#define EFI_KEY_STATE_EXPOSED 0x40112#define EFI_SCROLL_LOCK_ACTIVE 0x01113#define EFI_NUM_LOCK_ACTIVE 0x02114#define EFI_CAPS_LOCK_ACTIVE 0x04115116//117// EFI Scan codes118//119#define SCAN_F11 0x0015120#define SCAN_F12 0x0016121#define SCAN_PAUSE 0x0048122#define SCAN_F13 0x0068123#define SCAN_F14 0x0069124#define SCAN_F15 0x006A125#define SCAN_F16 0x006B126#define SCAN_F17 0x006C127#define SCAN_F18 0x006D128#define SCAN_F19 0x006E129#define SCAN_F20 0x006F130#define SCAN_F21 0x0070131#define SCAN_F22 0x0071132#define SCAN_F23 0x0072133#define SCAN_F24 0x0073134#define SCAN_MUTE 0x007F135#define SCAN_VOLUME_UP 0x0080136#define SCAN_VOLUME_DOWN 0x0081137#define SCAN_BRIGHTNESS_UP 0x0100138#define SCAN_BRIGHTNESS_DOWN 0x0101139#define SCAN_SUSPEND 0x0102140#define SCAN_HIBERNATE 0x0103141#define SCAN_TOGGLE_DISPLAY 0x0104142#define SCAN_RECOVERY 0x0105143#define SCAN_EJECT 0x0106144145/**146The function reads the next keystroke from the input device. If147there is no pending keystroke the function returns148EFI_NOT_READY. If there is a pending keystroke, then149KeyData.Key.ScanCode is the EFI scan code defined in Error!150Reference source not found. The KeyData.Key.UnicodeChar is the151actual printable character or is zero if the key does not152represent a printable character (control key, function key,153etc.). The KeyData.KeyState is shift state for the character154reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .155When interpreting the data from this function, it should be156noted that if a class of printable characters that are157normally adjusted by shift modifiers (e.g. Shift Key + "f"158key) would be presented solely as a KeyData.Key.UnicodeChar159without the associated shift state. So in the previous example160of a Shift Key + "f" key being pressed, the only pertinent161data returned would be KeyData.Key.UnicodeChar with the value162of "F". This of course would not typically be the case for163non-printable characters such as the pressing of the Right164Shift Key + F10 key since the corresponding returned data165would be reflected both in the KeyData.KeyState.KeyShiftState166and KeyData.Key.ScanCode values. UEFI drivers which implement167the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return168KeyData.Key and KeyData.KeyState values. These drivers must169always return the most current state of170KeyData.KeyState.KeyShiftState and171KeyData.KeyState.KeyToggleState. It should also be noted that172certain input devices may not be able to produce shift or toggle173state information, and in those cases the high order bit in the174respective Toggle and Shift state fields should not be active.175176177@param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.178179@param KeyData A pointer to a buffer that is filled in with180the keystroke state data for the key that was181pressed.182183184@retval EFI_SUCCESS The keystroke information was returned.185@retval EFI_NOT_READY There was no keystroke data available.186@retval EFI_DEVICE_ERROR The keystroke information was not returned due to187hardware errors.188@retval EFI_UNSUPPORTED The device does not support the ability to read keystroke data.189190191**/192typedef193EFI_STATUS194(EFIAPI *EFI_INPUT_READ_KEY_EX)(195IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,196OUT EFI_KEY_DATA *KeyData197);198199/**200The SetState() function allows the input device hardware to201have state settings adjusted.202203@param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.204205@param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to206set the state for the input device.207208209@retval EFI_SUCCESS The device state was set appropriately.210211@retval EFI_DEVICE_ERROR The device is not functioning212correctly and could not have the213setting adjusted.214215@retval EFI_UNSUPPORTED The device does not support the216ability to have its state set.217218**/219typedef220EFI_STATUS221(EFIAPI *EFI_SET_STATE)(222IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,223IN EFI_KEY_TOGGLE_STATE *KeyToggleState224);225226///227/// The function will be called when the key sequence is typed specified by KeyData.228///229typedef230EFI_STATUS231(EFIAPI *EFI_KEY_NOTIFY_FUNCTION)(232IN EFI_KEY_DATA *KeyData233);234235/**236The RegisterKeystrokeNotify() function registers a function237which will be called when a specified keystroke will occur.238239@param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.240241@param KeyData A pointer to a buffer that is filled in with242the keystroke information for the key that was243pressed. If KeyData.Key, KeyData.KeyState.KeyToggleState244and KeyData.KeyState.KeyShiftState are 0, then any incomplete245keystroke will trigger a notification of the KeyNotificationFunction.246247@param KeyNotificationFunction Points to the function to be called when the key sequence248is typed specified by KeyData. This notification function249should be called at <=TPL_CALLBACK.250251252@param NotifyHandle Points to the unique handle assigned to253the registered notification.254255@retval EFI_SUCCESS Key notify was registered successfully.256257@retval EFI_OUT_OF_RESOURCES Unable to allocate necessary258data structures.259260**/261typedef262EFI_STATUS263(EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY)(264IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,265IN EFI_KEY_DATA *KeyData,266IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,267OUT VOID **NotifyHandle268);269270/**271The UnregisterKeystrokeNotify() function removes the272notification which was previously registered.273274@param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.275276@param NotificationHandle The handle of the notification277function being unregistered.278279@retval EFI_SUCCESS Key notify was unregistered successfully.280281@retval EFI_INVALID_PARAMETER The NotificationHandle is282invalid.283284**/285typedef286EFI_STATUS287(EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY)(288IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,289IN VOID *NotificationHandle290);291292///293/// The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn294/// device. It is an extension to the Simple Text Input protocol295/// which allows a variety of extended shift state information to be296/// returned.297///298struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL {299EFI_INPUT_RESET_EX Reset;300EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx;301///302/// Event to use with WaitForEvent() to wait for a key to be available.303///304EFI_EVENT WaitForKeyEx;305EFI_SET_STATE SetState;306EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify;307EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify;308};309310extern EFI_GUID gEfiSimpleTextInputExProtocolGuid;311312#endif313314315