3 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL from the UEFI 2.1 specification.
20 This protocol defines an extension to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL
21 which exposes much more state and modifier information from the input device,
22 also allows one to register a notification for a particular keystroke.
26 #ifndef __SIMPLE_TEXT_INPUT_EX_H__
27 #define __SIMPLE_TEXT_INPUT_EX_H__
29 #include EFI_PROTOCOL_DEFINITION (SimpleTextIn)
31 #define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
33 0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa}\
36 EFI_FORWARD_DECLARATION (EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
);
42 typedef UINT8 EFI_KEY_TOGGLE_STATE
;
44 // Any Shift or Toggle State that is valid should have
45 // high order bit set.
47 typedef struct EFI_KEY_STATE
{
49 EFI_KEY_TOGGLE_STATE KeyToggleState
;
54 EFI_KEY_STATE KeyState
;
60 #define EFI_SHIFT_STATE_VALID 0x80000000
61 #define EFI_RIGHT_SHIFT_PRESSED 0x00000001
62 #define EFI_LEFT_SHIFT_PRESSED 0x00000002
63 #define EFI_RIGHT_CONTROL_PRESSED 0x00000004
64 #define EFI_LEFT_CONTROL_PRESSED 0x00000008
65 #define EFI_RIGHT_ALT_PRESSED 0x00000010
66 #define EFI_LEFT_ALT_PRESSED 0x00000020
67 #define EFI_RIGHT_LOGO_PRESSED 0x00000040
68 #define EFI_LEFT_LOGO_PRESSED 0x00000080
69 #define EFI_MENU_KEY_PRESSED 0x00000100
70 #define EFI_SYS_REQ_PRESSED 0x00000200
75 #define EFI_TOGGLE_STATE_VALID 0x80
76 #define EFI_SCROLL_LOCK_ACTIVE 0x01
77 #define EFI_NUM_LOCK_ACTIVE 0x02
78 #define EFI_CAPS_LOCK_ACTIVE 0x04
83 #define SCAN_F13 0x0068
84 #define SCAN_F14 0x0069
85 #define SCAN_F15 0x006A
86 #define SCAN_F16 0x006B
87 #define SCAN_F17 0x006C
88 #define SCAN_F18 0x006D
89 #define SCAN_F19 0x006E
90 #define SCAN_F20 0x006F
91 #define SCAN_F21 0x0070
92 #define SCAN_F22 0x0071
93 #define SCAN_F23 0x0072
94 #define SCAN_F24 0x0073
95 #define SCAN_MUTE 0x007F
96 #define SCAN_VOLUME_UP 0x0080
97 #define SCAN_VOLUME_DOWN 0x0081
98 #define SCAN_BRIGHTNESS_UP 0x0100
99 #define SCAN_BRIGHTNESS_DOWN 0x0101
100 #define SCAN_SUSPEND 0x0102
101 #define SCAN_HIBERNATE 0x0103
102 #define SCAN_TOGGLE_DISPLAY 0x0104
103 #define SCAN_RECOVERY 0x0105
104 #define SCAN_EJECT 0x0106
108 // EFI Key Notfication Function
112 (EFIAPI
*EFI_KEY_NOTIFY_FUNCTION
) (
113 IN EFI_KEY_DATA
*KeyData
118 (EFIAPI
*EFI_INPUT_RESET_EX
) (
119 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
120 IN BOOLEAN ExtendedVerification
125 Reset the input device and optionaly run diagnostics
128 This - Protocol instance pointer.
129 ExtendedVerification - Driver may perform diagnostics on reset.
132 EFI_SUCCESS - The device was reset.
133 EFI_DEVICE_ERROR - The device is not functioning properly and could
141 (EFIAPI
*EFI_INPUT_READ_KEY_EX
) (
142 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
143 OUT EFI_KEY_DATA
*KeyData
148 Reads the next keystroke from the input device. The WaitForKey Event can
149 be used to test for existance of a keystroke via WaitForEvent () call.
152 This - Protocol instance pointer.
153 KeyData - A pointer to a buffer that is filled in with the keystroke
154 state data for the key that was pressed.
157 EFI_SUCCESS - The keystroke information was returned.
158 EFI_NOT_READY - There was no keystroke data availiable.
159 EFI_DEVICE_ERROR - The keystroke information was not returned due to
161 EFI_INVALID_PARAMETER - KeyData is NULL.
167 (EFIAPI
*EFI_SET_STATE
) (
168 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
169 IN EFI_KEY_TOGGLE_STATE
*KeyToggleState
174 Set certain state for the input device.
177 This - Protocol instance pointer.
178 KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the
179 state for the input device.
182 EFI_SUCCESS - The device state was set successfully.
183 EFI_DEVICE_ERROR - The device is not functioning correctly and could
184 not have the setting adjusted.
185 EFI_UNSUPPORTED - The device does not have the ability to set its state.
186 EFI_INVALID_PARAMETER - KeyToggleState is NULL.
193 (EFIAPI
*EFI_REGISTER_KEYSTROKE_NOTIFY
) (
194 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
195 IN EFI_KEY_DATA
*KeyData
,
196 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction
,
197 OUT EFI_HANDLE
*NotifyHandle
202 Register a notification function for a particular keystroke for the input device.
205 This - Protocol instance pointer.
206 KeyData - A pointer to a buffer that is filled in with the keystroke
207 information data for the key that was pressed.
208 KeyNotificationFunction - Points to the function to be called when the key
209 sequence is typed specified by KeyData.
210 NotifyHandle - Points to the unique handle assigned to the registered notification.
213 EFI_SUCCESS - The notification function was registered successfully.
214 EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.
215 EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.
222 (EFIAPI
*EFI_UNREGISTER_KEYSTROKE_NOTIFY
) (
223 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
224 IN EFI_HANDLE NotificationHandle
229 Remove a registered notification function from a particular keystroke.
232 This - Protocol instance pointer.
233 NotificationHandle - The handle of the notification function being unregistered.
236 EFI_SUCCESS - The notification function was unregistered successfully.
237 EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
238 EFI_NOT_FOUND - Can not find the matching entry in database.
243 struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
{
244 EFI_INPUT_RESET_EX Reset
;
245 EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx
;
246 EFI_EVENT WaitForKeyEx
;
247 EFI_SET_STATE SetState
;
248 EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify
;
249 EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify
;
252 extern EFI_GUID gEfiSimpleTextInputExProtocolGuid
;