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 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
58 IN BOOLEAN ExtendedVerification
63 // EFI_KEY_TOGGLE_STATE
65 typedef UINT8 EFI_KEY_TOGGLE_STATE
;
68 Definition of EFI_KEY_STATE
70 @param KeyShiftState Reflects the currently pressed shift
71 modifiers for the input device. The
72 returned value is valid only if the high
73 order bit has been set.
75 @param KeyToggleState Reflects the current internal state of
76 various toggled attributes. The returned
77 value is valid only if the high order
81 typedef struct _EFI_KEY_STATE
{
83 EFI_KEY_TOGGLE_STATE KeyToggleState
;
87 Definition of EFI_KEY_DATA.
89 @param Key The EFI scan code and Unicode value returned from
92 @param KeyState The current state of various toggled
93 attributes as well as input modifier values.
98 EFI_KEY_STATE KeyState
;
102 // Any Shift or Toggle State that is valid should have
103 // high order bit set.
107 #define EFI_SHIFT_STATE_VALID 0x80000000
108 #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
109 #define EFI_LEFT_SHIFT_PRESSED 0x00000002
110 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
111 #define EFI_LEFT_CONTROL_PRESSED 0x00000008
112 #define EFI_RIGHT_ALT_PRESSED 0x00000010
113 #define EFI_LEFT_ALT_PRESSED 0x00000020
114 #define EFI_RIGHT_LOGO_PRESSED 0x00000040
115 #define EFI_LEFT_LOGO_PRESSED 0x00000080
116 #define EFI_MENU_KEY_PRESSED 0x00000100
117 #define EFI_SYS_REQ_PRESSED 0x00000200
122 #define EFI_TOGGLE_STATE_VALID 0x80
123 #define EFI_SCROLL_LOCK_ACTIVE 0x01
124 #define EFI_NUM_LOCK_ACTIVE 0x02
125 #define EFI_CAPS_LOCK_ACTIVE 0x04
130 #define SCAN_F13 0x0068
131 #define SCAN_F14 0x0069
132 #define SCAN_F15 0x006A
133 #define SCAN_F16 0x006B
134 #define SCAN_F17 0x006C
135 #define SCAN_F18 0x006D
136 #define SCAN_F19 0x006E
137 #define SCAN_F20 0x006F
138 #define SCAN_F21 0x0070
139 #define SCAN_F22 0x0071
140 #define SCAN_F23 0x0072
141 #define SCAN_F24 0x0073
142 #define SCAN_MUTE 0x007F
143 #define SCAN_VOLUME_UP 0x0080
144 #define SCAN_VOLUME_DOWN 0x0081
145 #define SCAN_BRIGHTNESS_UP 0x0100
146 #define SCAN_BRIGHTNESS_DOWN 0x0101
147 #define SCAN_SUSPEND 0x0102
148 #define SCAN_HIBERNATE 0x0103
149 #define SCAN_TOGGLE_DISPLAY 0x0104
150 #define SCAN_RECOVERY 0x0105
151 #define SCAN_EJECT 0x0106
154 The function reads the next keystroke from the input device. If
155 there is no pending keystroke the function returns
156 EFI_NOT_READY. If there is a pending keystroke, then
157 KeyData.Key.ScanCode is the EFI scan code defined in Error!
158 Reference source not found.. The KeyData.Key.UnicodeChar is the
159 actual printable character or is zero if the key does not
160 represent a printable character (control key, function key,
161 etc.). The KeyData.KeyState is shift state for the character
162 reflected in KeyData.Key.UnicodeChar or KeyData.Key.ScanCode .
163 When interpreting the data from this function, it should be
164 noted that if a class of printable characters that are
165 normally adjusted by shift modifiers (e.g. Shift Key + "f"
166 key) would be presented solely as a KeyData.Key.UnicodeChar
167 without the associated shift state. So in the previous example
168 of a Shift Key + "f" key being pressed, the only pertinent
169 data returned would be KeyData.Key.UnicodeChar with the value
170 of "F". This of course would not typically be the case for
171 non-printable characters such as the pressing of the Right
172 Shift Key + F10 key since the corresponding returned data
173 would be reflected both in the KeyData.KeyState.KeyShiftState
174 and KeyData.Key.ScanCode values. UEFI drivers which implement
175 the EFI_SIMPLE_TEXT_INPUT_EX protocol are required to return
176 KeyData.Key and KeyData.KeyState values. These drivers must
177 always return the most current state of
178 KeyData.KeyState.KeyShiftState and
179 KeyData.KeyState.KeyToggleState. It should also be noted that
180 certain input devices may not be able to produce shift or toggle
181 state information, and in those cases the high order bit in the
182 respective Toggle and Shift state fields should not be active.
185 @param This A pointer to the
186 EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX instance.
188 @param KeyData A pointer to a buffer that is filled in with
189 the keystroke state data for the key that was
193 @retval EFI_SUCCESS The keystroke information was
196 @retval EFI_NOT_READY There was no keystroke data available.
197 EFI_DEVICE_ERROR The keystroke
198 information was not returned due to
205 (EFIAPI
*EFI_INPUT_READ_KEY_EX
) (
206 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
207 OUT EFI_KEY_DATA
*KeyData
211 The SetState() function allows the input device hardware to
212 have state settings adjusted.
214 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
215 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
216 is defined in this section.
218 @param KeyToggleState Pointer to the EFI_KEY_TOGGLE_STATE to
219 set the state for the input device.
222 @retval EFI_SUCCESS The device state was set appropriately.
224 @retval EFI_DEVICE_ERROR The device is not functioning
225 correctly and could not have the
228 @retval EFI_UNSUPPORTED The device does not support the
229 ability to have its state set.
234 (EFIAPI
*EFI_SET_STATE
) (
235 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
236 IN EFI_KEY_TOGGLE_STATE
*KeyToggleState
244 (EFIAPI
*EFI_KEY_NOTIFY_FUNCTION
) (
245 IN EFI_KEY_DATA
*KeyData
249 The RegisterKeystrokeNotify() function registers a function
250 which will be called when a specified keystroke will occur.
252 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
253 instance. Type EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
254 is defined in this section.
256 @param KeyData A pointer to a buffer that is filled in with
257 the keystroke information for the key that was
260 @param KeyNotificationFunction Points to the function to be
261 called when the key sequence
262 is typed specified by KeyData.
265 @param NotifyHandle Points to the unique handle assigned to
266 the registered notification.
268 @retval EFI_SUCCESS The device state was set
271 @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary
277 (EFIAPI
*EFI_REGISTER_KEYSTROKE_NOTIFY
) (
278 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
279 IN EFI_KEY_DATA
*KeyData
,
280 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction
,
281 OUT EFI_HANDLE
*NotifyHandle
285 The UnregisterKeystrokeNotify() function removes the
286 notification which was previously registered.
288 @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL_EX
291 @param NotificationHandle The handle of the notification
292 function being unregistered.
294 @retval EFI_SUCCESS The device state was set appropriately.
296 @retval EFI_INVALID_PARAMETER The NotificationHandle is
302 (EFIAPI
*EFI_UNREGISTER_KEYSTROKE_NOTIFY
) (
303 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
304 IN EFI_HANDLE NotificationHandle
309 The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn
310 device. It is an extension to the Simple Text Input protocol
311 which allows a variety of extended shift state information to be
314 @param Reset Reset the ConsoleIn device. See Reset().
316 @param ReadKeyStrokeEx Returns the next input character. See
319 @param WaitForKeyEx Event to use with WaitForEvent() to wait
320 for a key to be available.
322 @param SetState Set the EFI_KEY_TOGGLE_STATE state settings
323 for the input device.
325 @param RegisterKeyNotify Register a notification function to
326 be called when a given key sequence
329 @param UnregisterKeyNotifyRemoves A specific notification
333 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
{
334 EFI_INPUT_RESET_EX Reset
;
335 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx
;
336 EFI_EVENT WaitForKeyEx
;
337 EFI_SET_STATE SetState
;
338 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify
;
339 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify
;
343 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid
;