]>
Commit | Line | Data |
---|---|---|
ed838d0c | 1 | /** @file\r |
5899f27e | 2 | Header file for USB Keyboard Driver's Data Structures.\r |
a7022cec | 3 | \r |
c1fd2767 | 4 | Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r |
cd5ebaa0 | 5 | This program and the accompanying materials\r |
ed838d0c | 6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
ed838d0c | 13 | **/\r |
a7022cec | 14 | #ifndef _EFI_USB_KB_H_\r |
15 | #define _EFI_USB_KB_H_\r | |
ed838d0c | 16 | \r |
ed7748fe | 17 | \r |
60c93673 | 18 | #include <Uefi.h>\r |
ed7748fe | 19 | \r |
ed838d0c | 20 | #include <Protocol/SimpleTextIn.h>\r |
66aa04e4 | 21 | #include <Protocol/SimpleTextInEx.h>\r |
813acf3a | 22 | #include <Protocol/HiiDatabase.h>\r |
ed838d0c | 23 | #include <Protocol/UsbIo.h>\r |
24 | #include <Protocol/DevicePath.h>\r | |
8d4cd915 | 25 | \r |
813acf3a | 26 | #include <Guid/HiiKeyBoardLayout.h>\r |
c8ad2d7a | 27 | #include <Guid/UsbKeyBoardLayout.h>\r |
ed7748fe | 28 | \r |
ed838d0c | 29 | #include <Library/DebugLib.h>\r |
30 | #include <Library/ReportStatusCodeLib.h>\r | |
31 | #include <Library/BaseMemoryLib.h>\r | |
32 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
33 | #include <Library/UefiDriverEntryPoint.h>\r | |
34 | #include <Library/UefiBootServicesTableLib.h>\r | |
35 | #include <Library/UefiLib.h>\r | |
36 | #include <Library/MemoryAllocationLib.h>\r | |
37 | #include <Library/PcdLib.h>\r | |
dfb74df5 | 38 | #include <Library/UefiUsbLib.h>\r |
c41c3e55 | 39 | #include <Library/HiiLib.h>\r |
ed838d0c | 40 | \r |
41 | #include <IndustryStandard/Usb.h>\r | |
42 | \r | |
c1fd2767 RN |
43 | #define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s\r |
44 | \r | |
ed838d0c | 45 | #define MAX_KEY_ALLOWED 32\r |
46 | \r | |
47 | #define HZ 1000 * 1000 * 10\r | |
48 | #define USBKBD_REPEAT_DELAY ((HZ) / 2)\r | |
49 | #define USBKBD_REPEAT_RATE ((HZ) / 50)\r | |
50 | \r | |
51 | #define CLASS_HID 3\r | |
52 | #define SUBCLASS_BOOT 1\r | |
53 | #define PROTOCOL_KEYBOARD 1\r | |
54 | \r | |
55 | #define BOOT_PROTOCOL 0\r | |
56 | #define REPORT_PROTOCOL 1\r | |
57 | \r | |
58 | typedef struct {\r | |
b4e73a63 | 59 | BOOLEAN Down;\r |
60 | UINT8 KeyCode;\r | |
ed838d0c | 61 | } USB_KEY;\r |
62 | \r | |
63 | typedef struct {\r | |
c1fd2767 RN |
64 | VOID *Buffer[MAX_KEY_ALLOWED + 1];\r |
65 | UINTN Head;\r | |
66 | UINTN Tail;\r | |
67 | UINTN ItemSize;\r | |
68 | } USB_SIMPLE_QUEUE;\r | |
ed838d0c | 69 | \r |
f3f2e05d | 70 | #define USB_KB_DEV_SIGNATURE SIGNATURE_32 ('u', 'k', 'b', 'd')\r |
71 | #define USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('u', 'k', 'b', 'x')\r | |
66aa04e4 | 72 | \r |
73 | typedef struct _KEYBOARD_CONSOLE_IN_EX_NOTIFY {\r | |
74 | UINTN Signature;\r | |
75 | EFI_HANDLE NotifyHandle;\r | |
76 | EFI_KEY_DATA KeyData;\r | |
77 | EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;\r | |
78 | LIST_ENTRY NotifyEntry;\r | |
79 | } KEYBOARD_CONSOLE_IN_EX_NOTIFY;\r | |
813acf3a | 80 | \r |
f3f2e05d | 81 | #define USB_NS_KEY_SIGNATURE SIGNATURE_32 ('u', 'n', 's', 'k')\r |
813acf3a | 82 | \r |
83 | typedef struct {\r | |
84 | UINTN Signature;\r | |
85 | LIST_ENTRY Link;\r | |
86 | \r | |
87 | //\r | |
88 | // The number of EFI_NS_KEY_MODIFIER children definitions\r | |
89 | //\r | |
90 | UINTN KeyCount;\r | |
91 | \r | |
92 | //\r | |
93 | // NsKey[0] : Non-spacing key\r | |
94 | // NsKey[1] ~ NsKey[KeyCount] : Physical keys\r | |
95 | //\r | |
96 | EFI_KEY_DESCRIPTOR *NsKey;\r | |
97 | } USB_NS_KEY;\r | |
98 | \r | |
99 | #define USB_NS_KEY_FORM_FROM_LINK(a) CR (a, USB_NS_KEY, Link, USB_NS_KEY_SIGNATURE)\r | |
100 | \r | |
5899f27e | 101 | ///\r |
102 | /// Structure to describe USB keyboard device\r | |
103 | ///\r | |
ed838d0c | 104 | typedef struct {\r |
5899f27e | 105 | UINTN Signature;\r |
c41c3e55 | 106 | EFI_HANDLE ControllerHandle;\r |
5899f27e | 107 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r |
108 | EFI_EVENT DelayedRecoveryEvent;\r | |
109 | EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;\r | |
66aa04e4 | 110 | EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;\r |
5899f27e | 111 | EFI_USB_IO_PROTOCOL *UsbIo;\r |
ed838d0c | 112 | \r |
5899f27e | 113 | EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;\r |
114 | EFI_USB_ENDPOINT_DESCRIPTOR IntEndpointDescriptor;\r | |
ed838d0c | 115 | \r |
c1fd2767 RN |
116 | USB_SIMPLE_QUEUE UsbKeyQueue;\r |
117 | USB_SIMPLE_QUEUE EfiKeyQueue;\r | |
b4e73a63 | 118 | BOOLEAN CtrlOn;\r |
119 | BOOLEAN AltOn;\r | |
120 | BOOLEAN ShiftOn;\r | |
121 | BOOLEAN NumLockOn;\r | |
122 | BOOLEAN CapsOn;\r | |
123 | BOOLEAN ScrollOn;\r | |
5899f27e | 124 | UINT8 LastKeyCodeArray[8];\r |
b4e73a63 | 125 | UINT8 CurKeyCode;\r |
ed838d0c | 126 | \r |
c1fd2767 RN |
127 | EFI_EVENT TimerEvent;\r |
128 | \r | |
5899f27e | 129 | UINT8 RepeatKey;\r |
130 | EFI_EVENT RepeatTimer;\r | |
ed838d0c | 131 | \r |
5899f27e | 132 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r |
66aa04e4 | 133 | \r |
b4e73a63 | 134 | BOOLEAN LeftCtrlOn;\r |
135 | BOOLEAN LeftAltOn;\r | |
136 | BOOLEAN LeftShiftOn;\r | |
137 | BOOLEAN LeftLogoOn;\r | |
138 | BOOLEAN RightCtrlOn;\r | |
139 | BOOLEAN RightAltOn;\r | |
140 | BOOLEAN RightShiftOn;\r | |
141 | BOOLEAN RightLogoOn; \r | |
142 | BOOLEAN MenuKeyOn;\r | |
143 | BOOLEAN SysReqOn;\r | |
144 | BOOLEAN AltGrOn;\r | |
66aa04e4 | 145 | //\r |
146 | // Notification function list\r | |
147 | //\r | |
5899f27e | 148 | LIST_ENTRY NotifyList;\r |
813acf3a | 149 | \r |
150 | //\r | |
151 | // Non-spacing key list\r | |
152 | //\r | |
5899f27e | 153 | LIST_ENTRY NsKeyList;\r |
154 | USB_NS_KEY *CurrentNsKey;\r | |
155 | EFI_KEY_DESCRIPTOR *KeyConvertionTable;\r | |
156 | EFI_EVENT KeyboardLayoutEvent;\r | |
ed838d0c | 157 | } USB_KB_DEV;\r |
158 | \r | |
159 | //\r | |
160 | // Global Variables\r | |
161 | //\r | |
62b9bb55 | 162 | extern EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding;\r |
163 | extern EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponentName;\r | |
164 | extern EFI_COMPONENT_NAME2_PROTOCOL gUsbKeyboardComponentName2;\r | |
ed838d0c | 165 | \r |
ed838d0c | 166 | #define USB_KB_DEV_FROM_THIS(a) \\r |
167 | CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)\r | |
66aa04e4 | 168 | #define TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS(a) \\r |
169 | CR(a, USB_KB_DEV, SimpleInputEx, USB_KB_DEV_SIGNATURE)\r | |
170 | \r | |
b4e73a63 | 171 | //\r |
172 | // According to Universal Serial Bus HID Usage Tables document ver 1.12,\r | |
173 | // a Boot Keyboard should support the keycode range from 0x0 to 0x65 and 0xE0 to 0xE7.\r | |
174 | // 0xE0 to 0xE7 are for modifier keys, and 0x0 to 0x3 are reserved for typical\r | |
175 | // keyboard status or keyboard errors.\r | |
176 | // So the number of valid non-modifier USB keycodes is 0x62, and the number of\r | |
177 | // valid keycodes is 0x6A.\r | |
178 | //\r | |
179 | #define NUMBER_OF_VALID_NON_MODIFIER_USB_KEYCODE 0x62\r | |
180 | #define NUMBER_OF_VALID_USB_KEYCODE 0x6A\r | |
181 | //\r | |
182 | // 0x0 to 0x3 are reserved for typical keyboard status or keyboard errors.\r | |
183 | //\r | |
184 | #define USBKBD_VALID_KEYCODE(Key) ((UINT8) (Key) > 3)\r | |
ed838d0c | 185 | \r |
186 | typedef struct {\r | |
187 | UINT8 NumLock : 1;\r | |
188 | UINT8 CapsLock : 1;\r | |
189 | UINT8 ScrollLock : 1;\r | |
190 | UINT8 Resrvd : 5;\r | |
191 | } LED_MAP;\r | |
66aa04e4 | 192 | \r |
5899f27e | 193 | //\r |
194 | // Functions of Driver Binding Protocol\r | |
195 | //\r | |
196 | /**\r | |
197 | Check whether USB keyboard driver supports this device.\r | |
198 | \r | |
199 | @param This The USB keyboard driver binding protocol.\r | |
200 | @param Controller The controller handle to check.\r | |
201 | @param RemainingDevicePath The remaining device path.\r | |
202 | \r | |
203 | @retval EFI_SUCCESS The driver supports this controller.\r | |
204 | @retval other This device isn't supported.\r | |
205 | \r | |
206 | **/\r | |
207 | EFI_STATUS\r | |
208 | EFIAPI\r | |
209 | USBKeyboardDriverBindingSupported (\r | |
210 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
211 | IN EFI_HANDLE Controller,\r | |
212 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
213 | );\r | |
214 | \r | |
215 | /**\r | |
c92e277d | 216 | Starts the keyboard device with this driver.\r |
b4e73a63 | 217 | \r |
218 | This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r | |
219 | initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r | |
220 | this keyboard device.\r | |
5899f27e | 221 | \r |
222 | @param This The USB keyboard driver binding instance.\r | |
223 | @param Controller Handle of device to bind driver to.\r | |
224 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
225 | device to start.\r | |
226 | \r | |
227 | @retval EFI_SUCCESS The controller is controlled by the usb keyboard driver.\r | |
228 | @retval EFI_UNSUPPORTED No interrupt endpoint can be found.\r | |
b4e73a63 | 229 | @retval Other This controller cannot be started.\r |
5899f27e | 230 | \r |
231 | **/\r | |
232 | EFI_STATUS\r | |
233 | EFIAPI\r | |
234 | USBKeyboardDriverBindingStart (\r | |
235 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
236 | IN EFI_HANDLE Controller,\r | |
237 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
238 | );\r | |
239 | \r | |
240 | /**\r | |
b4e73a63 | 241 | Stop the USB keyboard device handled by this driver.\r |
5899f27e | 242 | \r |
243 | @param This The USB keyboard driver binding protocol.\r | |
244 | @param Controller The controller to release.\r | |
245 | @param NumberOfChildren The number of handles in ChildHandleBuffer.\r | |
246 | @param ChildHandleBuffer The array of child handle.\r | |
247 | \r | |
b4e73a63 | 248 | @retval EFI_SUCCESS The device was stopped.\r |
5899f27e | 249 | @retval EFI_UNSUPPORTED Simple Text In Protocol or Simple Text In Ex Protocol\r |
250 | is not installed on Controller.\r | |
b4e73a63 | 251 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r |
252 | @retval Others Fail to uninstall protocols attached on the device.\r | |
5899f27e | 253 | \r |
254 | **/\r | |
255 | EFI_STATUS\r | |
256 | EFIAPI\r | |
257 | USBKeyboardDriverBindingStop (\r | |
258 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
259 | IN EFI_HANDLE Controller,\r | |
260 | IN UINTN NumberOfChildren,\r | |
261 | IN EFI_HANDLE *ChildHandleBuffer\r | |
262 | );\r | |
263 | \r | |
b4e73a63 | 264 | //\r |
265 | // EFI Component Name Functions\r | |
266 | //\r | |
267 | /**\r | |
268 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
269 | \r | |
270 | This function retrieves the user readable name of a driver in the form of a\r | |
271 | Unicode string. If the driver specified by This has a user readable name in\r | |
272 | the language specified by Language, then a pointer to the driver name is\r | |
273 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
274 | by This does not support the language specified by Language,\r | |
275 | then EFI_UNSUPPORTED is returned.\r | |
276 | \r | |
277 | @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
278 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
279 | @param Language A pointer to a Null-terminated ASCII string\r | |
280 | array indicating the language. This is the\r | |
281 | language of the driver name that the caller is\r | |
282 | requesting, and it must match one of the\r | |
283 | languages specified in SupportedLanguages. The\r | |
284 | number of languages supported by a driver is up\r | |
285 | to the driver writer. Language is specified\r | |
0254efc0 | 286 | in RFC 4646 or ISO 639-2 language code format.\r |
b4e73a63 | 287 | @param DriverName A pointer to the Unicode string to return.\r |
288 | This Unicode string is the name of the\r | |
289 | driver specified by This in the language\r | |
290 | specified by Language.\r | |
291 | \r | |
292 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
293 | This and the language specified by Language was\r | |
294 | returned in DriverName.\r | |
295 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
296 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
297 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
298 | the language specified by Language.\r | |
299 | \r | |
300 | **/\r | |
301 | EFI_STATUS\r | |
302 | EFIAPI\r | |
303 | UsbKeyboardComponentNameGetDriverName (\r | |
304 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
305 | IN CHAR8 *Language,\r | |
306 | OUT CHAR16 **DriverName\r | |
307 | );\r | |
308 | \r | |
309 | /**\r | |
310 | Retrieves a Unicode string that is the user readable name of the controller\r | |
311 | that is being managed by a driver.\r | |
312 | \r | |
313 | This function retrieves the user readable name of the controller specified by\r | |
314 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
315 | driver specified by This has a user readable name in the language specified by\r | |
316 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
317 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
318 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
319 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
320 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
321 | \r | |
322 | @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
323 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
324 | @param ControllerHandle The handle of a controller that the driver\r | |
325 | specified by This is managing. This handle\r | |
326 | specifies the controller whose name is to be\r | |
327 | returned.\r | |
328 | @param ChildHandle The handle of the child controller to retrieve\r | |
329 | the name of. This is an optional parameter that\r | |
330 | may be NULL. It will be NULL for device\r | |
331 | drivers. It will also be NULL for a bus drivers\r | |
332 | that wish to retrieve the name of the bus\r | |
333 | controller. It will not be NULL for a bus\r | |
334 | driver that wishes to retrieve the name of a\r | |
335 | child controller.\r | |
336 | @param Language A pointer to a Null-terminated ASCII string\r | |
337 | array indicating the language. This is the\r | |
338 | language of the driver name that the caller is\r | |
339 | requesting, and it must match one of the\r | |
340 | languages specified in SupportedLanguages. The\r | |
341 | number of languages supported by a driver is up\r | |
342 | to the driver writer. Language is specified in\r | |
0254efc0 | 343 | RFC 4646 or ISO 639-2 language code format.\r |
b4e73a63 | 344 | @param ControllerName A pointer to the Unicode string to return.\r |
345 | This Unicode string is the name of the\r | |
346 | controller specified by ControllerHandle and\r | |
347 | ChildHandle in the language specified by\r | |
348 | Language from the point of view of the driver\r | |
349 | specified by This.\r | |
350 | \r | |
351 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
352 | the language specified by Language for the\r | |
353 | driver specified by This was returned in\r | |
354 | DriverName.\r | |
355 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r | |
356 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
357 | EFI_HANDLE.\r | |
358 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
359 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
360 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
361 | managing the controller specified by\r | |
362 | ControllerHandle and ChildHandle.\r | |
363 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
364 | the language specified by Language.\r | |
365 | \r | |
366 | **/\r | |
367 | EFI_STATUS\r | |
368 | EFIAPI\r | |
369 | UsbKeyboardComponentNameGetControllerName (\r | |
370 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
371 | IN EFI_HANDLE ControllerHandle,\r | |
372 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
373 | IN CHAR8 *Language,\r | |
374 | OUT CHAR16 **ControllerName\r | |
375 | );\r | |
376 | \r | |
5899f27e | 377 | //\r |
378 | // Functions of Simple Text Input Protocol\r | |
379 | //\r | |
380 | /**\r | |
b4e73a63 | 381 | Reset the input device and optionaly run diagnostics\r |
5899f27e | 382 | \r |
383 | There are 2 types of reset for USB keyboard.\r | |
384 | For non-exhaustive reset, only keyboard buffer is cleared.\r | |
385 | For exhaustive reset, in addition to clearance of keyboard buffer, the hardware status\r | |
386 | is also re-initialized.\r | |
387 | \r | |
b4e73a63 | 388 | @param This Protocol instance pointer.\r |
389 | @param ExtendedVerification Driver may perform diagnostics on reset.\r | |
5899f27e | 390 | \r |
b4e73a63 | 391 | @retval EFI_SUCCESS The device was reset.\r |
392 | @retval EFI_DEVICE_ERROR The device is not functioning properly and could not be reset.\r | |
5899f27e | 393 | \r |
394 | **/\r | |
395 | EFI_STATUS\r | |
396 | EFIAPI\r | |
397 | USBKeyboardReset (\r | |
398 | IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r | |
399 | IN BOOLEAN ExtendedVerification\r | |
400 | );\r | |
401 | \r | |
402 | /**\r | |
b4e73a63 | 403 | Reads the next keystroke from the input device.\r |
5899f27e | 404 | \r |
405 | @param This The EFI_SIMPLE_TEXT_INPUT_PROTOCOL instance.\r | |
406 | @param Key A pointer to a buffer that is filled in with the keystroke\r | |
407 | information for the key that was pressed.\r | |
408 | \r | |
b4e73a63 | 409 | @retval EFI_SUCCESS The keystroke information was returned.\r |
410 | @retval EFI_NOT_READY There was no keystroke data availiable.\r | |
411 | @retval EFI_DEVICE_ERROR The keydtroke information was not returned due to\r | |
412 | hardware errors.\r | |
5899f27e | 413 | \r |
414 | **/\r | |
415 | EFI_STATUS\r | |
416 | EFIAPI\r | |
417 | USBKeyboardReadKeyStroke (\r | |
418 | IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r | |
419 | OUT EFI_INPUT_KEY *Key\r | |
420 | );\r | |
421 | \r | |
66aa04e4 | 422 | //\r |
423 | // Simple Text Input Ex protocol functions\r | |
424 | //\r | |
a7022cec | 425 | /**\r |
b4e73a63 | 426 | Resets the input device hardware.\r |
a7022cec | 427 | \r |
b4e73a63 | 428 | The Reset() function resets the input device hardware. As part\r |
429 | of initialization process, the firmware/device will make a quick\r | |
430 | but reasonable attempt to verify that the device is functioning.\r | |
431 | If the ExtendedVerification flag is TRUE the firmware may take\r | |
432 | an extended amount of time to verify the device is operating on\r | |
433 | reset. Otherwise the reset operation is to occur as quickly as\r | |
434 | possible. The hardware verification process is not defined by\r | |
435 | this specification and is left up to the platform firmware or\r | |
436 | driver to implement.\r | |
a7022cec | 437 | \r |
b4e73a63 | 438 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.\r |
439 | \r | |
440 | @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r | |
441 | verification operation of the device during reset.\r | |
442 | \r | |
443 | @retval EFI_SUCCESS The device was reset.\r | |
444 | @retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset.\r | |
a7022cec | 445 | \r |
446 | **/\r | |
66aa04e4 | 447 | EFI_STATUS\r |
448 | EFIAPI\r | |
449 | USBKeyboardResetEx (\r | |
450 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
451 | IN BOOLEAN ExtendedVerification\r | |
ed66e1bc | 452 | );\r |
66aa04e4 | 453 | \r |
a7022cec | 454 | /**\r |
b4e73a63 | 455 | Reads the next keystroke from the input device.\r |
66aa04e4 | 456 | \r |
b4e73a63 | 457 | @param This Protocol instance pointer.\r |
458 | @param KeyData A pointer to a buffer that is filled in with the keystroke\r | |
459 | state data for the key that was pressed.\r | |
66aa04e4 | 460 | \r |
b4e73a63 | 461 | @retval EFI_SUCCESS The keystroke information was returned.\r |
462 | @retval EFI_NOT_READY There was no keystroke data available.\r | |
463 | @retval EFI_DEVICE_ERROR The keystroke information was not returned due to\r | |
464 | hardware errors.\r | |
465 | @retval EFI_INVALID_PARAMETER KeyData is NULL.\r | |
66aa04e4 | 466 | \r |
a7022cec | 467 | **/\r |
66aa04e4 | 468 | EFI_STATUS\r |
469 | EFIAPI\r | |
470 | USBKeyboardReadKeyStrokeEx (\r | |
471 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
472 | OUT EFI_KEY_DATA *KeyData\r | |
ed66e1bc | 473 | );\r |
66aa04e4 | 474 | \r |
a7022cec | 475 | /**\r |
476 | Set certain state for the input device.\r | |
66aa04e4 | 477 | \r |
a7022cec | 478 | @param This Protocol instance pointer.\r |
479 | @param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the\r | |
480 | state for the input device.\r | |
66aa04e4 | 481 | \r |
b4e73a63 | 482 | @retval EFI_SUCCESS The device state was set appropriately.\r |
483 | @retval EFI_DEVICE_ERROR The device is not functioning correctly and could\r | |
484 | not have the setting adjusted.\r | |
485 | @retval EFI_UNSUPPORTED The device does not support the ability to have its state set.\r | |
a7022cec | 486 | @retval EFI_INVALID_PARAMETER KeyToggleState is NULL.\r |
66aa04e4 | 487 | \r |
a7022cec | 488 | **/\r |
66aa04e4 | 489 | EFI_STATUS\r |
490 | EFIAPI\r | |
491 | USBKeyboardSetState (\r | |
492 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
493 | IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r | |
ed66e1bc | 494 | );\r |
66aa04e4 | 495 | \r |
a7022cec | 496 | /**\r |
497 | Register a notification function for a particular keystroke for the input device.\r | |
498 | \r | |
499 | @param This Protocol instance pointer.\r | |
500 | @param KeyData A pointer to a buffer that is filled in with the keystroke\r | |
501 | information data for the key that was pressed.\r | |
502 | @param KeyNotificationFunction Points to the function to be called when the key\r | |
503 | sequence is typed specified by KeyData.\r | |
504 | @param NotifyHandle Points to the unique handle assigned to the registered notification.\r | |
505 | \r | |
506 | @retval EFI_SUCCESS The notification function was registered successfully.\r | |
507 | @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data structures.\r | |
b4e73a63 | 508 | @retval EFI_INVALID_PARAMETER KeyData or NotifyHandle or KeyNotificationFunction is NULL.\r |
a7022cec | 509 | \r |
510 | **/\r | |
66aa04e4 | 511 | EFI_STATUS\r |
512 | EFIAPI\r | |
513 | USBKeyboardRegisterKeyNotify (\r | |
514 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
515 | IN EFI_KEY_DATA *KeyData,\r | |
516 | IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r | |
517 | OUT EFI_HANDLE *NotifyHandle\r | |
ed66e1bc | 518 | );\r |
66aa04e4 | 519 | \r |
a7022cec | 520 | /**\r |
521 | Remove a registered notification function from a particular keystroke.\r | |
522 | \r | |
523 | @param This Protocol instance pointer.\r | |
524 | @param NotificationHandle The handle of the notification function being unregistered.\r | |
525 | \r | |
526 | @retval EFI_SUCCESS The notification function was unregistered successfully.\r | |
b4e73a63 | 527 | @retval EFI_INVALID_PARAMETER The NotificationHandle is invalid\r |
528 | @retval EFI_NOT_FOUND Cannot find the matching entry in database.\r | |
a7022cec | 529 | \r |
530 | **/\r | |
66aa04e4 | 531 | EFI_STATUS\r |
532 | EFIAPI\r | |
533 | USBKeyboardUnregisterKeyNotify (\r | |
534 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
535 | IN EFI_HANDLE NotificationHandle\r | |
ed66e1bc | 536 | );\r |
66aa04e4 | 537 | \r |
5899f27e | 538 | /**\r |
b4e73a63 | 539 | Event notification function registered for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx\r |
540 | and EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey.\r | |
5899f27e | 541 | \r |
542 | @param Event Event to be signaled when a key is pressed.\r | |
543 | @param Context Points to USB_KB_DEV instance.\r | |
544 | \r | |
545 | **/\r | |
546 | VOID\r | |
547 | EFIAPI\r | |
548 | USBKeyboardWaitForKey (\r | |
549 | IN EFI_EVENT Event,\r | |
550 | IN VOID *Context\r | |
551 | );\r | |
552 | \r | |
553 | /**\r | |
554 | Free keyboard notify list.\r | |
555 | \r | |
b4e73a63 | 556 | @param NotifyList The keyboard notify list to free.\r |
5899f27e | 557 | \r |
558 | @retval EFI_SUCCESS Free the notify list successfully.\r | |
b4e73a63 | 559 | @retval EFI_INVALID_PARAMETER NotifyList is NULL.\r |
5899f27e | 560 | \r |
561 | **/\r | |
562 | EFI_STATUS\r | |
5899f27e | 563 | KbdFreeNotifyList (\r |
b4e73a63 | 564 | IN OUT LIST_ENTRY *NotifyList\r |
5899f27e | 565 | );\r |
566 | \r | |
5899f27e | 567 | /**\r |
b4e73a63 | 568 | Check whether the pressed key matches a registered key or not.\r |
5899f27e | 569 | \r |
b4e73a63 | 570 | @param RegsiteredData A pointer to keystroke data for the key that was registered.\r |
571 | @param InputData A pointer to keystroke data for the key that was pressed.\r | |
5899f27e | 572 | \r |
573 | @retval TRUE Key pressed matches a registered key.\r | |
b4e73a63 | 574 | @retval FLASE Key pressed does not matche a registered key.\r |
5899f27e | 575 | \r |
576 | **/\r | |
577 | BOOLEAN\r | |
5899f27e | 578 | IsKeyRegistered (\r |
579 | IN EFI_KEY_DATA *RegsiteredData,\r | |
580 | IN EFI_KEY_DATA *InputData\r | |
581 | );\r | |
582 | \r | |
c1fd2767 RN |
583 | /**\r |
584 | Timer handler to convert the key from USB.\r | |
585 | \r | |
586 | @param Event Indicates the event that invoke this function.\r | |
587 | @param Context Indicates the calling context.\r | |
588 | **/\r | |
589 | VOID\r | |
590 | EFIAPI\r | |
591 | USBKeyboardTimerHandler (\r | |
592 | IN EFI_EVENT Event,\r | |
593 | IN VOID *Context\r | |
594 | );\r | |
595 | \r | |
ed838d0c | 596 | #endif\r |
66aa04e4 | 597 | \r |