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.
18 #ifndef __SIMPLE_TEXT_IN_EX_H__
19 #define __SIMPLE_TEXT_IN_EX_H__
21 #include <ProcessorBind.h>
22 #include <Pi/PiMultiPhase.h>
24 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
25 {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }
28 typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
;
31 The Reset() function resets the input device hardware. As part
32 of initialization process, the firmware/device will make a quick
33 but reasonable attempt to verify that the device is functioning.
34 If the ExtendedVerification flag is TRUE the firmware may take
35 an extended amount of time to verify the device is operating on
36 reset. Otherwise the reset operation is to occur as quickly as
37 possible. The hardware verification process is not defined by
38 this specification and is left up to the platform firmware or
41 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
42 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
43 is defined in this section.
45 @param ExtendedVerification Indicates that the driver may
46 perform a more exhaustive
47 verification operation of the
51 @retval EFI_SUCCESS The device was reset.
53 @retval EFI_DEVICE_ERROR The device is not functioning
54 correctly and could not be reset.
59 (EFIAPI
*EFI_INPUT_RESET_EX
)(
60 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
61 IN BOOLEAN ExtendedVerification
66 // EFI_KEY_TOGGLE_STATE
68 typedef UINT8 EFI_KEY_TOGGLE_STATE
;
71 Definition of EFI_KEY_STATE
73 @param KeyShiftState Reflects the currently pressed shift
74 modifiers for the input device. The
75 returned value is valid only if the high
76 order bit has been set.
78 @param KeyToggleState Reflects the current internal state of
79 various toggled attributes. The returned
80 value is valid only if the high order
84 typedef struct _EFI_KEY_STATE
{
86 EFI_KEY_TOGGLE_STATE KeyToggleState
;
90 Definition of EFI_KEY_DATA.
92 @param Key The EFI scan code and Unicode value returned from
95 @param KeyState The current state of various toggled
96 attributes as well as input modifier values.
101 EFI_KEY_STATE KeyState
;
105 // Any Shift or Toggle State that is valid should have
106 // high order bit set.
110 #define EFI_SHIFT_STATE_VALID 0x80000000
111 #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
112 #define EFI_LEFT_SHIFT_PRESSED 0x00000002
113 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
114 #define EFI_LEFT_CONTROL_PRESSED 0x00000008
115 #define EFI_RIGHT_ALT_PRESSED 0x00000010
116 #define EFI_LEFT_ALT_PRESSED 0x00000020
117 #define EFI_RIGHT_LOGO_PRESSED 0x00000040
118 #define EFI_LEFT_LOGO_PRESSED 0x00000080
119 #define EFI_MENU_KEY_PRESSED 0x00000100
120 #define EFI_SYS_REQ_PRESSED 0x00000200
125 #define EFI_TOGGLE_STATE_VALID 0x80
126 #define EFI_SCROLL_LOCK_ACTIVE 0x01
127 #define EFI_NUM_LOCK_ACTIVE 0x02
128 #define EFI_CAPS_LOCK_ACTIVE 0x04
133 #define SCAN_F13 0x0068
134 #define SCAN_F14 0x0069
135 #define SCAN_F15 0x006A
136 #define SCAN_F16 0x006B
137 #define SCAN_F17 0x006C
138 #define SCAN_F18 0x006D
139 #define SCAN_F19 0x006E
140 #define SCAN_F20 0x006F
141 #define SCAN_F21 0x0070
142 #define SCAN_F22 0x0071
143 #define SCAN_F23 0x0072
144 #define SCAN_F24 0x0073
145 #define SCAN_MUTE 0x007F
146 #define SCAN_VOLUME_UP 0x0080
147 #define SCAN_VOLUME_DOWN 0x0081
148 #define SCAN_BRIGHTNESS_UP 0x0100
149 #define SCAN_BRIGHTNESS_DOWN 0x0101
150 #define SCAN_SUSPEND 0x0102
151 #define SCAN_HIBERNATE 0x0103
152 #define SCAN_TOGGLE_DISPLAY 0x0104
153 #define SCAN_RECOVERY 0x0105
154 #define SCAN_EJECT 0x0106
157 The function reads the next keystroke from the input device. If
158 there is no pending keystroke the function returns
159 EFI_NOT_READY. If there is a pending keystroke, then
160 KeyData.Key.ScanCode is the EFI scan code defined in Error!
161 Reference source not found.. The KeyData.Key.UnicodeChar is the
162 actual printable character or is zero if the key does not
163 represent a printable character (control key, function key,
164 etc.). The KeyData.KeyState is shift state for the character
165 reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
166 When interpreting the data from this function, it should be
167 noted that if a class of printable characters that are
168 normally adjusted by shift modifiers (e.g. Shift Key + "f"
169 key) would be presented solely as a KeyData.Key.UnicodeChar
170 without the associated shift state. So in the previous example
171 of a Shift Key + "f" key being pressed, the only pertinent
172 data returned would be KeyData.Key.UnicodeChar with the value
173 of "F". This of course would not typically be the case for
174 non-printable characters such as the pressing of the Right
175 Shift Key + F10 key since the corresponding returned data
176 would be reflected both in the KeyData.KeyState.KeyShiftState
177 and KeyData.Key.ScanCode values. UEFI drivers which implement
178 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
179 KeyData.Key and KeyData.KeyState values. These drivers must
180 always return the most current state of
181 KeyData.KeyState.KeyShiftState and
182 KeyData.KeyState.KeyToggleState. It should also be noted that
183 certain input devices may not be able to produce shift or toggle
184 state information, and in those cases the high order bit in the
185 respective Toggle and Shift state fields should not be active.
188 @param This A pointer to the
189 EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX instance.
191 @param KeyData A pointer to a buffer that is filled in with
192 the keystroke state data for the key that was
196 @retval EFI_SUCCESS The keystroke information was
199 @retval EFI_NOT_READY There was no keystroke data available.
200 EFI_DEVICE_ERROR The keystroke
201 information was not returned due to
208 (EFIAPI
*EFI_INPUT_READ_KEY_EX
)(
209 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
210 OUT EFI_KEY_DATA
*KeyData
214 The SetState() function allows the input device hardware to
215 have state settings adjusted.
217 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
218 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
219 is defined in this section.
221 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
222 set the state for the input device.
225 @retval EFI_SUCCESS The device state was set appropriately.
227 @retval EFI_DEVICE_ERROR The device is not functioning
228 correctly and could not have the
231 @retval EFI_UNSUPPORTED The device does not support the
232 ability to have its state set.
237 (EFIAPI
*EFI_SET_STATE
)(
238 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
239 IN EFI_KEY_TOGGLE_STATE
*KeyToggleState
247 (EFIAPI
*EFI_KEY_NOTIFY_FUNCTION
)(
248 IN EFI_KEY_DATA
*KeyData
252 The RegisterKeystrokeNotify() function registers a function
253 which will be called when a specified keystroke will occur.
255 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
256 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
257 is defined in this section.
259 @param KeyData A pointer to a buffer that is filled in with
260 the keystroke information for the key that was
263 @param KeyNotificationFunction Points to the function to be
264 called when the key sequence
265 is typed specified by KeyData.
268 @param NotifyHandle Points to the unique handle assigned to
269 the registered notification.
271 @retval EFI_SUCCESS The device state was set
274 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
280 (EFIAPI
*EFI_REGISTER_KEYSTROKE_NOTIFY
)(
281 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
282 IN EFI_KEY_DATA
*KeyData
,
283 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction
,
284 OUT EFI_HANDLE
*NotifyHandle
288 The UnregisterKeystrokeNotify() function removes the
289 notification which was previously registered.
291 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
294 @param NotificationHandle The handle of the notification
295 function being unregistered.
297 @retval EFI_SUCCESS The device state was set appropriately.
299 @retval EFI_INVALID_PARAMETER The NotificationHandle is
305 (EFIAPI
*EFI_UNREGISTER_KEYSTROKE_NOTIFY
)(
306 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
307 IN EFI_HANDLE NotificationHandle
312 The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
313 device. It is an extension to the Simple Text Input protocol
314 which allows a variety of extended shift state information to be
317 @param Reset Reset the ConsoleIn device. See Reset().
319 @param ReadKeyStrokeEx Returns the next input character. See
322 @param WaitForKeyEx Event to use with WaitForEvent() to wait
323 for a key to be available.
325 @param SetState Set the EFI_KEY_TOGGLE_STATE state settings
326 for the input device.
328 @param RegisterKeyNotify Register a notification function to
329 be called when a given key sequence
332 @param UnregisterKeyNotifyRemoves A specific notification
336 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
{
337 EFI_INPUT_RESET_EX Reset
;
338 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx
;
339 EFI_EVENT WaitForKeyEx
;
340 EFI_SET_STATE SetState
;
341 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify
;
342 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify
;
346 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid
;