iPXE
SimpleTextInEx.h
Go to the documentation of this file.
1/** @file
2 Simple Text Input Ex protocol from the UEFI 2.0 specification.
3
4 This protocol defines an extension to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
5 which exposes much more state and modifier information from the input device,
6 also allows one to register a notification for a particular keystroke.
7
8 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
9 SPDX-License-Identifier: BSD-2-Clause-Patent
10
11**/
12
13#pragma once
14
15FILE_LICENCE ( BSD2_PATENT );
16FILE_SECBOOT ( PERMITTED );
17
19
20#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
21 {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }
22
24
25/**
26 The Reset() function resets the input device hardware. As part
27 of initialization process, the firmware/device will make a quick
28 but reasonable attempt to verify that the device is functioning.
29 If the ExtendedVerification flag is TRUE the firmware may take
30 an extended amount of time to verify the device is operating on
31 reset. Otherwise the reset operation is to occur as quickly as
32 possible. The hardware verification process is not defined by
33 this specification and is left up to the platform firmware or
34 driver to implement.
35
36 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
37
38 @param ExtendedVerification Indicates that the driver may
39 perform a more exhaustive
40 verification operation of the
41 device during reset.
42
43
44 @retval EFI_SUCCESS The device was reset.
45
46 @retval EFI_DEVICE_ERROR The device is not functioning
47 correctly and could not be reset.
48
49**/
50typedef
54 IN BOOLEAN ExtendedVerification
55 );
56
57///
58/// EFI_KEY_TOGGLE_STATE. The toggle states are defined.
59/// They are: EFI_TOGGLE_STATE_VALID, EFI_SCROLL_LOCK_ACTIVE
60/// EFI_NUM_LOCK_ACTIVE, EFI_CAPS_LOCK_ACTIVE
61///
63
64typedef struct _EFI_KEY_STATE {
65 ///
66 /// Reflects the currently pressed shift
67 /// modifiers for the input device. The
68 /// returned value is valid only if the high
69 /// order bit has been set.
70 ///
72 ///
73 /// Reflects the current internal state of
74 /// various toggled attributes. The returned
75 /// value is valid only if the high order
76 /// bit has been set.
77 ///
80
81typedef struct {
82 ///
83 /// The EFI scan code and Unicode value returned from the input device.
84 ///
86 ///
87 /// The current state of various toggled attributes as well as input modifier values.
88 ///
91
92//
93// Any Shift or Toggle State that is valid should have
94// high order bit set.
95//
96// Shift state
97//
98#define EFI_SHIFT_STATE_VALID 0x80000000
99#define EFI_RIGHT_SHIFT_PRESSED 0x00000001
100#define EFI_LEFT_SHIFT_PRESSED 0x00000002
101#define EFI_RIGHT_CONTROL_PRESSED 0x00000004
102#define EFI_LEFT_CONTROL_PRESSED 0x00000008
103#define EFI_RIGHT_ALT_PRESSED 0x00000010
104#define EFI_LEFT_ALT_PRESSED 0x00000020
105#define EFI_RIGHT_LOGO_PRESSED 0x00000040
106#define EFI_LEFT_LOGO_PRESSED 0x00000080
107#define EFI_MENU_KEY_PRESSED 0x00000100
108#define EFI_SYS_REQ_PRESSED 0x00000200
109
110//
111// Toggle state
112//
113#define EFI_TOGGLE_STATE_VALID 0x80
114#define EFI_KEY_STATE_EXPOSED 0x40
115#define EFI_SCROLL_LOCK_ACTIVE 0x01
116#define EFI_NUM_LOCK_ACTIVE 0x02
117#define EFI_CAPS_LOCK_ACTIVE 0x04
118
119//
120// EFI Scan codes
121//
122#define SCAN_F11 0x0015
123#define SCAN_F12 0x0016
124#define SCAN_PAUSE 0x0048
125#define SCAN_F13 0x0068
126#define SCAN_F14 0x0069
127#define SCAN_F15 0x006A
128#define SCAN_F16 0x006B
129#define SCAN_F17 0x006C
130#define SCAN_F18 0x006D
131#define SCAN_F19 0x006E
132#define SCAN_F20 0x006F
133#define SCAN_F21 0x0070
134#define SCAN_F22 0x0071
135#define SCAN_F23 0x0072
136#define SCAN_F24 0x0073
137#define SCAN_MUTE 0x007F
138#define SCAN_VOLUME_UP 0x0080
139#define SCAN_VOLUME_DOWN 0x0081
140#define SCAN_BRIGHTNESS_UP 0x0100
141#define SCAN_BRIGHTNESS_DOWN 0x0101
142#define SCAN_SUSPEND 0x0102
143#define SCAN_HIBERNATE 0x0103
144#define SCAN_TOGGLE_DISPLAY 0x0104
145#define SCAN_RECOVERY 0x0105
146#define SCAN_EJECT 0x0106
147
148/**
149 The function reads the next keystroke from the input device. If
150 there is no pending keystroke the function returns
151 EFI_NOT_READY. If there is a pending keystroke, then
152 KeyData.Key.ScanCode is the EFI scan code defined in Error!
153 Reference source not found. The KeyData.Key.UnicodeChar is the
154 actual printable character or is zero if the key does not
155 represent a printable character (control key, function key,
156 etc.). The KeyData.KeyState is shift state for the character
157 reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
158 When interpreting the data from this function, it should be
159 noted that if a class of printable characters that are
160 normally adjusted by shift modifiers (e.g. Shift Key + "f"
161 key) would be presented solely as a KeyData.Key.UnicodeChar
162 without the associated shift state. So in the previous example
163 of a Shift Key + "f" key being pressed, the only pertinent
164 data returned would be KeyData.Key.UnicodeChar with the value
165 of "F". This of course would not typically be the case for
166 non-printable characters such as the pressing of the Right
167 Shift Key + F10 key since the corresponding returned data
168 would be reflected both in the KeyData.KeyState.KeyShiftState
169 and KeyData.Key.ScanCode values. UEFI drivers which implement
170 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
171 KeyData.Key and KeyData.KeyState values. These drivers must
172 always return the most current state of
173 KeyData.KeyState.KeyShiftState and
174 KeyData.KeyState.KeyToggleState. It should also be noted that
175 certain input devices may not be able to produce shift or toggle
176 state information, and in those cases the high order bit in the
177 respective Toggle and Shift state fields should not be active.
178
179
180 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
181
182 @param KeyData A pointer to a buffer that is filled in with
183 the keystroke state data for the key that was
184 pressed.
185
186
187 @retval EFI_SUCCESS The keystroke information was returned.
188 @retval EFI_NOT_READY There was no keystroke data available.
189 @retval EFI_DEVICE_ERROR The keystroke information was not returned due to
190 hardware errors.
191 @retval EFI_UNSUPPORTED The device does not support the ability to read keystroke data.
192
193
194**/
195typedef
199 OUT EFI_KEY_DATA *KeyData
200 );
201
202/**
203 The SetState() function allows the input device hardware to
204 have state settings adjusted.
205
206 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
207
208 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
209 set the state for the input device.
210
211
212 @retval EFI_SUCCESS The device state was set appropriately.
213
214 @retval EFI_DEVICE_ERROR The device is not functioning
215 correctly and could not have the
216 setting adjusted.
217
218 @retval EFI_UNSUPPORTED The device does not support the
219 ability to have its state set.
220
221**/
222typedef
226 IN EFI_KEY_TOGGLE_STATE *KeyToggleState
227 );
228
229///
230/// The function will be called when the key sequence is typed specified by KeyData.
231///
232typedef
235 IN EFI_KEY_DATA *KeyData
236 );
237
238/**
239 The RegisterKeystrokeNotify() function registers a function
240 which will be called when a specified keystroke will occur.
241
242 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
243
244 @param KeyData A pointer to a buffer that is filled in with
245 the keystroke information for the key that was
246 pressed. If KeyData.Key, KeyData.KeyState.KeyToggleState
247 and KeyData.KeyState.KeyShiftState are 0, then any incomplete
248 keystroke will trigger a notification of the KeyNotificationFunction.
249
250 @param KeyNotificationFunction Points to the function to be called when the key sequence
251 is typed specified by KeyData. This notification function
252 should be called at <=TPL_CALLBACK.
253
254
255 @param NotifyHandle Points to the unique handle assigned to
256 the registered notification.
257
258 @retval EFI_SUCCESS Key notify was registered successfully.
259
260 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
261 data structures.
262
263**/
264typedef
268 IN EFI_KEY_DATA *KeyData,
269 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,
270 OUT VOID **NotifyHandle
271 );
272
273/**
274 The UnregisterKeystrokeNotify() function removes the
275 notification which was previously registered.
276
277 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.
278
279 @param NotificationHandle The handle of the notification
280 function being unregistered.
281
282 @retval EFI_SUCCESS Key notify was unregistered successfully.
283
284 @retval EFI_INVALID_PARAMETER The NotificationHandle is
285 invalid.
286
287**/
288typedef
292 IN VOID *NotificationHandle
293 );
294
295///
296/// The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
297/// device. It is an extension to the Simple Text Input protocol
298/// which allows a variety of extended shift state information to be
299/// returned.
300///
312
unsigned char BOOLEAN
Logical Boolean.
#define EFIAPI
unsigned char UINT8
1-byte unsigned value.
unsigned int UINT32
4-byte unsigned value.
#define VOID
Undeclared type.
Definition Base.h:271
EFI_GUID gEfiSimpleTextInputExProtocolGuid
struct _EFI_KEY_STATE EFI_KEY_STATE
UINT8 EFI_KEY_TOGGLE_STATE
EFI_KEY_TOGGLE_STATE.
struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
EFI_STATUS(EFIAPI * EFI_INPUT_RESET_EX)(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
The Reset() function resets the input device hardware.
EFI_STATUS(EFIAPI * EFI_KEY_NOTIFY_FUNCTION)(IN EFI_KEY_DATA *KeyData)
The function will be called when the key sequence is typed specified by KeyData.
EFI_STATUS(EFIAPI * EFI_INPUT_READ_KEY_EX)(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, OUT EFI_KEY_DATA *KeyData)
The function reads the next keystroke from the input device.
EFI_STATUS(EFIAPI * EFI_SET_STATE)(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_TOGGLE_STATE *KeyToggleState)
The SetState() function allows the input device hardware to have state settings adjusted.
EFI_STATUS(EFIAPI * EFI_REGISTER_KEYSTROKE_NOTIFY)(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_DATA *KeyData, IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, OUT VOID **NotifyHandle)
The RegisterKeystrokeNotify() function registers a function which will be called when a specified key...
EFI_STATUS(EFIAPI * EFI_UNREGISTER_KEYSTROKE_NOTIFY)(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN VOID *NotificationHandle)
The UnregisterKeystrokeNotify() function removes the notification which was previously registered.
Simple Text Input protocol from the UEFI 2.0 specification.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
GUID EFI_GUID
128-bit buffer containing a unique identifier value.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:921
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:951
#define EFI_EVENT
Definition efi.h:54
#define IN
Definition mlx_utils.h:28
#define OUT
Definition mlx_utils.h:29
The keystroke information for the key that was pressed.
EFI_INPUT_KEY Key
The EFI scan code and Unicode value returned from the input device.
EFI_KEY_STATE KeyState
The current state of various toggled attributes as well as input modifier values.
EFI_KEY_TOGGLE_STATE KeyToggleState
Reflects the current internal state of various toggled attributes.
UINT32 KeyShiftState
Reflects the currently pressed shift modifiers for the input device.
The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn device.
EFI_EVENT WaitForKeyEx
Event to use with WaitForEvent() to wait for a key to be available.
EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx
EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify
EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify