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