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 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
22 {0xdd9e7534, 0x7762, 0x4698, { 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa } }
25 typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
;
28 The Reset() function resets the input device hardware. As part
29 of initialization process, the firmware/device will make a quick
30 but reasonable attempt to verify that the device is functioning.
31 If the ExtendedVerification flag is TRUE the firmware may take
32 an extended amount of time to verify the device is operating on
33 reset. Otherwise the reset operation is to occur as quickly as
34 possible. The hardware verification process is not defined by
35 this specification and is left up to the platform firmware or
38 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
39 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
40 is defined in this section.
42 @param ExtendedVerification Indicates that the driver may
43 perform a more exhaustive
44 verification operation of the
48 @retval EFI_SUCCESS The device was reset.
50 @retval EFI_DEVICE_ERROR The device is not functioning
51 correctly and could not be reset.
56 (EFIAPI
*EFI_INPUT_RESET_EX
) (
57 IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
58 IN CONST BOOLEAN ExtendedVerification
63 // EFI_KEY_TOGGLE_STATE
65 typedef UINT8 EFI_KEY_TOGGLE_STATE
;
66 #define TOGGLE_STATE_VALID 0x80
67 #define SCROLL_LOCK_ACTIVE 0x01
68 #define NUM_LOCK_ACTIVE 0x02
69 #define CAPS_LOCK_ACTIVE 0x04
72 Definition of EFI_KEY_STATE
74 @param KeyShiftState Reflects the currently pressed shift
75 modifiers for the input device. The
76 returned value is valid only if the high
77 order bit has been set.
79 @param KeyToggleState Reflects the current internal state of
80 various toggled attributes. The returned
81 value is valid only if the high order
85 typedef struct _EFI_KEY_STATE
{
87 EFI_KEY_TOGGLE_STATE KeyToggleState
;
91 Definition of EFI_KEY_DATA.
93 @param Key The EFI scan code and Unicode value returned from
96 @param KeyState The current state of various toggled
97 attributes as well as input modifier values.
102 EFI_KEY_STATE KeyState
;
108 // Any Shift or Toggle State that is valid should have
109 // high order bit set.
111 #define SHIFT_STATE_VALID 0x80000000
112 #define RIGHT_SHIFT_PRESSED 0x00000001
113 #define LEFT_SHIFT_PRESSED 0x00000002
114 #define RIGHT_CONTROL_PRESSED 0x00000004
115 #define LEFT_CONTROL_PRESSED 0x00000008
116 #define RIGHT_ALT_PRESSED 0x00000010
117 #define LEFT_ALT_PRESSED 0x00000020
118 #define RIGHT_LOGO_PRESSED 0x00000040
119 #define LEFT_LOGO_PRESSED 0x00000080
120 #define MENU_KEY_PRESSED 0x00000100
121 #define SYS_REQ_PRESSED 0x00000200
124 The function reads the next keystroke from the input device. If
125 there is no pending keystroke the function returns
126 EFI_NOT_READY. If there is a pending keystroke, then
127 KeyData.Key.ScanCode is the EFI scan code defined in Error!
128 Reference source not found.. The KeyData.Key.UnicodeChar is the
129 actual printable character or is zero if the key does not
130 represent a printable character (control key, function key,
131 etc.). The KeyData.KeyState is shift state for the character
132 reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
133 When interpreting the data from this function, it should be
134 noted that if a class of printable characters that are
135 normally adjusted by shift modifiers (e.g. Shift Key + "f"
136 key) would be presented solely as a KeyData.Key.UnicodeChar
137 without the associated shift state. So in the previous example
138 of a Shift Key + "f" key being pressed, the only pertinent
139 data returned would be KeyData.Key.UnicodeChar with the value
140 of "F". This of course would not typically be the case for
141 non-printable characters such as the pressing of the Right
142 Shift Key + F10 key since the corresponding returned data
143 would be reflected both in the KeyData.KeyState.KeyShiftState
144 and KeyData.Key.ScanCode values. UEFI drivers which implement
145 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
146 KeyData.Key and KeyData.KeyState values. These drivers must
147 always return the most current state of
148 KeyData.KeyState.KeyShiftState and
149 KeyData.KeyState.KeyToggleState. It should also be noted that
150 certain input devices may not be able to produce shift or toggle
151 state information, and in those cases the high order bit in the
152 respective Toggle and Shift state fields should not be active.
155 @param This A pointer to the
156 EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX instance.
158 @param KeyData A pointer to a buffer that is filled in with
159 the keystroke state data for the key that was
163 @retval EFI_SUCCESS The keystroke information was
166 @retval EFI_NOT_READY There was no keystroke data available.
167 EFI_DEVICE_ERROR The keystroke
168 information was not returned due to
175 (EFIAPI
*EFI_INPUT_READ_KEY_EX
) (
176 IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
177 OUT EFI_KEY_DATA
*KeyData
181 The SetState() function allows the input device hardware to
182 have state settings adjusted.
184 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
185 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
186 is defined in this section.
188 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
189 set the state for the input device.
192 @retval EFI_SUCCESS The device state was set appropriately.
194 @retval EFI_DEVICE_ERROR The device is not functioning
195 correctly and could not have the
198 @retval EFI_UNSUPPORTED The device does not support the
199 ability to have its state set.
204 (EFIAPI
*EFI_SET_STATE
) (
205 IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
206 IN CONST EFI_KEY_TOGGLE_STATE
*KeyToggleState
214 (EFIAPI
*EFI_KEY_NOTIFY_FUNCTION
) (
215 IN CONST EFI_KEY_DATA
*KeyData
219 The RegisterKeystrokeNotify() function registers a function
220 which will be called when a specified keystroke will occur.
222 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
223 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
224 is defined in this section.
226 @param KeyData A pointer to a buffer that is filled in with
227 the keystroke information for the key that was
230 @param KeyNotificationFunction Points to the function to be
231 called when the key sequence
232 is typed specified by KeyData.
235 @param NotifyHandle Points to the unique handle assigned to
236 the registered notification.
238 @retval EFI_SUCCESS The device state was set
241 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
247 (EFIAPI
*EFI_REGISTER_KEYSTROKE_NOTIFY
) (
248 IN CONST EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
249 IN CONST EFI_KEY_DATA
*KeyData
,
250 IN CONST EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction
,
251 OUT EFI_HANDLE
*NotifyHandle
255 The UnregisterKeystrokeNotify() function removes the
256 notification which was previously registered.
258 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
261 @param NotificationHandle The handle of the notification
262 function being unregistered.
264 @retval EFI_SUCCESS The device state was set appropriately.
266 @retval EFI_INVALID_PARAMETER The NotificationHandle is
272 (EFIAPI
*EFI_UNREGISTER_KEYSTROKE_NOTIFY
) (
273 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
274 IN EFI_HANDLE NotificationHandle
279 The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
280 device. It is an extension to the Simple Text Input protocol
281 which allows a variety of extended shift state information to be
284 @param Reset Reset the ConsoleIn device. See Reset().
286 @param ReadKeyStrokeEx Returns the next input character. See
289 @param WaitForKeyEx Event to use with WaitForEvent() to wait
290 for a key to be available.
292 @param SetState Set the EFI_KEY_TOGGLE_STATE state settings
293 for the input device.
295 @param RegisterKeyNotify Register a notification function to
296 be called when a given key sequence
299 @param UnregisterKeyNotifyRemoves A specific notification
303 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
{
304 EFI_INPUT_RESET_EX Reset
;
305 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx
;
306 EFI_EVENT WaitForKeyEx
;
307 EFI_SET_STATE SetState
;
308 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify
;
309 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify
;
313 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid
;