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