2 The file defines the protocol to obtain input from the
3 ConsoleIn device. The EFI specification requires that the
4 EFI_SIMPLE_TEXT_INPUT_PROTOCOL supports the same languages as
7 Copyright (c) 2006 - 2007, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 Module Name: SimpleTextInEx.h
20 #ifndef __SIMPLE_TEXT_IN_EX_H__
21 #define __SIMPLE_TEXT_IN_EX_H__
23 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
24 {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }
27 typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
;
30 The Reset() function resets the input device hardware. As part
31 of initialization process, the firmware/device will make a quick
32 but reasonable attempt to verify that the device is functioning.
33 If the ExtendedVerification flag is TRUE the firmware may take
34 an extended amount of time to verify the device is operating on
35 reset. Otherwise the reset operation is to occur as quickly as
36 possible. The hardware verification process is not defined by
37 this specification and is left up to the platform firmware or
40 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
41 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
42 is defined in this section.
44 @param ExtendedVerification Indicates that the driver may
45 perform a more exhaustive
46 verification operation of the
50 @retval EFI_SUCCESS The device was reset.
52 @retval EFI_DEVICE_ERROR The device is not functioning
53 correctly and could not be reset.
58 (EFIAPI
*EFI_INPUT_RESET_EX
) (
59 IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
60 IN CONST BOOLEAN ExtendedVerification
65 // EFI_KEY_TOGGLE_STATE
67 typedef UINT8 EFI_KEY_TOGGLE_STATE
;
68 #define TOGGLE_STATE_VALID 0x80
69 #define SCROLL_LOCK_ACTIVE 0x01
70 #define NUM_LOCK_ACTIVE 0x02
71 #define CAPS_LOCK_ACTIVE 0x04
74 Definition of EFI_KEY_STATE
76 @param KeyShiftState Reflects the currently pressed shift
77 modifiers for the input device. The
78 returned value is valid only if the high
79 order bit has been set.
81 @param KeyToggleState Reflects the current internal state of
82 various toggled attributes. The returned
83 value is valid only if the high order
87 typedef struct _EFI_KEY_STATE
{
89 EFI_KEY_TOGGLE_STATE KeyToggleState
;
93 Definition of EFI_KEY_DATA.
95 @param Key The EFI scan code and Unicode value returned from
98 @param KeyState The current state of various toggled
99 attributes as well as input modifier values.
104 EFI_KEY_STATE KeyState
;
110 // Any Shift or Toggle State that is valid should have
111 // high order bit set.
113 #define SHIFT_STATE_VALID 0x80000000
114 #define RIGHT_SHIFT_PRESSED 0x00000001
115 #define LEFT_SHIFT_PRESSED 0x00000002
116 #define RIGHT_CONTROL_PRESSED 0x00000004
117 #define LEFT_CONTROL_PRESSED 0x00000008
118 #define RIGHT_ALT_PRESSED 0x00000010
119 #define LEFT_ALT_PRESSED 0x00000020
120 #define RIGHT_LOGO_PRESSED 0x00000040
121 #define LEFT_LOGO_PRESSED 0x00000080
122 #define MENU_KEY_PRESSED 0x00000100
123 #define SYS_REQ_PRESSED 0x00000200
126 The function reads the next keystroke from the input device. If
127 there is no pending keystroke the function returns
128 EFI_NOT_READY. If there is a pending keystroke, then
129 KeyData.Key.ScanCode is the EFI scan code defined in Error!
130 Reference source not found.. The KeyData.Key.UnicodeChar is the
131 actual printable character or is zero if the key does not
132 represent a printable character (control key, function key,
133 etc.). The KeyData.KeyState is shift state for the character
134 reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
135 When interpreting the data from this function, it should be
136 noted that if a class of printable characters that are
137 normally adjusted by shift modifiers (e.g. Shift Key + "f"
138 key) would be presented solely as a KeyData.Key.UnicodeChar
139 without the associated shift state. So in the previous example
140 of a Shift Key + "f" key being pressed, the only pertinent
141 data returned would be KeyData.Key.UnicodeChar with the value
142 of "F". This of course would not typically be the case for
143 non-printable characters such as the pressing of the Right
144 Shift Key + F10 key since the corresponding returned data
145 would be reflected both in the KeyData.KeyState.KeyShiftState
146 and KeyData.Key.ScanCode values. UEFI drivers which implement
147 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
148 KeyData.Key and KeyData.KeyState values. These drivers must
149 always return the most current state of
150 KeyData.KeyState.KeyShiftState and
151 KeyData.KeyState.KeyToggleState. It should also be noted that
152 certain input devices may not be able to produce shift or toggle
153 state information, and in those cases the high order bit in the
154 respective Toggle and Shift state fields should not be active.
157 @param This A pointer to the
158 EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX instance.
160 @param KeyData A pointer to a buffer that is filled in with
161 the keystroke state data for the key that was
165 @retval EFI_SUCCESS The keystroke information was
168 @retval EFI_NOT_READY There was no keystroke data available.
169 EFI_DEVICE_ERROR The keystroke
170 information was not returned due to
177 (EFIAPI
*EFI_INPUT_READ_KEY_EX
) (
178 IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
179 OUT EFI_KEY_DATA
*KeyData
183 The SetState() function allows the input device hardware to
184 have state settings adjusted.
186 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
187 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
188 is defined in this section.
190 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
191 set the state for the input device.
194 @retval EFI_SUCCESS The device state was set appropriately.
196 @retval EFI_DEVICE_ERROR The device is not functioning
197 correctly and could not have the
200 @retval EFI_UNSUPPORTED The device does not support the
201 ability to have its state set.
206 (EFIAPI
*EFI_SET_STATE
) (
207 IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
208 IN CONST EFI_KEY_TOGGLE_STATE
*KeyToggleState
216 (EFIAPI
*EFI_KEY_NOTIFY_FUNCTION
) (
217 IN CONST EFI_KEY_DATA
*KeyData
221 The RegisterKeystrokeNotify() function registers a function
222 which will be called when a specified keystroke will occur.
224 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
225 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
226 is defined in this section.
228 @param KeyData A pointer to a buffer that is filled in with
229 the keystroke information for the key that was
232 @param KeyNotificationFunction Points to the function to be
233 called when the key sequence
234 is typed specified by KeyData.
237 @param NotifyHandle Points to the unique handle assigned to
238 the registered notification.
240 @retval EFI_SUCCESS The device state was set
243 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
249 (EFIAPI
*EFI_REGISTER_KEYSTROKE_NOTIFY
) (
250 IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
251 IN CONST EFI_KEY_DATA
*KeyData
,
252 IN CONST EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction
,
253 OUT EFI_HANDLE
*NotifyHandle
257 The UnregisterKeystrokeNotify() function removes the
258 notification which was previously registered.
260 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
263 @param NotificationHandle The handle of the notification
264 function being unregistered.
266 @retval EFI_SUCCESS The device state was set appropriately.
268 @retval EFI_INVALID_PARAMETER The NotificationHandle is
274 (EFIAPI
*EFI_UNREGISTER_KEYSTROKE_NOTIFY
) (
275 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
276 IN EFI_HANDLE NotificationHandle
281 The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
282 device. It is an extension to the Simple Text Input protocol
283 which allows a variety of extended shift state information to be
286 @param Reset Reset the ConsoleIn device. See Reset().
288 @param ReadKeyStrokeEx Returns the next input character. See
291 @param WaitForKeyEx Event to use with WaitForEvent() to wait
292 for a key to be available.
294 @param SetState Set the EFI_KEY_TOGGLE_STATE state settings
295 for the input device.
297 @param RegisterKeyNotify Register a notification function to
298 be called when a given key sequence
301 @param UnregisterKeyNotifyRemoves A specific notification
305 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
{
306 EFI_INPUT_RESET_EX Reset
;
307 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx
;
308 EFI_EVENT WaitForKeyEx
;
309 EFI_SET_STATE SetState
;
310 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify
;
311 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify
;
315 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid
;