]>
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 |
3765794c | 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 | |
3765794c | 141 | BOOLEAN RightLogoOn;\r |
b4e73a63 | 142 | BOOLEAN MenuKeyOn;\r |
143 | BOOLEAN SysReqOn;\r | |
144 | BOOLEAN AltGrOn;\r | |
3765794c | 145 | \r |
146 | BOOLEAN IsSupportPartialKey;\r | |
147 | \r | |
148 | EFI_KEY_STATE KeyState;\r | |
66aa04e4 | 149 | //\r |
150 | // Notification function list\r | |
151 | //\r | |
5899f27e | 152 | LIST_ENTRY NotifyList;\r |
813acf3a | 153 | \r |
154 | //\r | |
155 | // Non-spacing key list\r | |
156 | //\r | |
5899f27e | 157 | LIST_ENTRY NsKeyList;\r |
158 | USB_NS_KEY *CurrentNsKey;\r | |
159 | EFI_KEY_DESCRIPTOR *KeyConvertionTable;\r | |
160 | EFI_EVENT KeyboardLayoutEvent;\r | |
ed838d0c | 161 | } USB_KB_DEV;\r |
162 | \r | |
163 | //\r | |
164 | // Global Variables\r | |
165 | //\r | |
62b9bb55 | 166 | extern EFI_DRIVER_BINDING_PROTOCOL gUsbKeyboardDriverBinding;\r |
167 | extern EFI_COMPONENT_NAME_PROTOCOL gUsbKeyboardComponentName;\r | |
168 | extern EFI_COMPONENT_NAME2_PROTOCOL gUsbKeyboardComponentName2;\r | |
ed838d0c | 169 | \r |
ed838d0c | 170 | #define USB_KB_DEV_FROM_THIS(a) \\r |
171 | CR(a, USB_KB_DEV, SimpleInput, USB_KB_DEV_SIGNATURE)\r | |
66aa04e4 | 172 | #define TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS(a) \\r |
173 | CR(a, USB_KB_DEV, SimpleInputEx, USB_KB_DEV_SIGNATURE)\r | |
174 | \r | |
b4e73a63 | 175 | //\r |
176 | // According to Universal Serial Bus HID Usage Tables document ver 1.12,\r | |
177 | // a Boot Keyboard should support the keycode range from 0x0 to 0x65 and 0xE0 to 0xE7.\r | |
178 | // 0xE0 to 0xE7 are for modifier keys, and 0x0 to 0x3 are reserved for typical\r | |
179 | // keyboard status or keyboard errors.\r | |
180 | // So the number of valid non-modifier USB keycodes is 0x62, and the number of\r | |
181 | // valid keycodes is 0x6A.\r | |
182 | //\r | |
183 | #define NUMBER_OF_VALID_NON_MODIFIER_USB_KEYCODE 0x62\r | |
184 | #define NUMBER_OF_VALID_USB_KEYCODE 0x6A\r | |
185 | //\r | |
186 | // 0x0 to 0x3 are reserved for typical keyboard status or keyboard errors.\r | |
187 | //\r | |
188 | #define USBKBD_VALID_KEYCODE(Key) ((UINT8) (Key) > 3)\r | |
ed838d0c | 189 | \r |
190 | typedef struct {\r | |
191 | UINT8 NumLock : 1;\r | |
192 | UINT8 CapsLock : 1;\r | |
193 | UINT8 ScrollLock : 1;\r | |
194 | UINT8 Resrvd : 5;\r | |
195 | } LED_MAP;\r | |
66aa04e4 | 196 | \r |
5899f27e | 197 | //\r |
198 | // Functions of Driver Binding Protocol\r | |
199 | //\r | |
200 | /**\r | |
201 | Check whether USB keyboard driver supports this device.\r | |
202 | \r | |
203 | @param This The USB keyboard driver binding protocol.\r | |
204 | @param Controller The controller handle to check.\r | |
205 | @param RemainingDevicePath The remaining device path.\r | |
206 | \r | |
207 | @retval EFI_SUCCESS The driver supports this controller.\r | |
208 | @retval other This device isn't supported.\r | |
209 | \r | |
210 | **/\r | |
211 | EFI_STATUS\r | |
212 | EFIAPI\r | |
213 | USBKeyboardDriverBindingSupported (\r | |
214 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
215 | IN EFI_HANDLE Controller,\r | |
216 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
217 | );\r | |
218 | \r | |
219 | /**\r | |
c92e277d | 220 | Starts the keyboard device with this driver.\r |
b4e73a63 | 221 | \r |
222 | This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r | |
223 | initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r | |
224 | this keyboard device.\r | |
5899f27e | 225 | \r |
226 | @param This The USB keyboard driver binding instance.\r | |
227 | @param Controller Handle of device to bind driver to.\r | |
228 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
229 | device to start.\r | |
230 | \r | |
231 | @retval EFI_SUCCESS The controller is controlled by the usb keyboard driver.\r | |
232 | @retval EFI_UNSUPPORTED No interrupt endpoint can be found.\r | |
b4e73a63 | 233 | @retval Other This controller cannot be started.\r |
5899f27e | 234 | \r |
235 | **/\r | |
236 | EFI_STATUS\r | |
237 | EFIAPI\r | |
238 | USBKeyboardDriverBindingStart (\r | |
239 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
240 | IN EFI_HANDLE Controller,\r | |
241 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
242 | );\r | |
243 | \r | |
244 | /**\r | |
b4e73a63 | 245 | Stop the USB keyboard device handled by this driver.\r |
5899f27e | 246 | \r |
247 | @param This The USB keyboard driver binding protocol.\r | |
248 | @param Controller The controller to release.\r | |
249 | @param NumberOfChildren The number of handles in ChildHandleBuffer.\r | |
250 | @param ChildHandleBuffer The array of child handle.\r | |
251 | \r | |
b4e73a63 | 252 | @retval EFI_SUCCESS The device was stopped.\r |
5899f27e | 253 | @retval EFI_UNSUPPORTED Simple Text In Protocol or Simple Text In Ex Protocol\r |
254 | is not installed on Controller.\r | |
b4e73a63 | 255 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r |
256 | @retval Others Fail to uninstall protocols attached on the device.\r | |
5899f27e | 257 | \r |
258 | **/\r | |
259 | EFI_STATUS\r | |
260 | EFIAPI\r | |
261 | USBKeyboardDriverBindingStop (\r | |
262 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
263 | IN EFI_HANDLE Controller,\r | |
264 | IN UINTN NumberOfChildren,\r | |
265 | IN EFI_HANDLE *ChildHandleBuffer\r | |
266 | );\r | |
267 | \r | |
b4e73a63 | 268 | //\r |
269 | // EFI Component Name Functions\r | |
270 | //\r | |
271 | /**\r | |
272 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
273 | \r | |
274 | This function retrieves the user readable name of a driver in the form of a\r | |
275 | Unicode string. If the driver specified by This has a user readable name in\r | |
276 | the language specified by Language, then a pointer to the driver name is\r | |
277 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
278 | by This does not support the language specified by Language,\r | |
279 | then EFI_UNSUPPORTED is returned.\r | |
280 | \r | |
281 | @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
282 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
283 | @param Language A pointer to a Null-terminated ASCII string\r | |
284 | array indicating the language. This is the\r | |
285 | language of the driver name that the caller is\r | |
286 | requesting, and it must match one of the\r | |
287 | languages specified in SupportedLanguages. The\r | |
288 | number of languages supported by a driver is up\r | |
289 | to the driver writer. Language is specified\r | |
0254efc0 | 290 | in RFC 4646 or ISO 639-2 language code format.\r |
b4e73a63 | 291 | @param DriverName A pointer to the Unicode string to return.\r |
292 | This Unicode string is the name of the\r | |
293 | driver specified by This in the language\r | |
294 | specified by Language.\r | |
295 | \r | |
296 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
297 | This and the language specified by Language was\r | |
298 | returned in DriverName.\r | |
299 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
300 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
301 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
302 | the language specified by Language.\r | |
303 | \r | |
304 | **/\r | |
305 | EFI_STATUS\r | |
306 | EFIAPI\r | |
307 | UsbKeyboardComponentNameGetDriverName (\r | |
308 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
309 | IN CHAR8 *Language,\r | |
310 | OUT CHAR16 **DriverName\r | |
311 | );\r | |
312 | \r | |
313 | /**\r | |
314 | Retrieves a Unicode string that is the user readable name of the controller\r | |
315 | that is being managed by a driver.\r | |
316 | \r | |
317 | This function retrieves the user readable name of the controller specified by\r | |
318 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
319 | driver specified by This has a user readable name in the language specified by\r | |
320 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
321 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
322 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
323 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
324 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
325 | \r | |
326 | @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
327 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
328 | @param ControllerHandle The handle of a controller that the driver\r | |
329 | specified by This is managing. This handle\r | |
330 | specifies the controller whose name is to be\r | |
331 | returned.\r | |
332 | @param ChildHandle The handle of the child controller to retrieve\r | |
333 | the name of. This is an optional parameter that\r | |
334 | may be NULL. It will be NULL for device\r | |
335 | drivers. It will also be NULL for a bus drivers\r | |
336 | that wish to retrieve the name of the bus\r | |
337 | controller. It will not be NULL for a bus\r | |
338 | driver that wishes to retrieve the name of a\r | |
339 | child controller.\r | |
340 | @param Language A pointer to a Null-terminated ASCII string\r | |
341 | array indicating the language. This is the\r | |
342 | language of the driver name that the caller is\r | |
343 | requesting, and it must match one of the\r | |
344 | languages specified in SupportedLanguages. The\r | |
345 | number of languages supported by a driver is up\r | |
346 | to the driver writer. Language is specified in\r | |
0254efc0 | 347 | RFC 4646 or ISO 639-2 language code format.\r |
b4e73a63 | 348 | @param ControllerName A pointer to the Unicode string to return.\r |
349 | This Unicode string is the name of the\r | |
350 | controller specified by ControllerHandle and\r | |
351 | ChildHandle in the language specified by\r | |
352 | Language from the point of view of the driver\r | |
353 | specified by This.\r | |
354 | \r | |
355 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
356 | the language specified by Language for the\r | |
357 | driver specified by This was returned in\r | |
358 | DriverName.\r | |
359 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r | |
360 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
361 | EFI_HANDLE.\r | |
362 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
363 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
364 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
365 | managing the controller specified by\r | |
366 | ControllerHandle and ChildHandle.\r | |
367 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
368 | the language specified by Language.\r | |
369 | \r | |
370 | **/\r | |
371 | EFI_STATUS\r | |
372 | EFIAPI\r | |
373 | UsbKeyboardComponentNameGetControllerName (\r | |
374 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
375 | IN EFI_HANDLE ControllerHandle,\r | |
376 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
377 | IN CHAR8 *Language,\r | |
378 | OUT CHAR16 **ControllerName\r | |
379 | );\r | |
380 | \r | |
5899f27e | 381 | //\r |
382 | // Functions of Simple Text Input Protocol\r | |
383 | //\r | |
384 | /**\r | |
b4e73a63 | 385 | Reset the input device and optionaly run diagnostics\r |
5899f27e | 386 | \r |
387 | There are 2 types of reset for USB keyboard.\r | |
388 | For non-exhaustive reset, only keyboard buffer is cleared.\r | |
389 | For exhaustive reset, in addition to clearance of keyboard buffer, the hardware status\r | |
390 | is also re-initialized.\r | |
391 | \r | |
b4e73a63 | 392 | @param This Protocol instance pointer.\r |
393 | @param ExtendedVerification Driver may perform diagnostics on reset.\r | |
5899f27e | 394 | \r |
b4e73a63 | 395 | @retval EFI_SUCCESS The device was reset.\r |
396 | @retval EFI_DEVICE_ERROR The device is not functioning properly and could not be reset.\r | |
5899f27e | 397 | \r |
398 | **/\r | |
399 | EFI_STATUS\r | |
400 | EFIAPI\r | |
401 | USBKeyboardReset (\r | |
402 | IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r | |
403 | IN BOOLEAN ExtendedVerification\r | |
404 | );\r | |
405 | \r | |
406 | /**\r | |
b4e73a63 | 407 | Reads the next keystroke from the input device.\r |
5899f27e | 408 | \r |
409 | @param This The EFI_SIMPLE_TEXT_INPUT_PROTOCOL instance.\r | |
410 | @param Key A pointer to a buffer that is filled in with the keystroke\r | |
411 | information for the key that was pressed.\r | |
412 | \r | |
b4e73a63 | 413 | @retval EFI_SUCCESS The keystroke information was returned.\r |
414 | @retval EFI_NOT_READY There was no keystroke data availiable.\r | |
415 | @retval EFI_DEVICE_ERROR The keydtroke information was not returned due to\r | |
416 | hardware errors.\r | |
5899f27e | 417 | \r |
418 | **/\r | |
419 | EFI_STATUS\r | |
420 | EFIAPI\r | |
421 | USBKeyboardReadKeyStroke (\r | |
422 | IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,\r | |
423 | OUT EFI_INPUT_KEY *Key\r | |
424 | );\r | |
425 | \r | |
66aa04e4 | 426 | //\r |
427 | // Simple Text Input Ex protocol functions\r | |
428 | //\r | |
a7022cec | 429 | /**\r |
b4e73a63 | 430 | Resets the input device hardware.\r |
a7022cec | 431 | \r |
b4e73a63 | 432 | The Reset() function resets the input device hardware. As part\r |
433 | of initialization process, the firmware/device will make a quick\r | |
434 | but reasonable attempt to verify that the device is functioning.\r | |
435 | If the ExtendedVerification flag is TRUE the firmware may take\r | |
436 | an extended amount of time to verify the device is operating on\r | |
437 | reset. Otherwise the reset operation is to occur as quickly as\r | |
438 | possible. The hardware verification process is not defined by\r | |
439 | this specification and is left up to the platform firmware or\r | |
440 | driver to implement.\r | |
a7022cec | 441 | \r |
b4e73a63 | 442 | @param This A pointer to the EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL instance.\r |
443 | \r | |
444 | @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r | |
445 | verification operation of the device during reset.\r | |
446 | \r | |
447 | @retval EFI_SUCCESS The device was reset.\r | |
448 | @retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset.\r | |
a7022cec | 449 | \r |
450 | **/\r | |
66aa04e4 | 451 | EFI_STATUS\r |
452 | EFIAPI\r | |
453 | USBKeyboardResetEx (\r | |
454 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
455 | IN BOOLEAN ExtendedVerification\r | |
ed66e1bc | 456 | );\r |
66aa04e4 | 457 | \r |
a7022cec | 458 | /**\r |
b4e73a63 | 459 | Reads the next keystroke from the input device.\r |
66aa04e4 | 460 | \r |
b4e73a63 | 461 | @param This Protocol instance pointer.\r |
462 | @param KeyData A pointer to a buffer that is filled in with the keystroke\r | |
463 | state data for the key that was pressed.\r | |
66aa04e4 | 464 | \r |
b4e73a63 | 465 | @retval EFI_SUCCESS The keystroke information was returned.\r |
466 | @retval EFI_NOT_READY There was no keystroke data available.\r | |
467 | @retval EFI_DEVICE_ERROR The keystroke information was not returned due to\r | |
468 | hardware errors.\r | |
469 | @retval EFI_INVALID_PARAMETER KeyData is NULL.\r | |
66aa04e4 | 470 | \r |
a7022cec | 471 | **/\r |
66aa04e4 | 472 | EFI_STATUS\r |
473 | EFIAPI\r | |
474 | USBKeyboardReadKeyStrokeEx (\r | |
475 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
476 | OUT EFI_KEY_DATA *KeyData\r | |
ed66e1bc | 477 | );\r |
66aa04e4 | 478 | \r |
a7022cec | 479 | /**\r |
480 | Set certain state for the input device.\r | |
66aa04e4 | 481 | \r |
a7022cec | 482 | @param This Protocol instance pointer.\r |
483 | @param KeyToggleState A pointer to the EFI_KEY_TOGGLE_STATE to set the\r | |
484 | state for the input device.\r | |
66aa04e4 | 485 | \r |
b4e73a63 | 486 | @retval EFI_SUCCESS The device state was set appropriately.\r |
487 | @retval EFI_DEVICE_ERROR The device is not functioning correctly and could\r | |
488 | not have the setting adjusted.\r | |
489 | @retval EFI_UNSUPPORTED The device does not support the ability to have its state set.\r | |
a7022cec | 490 | @retval EFI_INVALID_PARAMETER KeyToggleState is NULL.\r |
66aa04e4 | 491 | \r |
a7022cec | 492 | **/\r |
66aa04e4 | 493 | EFI_STATUS\r |
494 | EFIAPI\r | |
495 | USBKeyboardSetState (\r | |
496 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
497 | IN EFI_KEY_TOGGLE_STATE *KeyToggleState\r | |
ed66e1bc | 498 | );\r |
66aa04e4 | 499 | \r |
a7022cec | 500 | /**\r |
501 | Register a notification function for a particular keystroke for the input device.\r | |
502 | \r | |
503 | @param This Protocol instance pointer.\r | |
504 | @param KeyData A pointer to a buffer that is filled in with the keystroke\r | |
505 | information data for the key that was pressed.\r | |
506 | @param KeyNotificationFunction Points to the function to be called when the key\r | |
507 | sequence is typed specified by KeyData.\r | |
508 | @param NotifyHandle Points to the unique handle assigned to the registered notification.\r | |
509 | \r | |
510 | @retval EFI_SUCCESS The notification function was registered successfully.\r | |
511 | @retval EFI_OUT_OF_RESOURCES Unable to allocate resources for necesssary data structures.\r | |
b4e73a63 | 512 | @retval EFI_INVALID_PARAMETER KeyData or NotifyHandle or KeyNotificationFunction is NULL.\r |
a7022cec | 513 | \r |
514 | **/\r | |
66aa04e4 | 515 | EFI_STATUS\r |
516 | EFIAPI\r | |
517 | USBKeyboardRegisterKeyNotify (\r | |
518 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
519 | IN EFI_KEY_DATA *KeyData,\r | |
520 | IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction,\r | |
521 | OUT EFI_HANDLE *NotifyHandle\r | |
ed66e1bc | 522 | );\r |
66aa04e4 | 523 | \r |
a7022cec | 524 | /**\r |
525 | Remove a registered notification function from a particular keystroke.\r | |
526 | \r | |
527 | @param This Protocol instance pointer.\r | |
528 | @param NotificationHandle The handle of the notification function being unregistered.\r | |
529 | \r | |
530 | @retval EFI_SUCCESS The notification function was unregistered successfully.\r | |
b4e73a63 | 531 | @retval EFI_INVALID_PARAMETER The NotificationHandle is invalid\r |
532 | @retval EFI_NOT_FOUND Cannot find the matching entry in database.\r | |
a7022cec | 533 | \r |
534 | **/\r | |
66aa04e4 | 535 | EFI_STATUS\r |
536 | EFIAPI\r | |
537 | USBKeyboardUnregisterKeyNotify (\r | |
538 | IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,\r | |
539 | IN EFI_HANDLE NotificationHandle\r | |
ed66e1bc | 540 | );\r |
66aa04e4 | 541 | \r |
5899f27e | 542 | /**\r |
b4e73a63 | 543 | Event notification function registered for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx\r |
544 | and EFI_SIMPLE_TEXT_INPUT_PROTOCOL.WaitForKey.\r | |
5899f27e | 545 | \r |
546 | @param Event Event to be signaled when a key is pressed.\r | |
547 | @param Context Points to USB_KB_DEV instance.\r | |
548 | \r | |
549 | **/\r | |
550 | VOID\r | |
551 | EFIAPI\r | |
552 | USBKeyboardWaitForKey (\r | |
553 | IN EFI_EVENT Event,\r | |
554 | IN VOID *Context\r | |
555 | );\r | |
556 | \r | |
557 | /**\r | |
558 | Free keyboard notify list.\r | |
559 | \r | |
b4e73a63 | 560 | @param NotifyList The keyboard notify list to free.\r |
5899f27e | 561 | \r |
562 | @retval EFI_SUCCESS Free the notify list successfully.\r | |
b4e73a63 | 563 | @retval EFI_INVALID_PARAMETER NotifyList is NULL.\r |
5899f27e | 564 | \r |
565 | **/\r | |
566 | EFI_STATUS\r | |
5899f27e | 567 | KbdFreeNotifyList (\r |
b4e73a63 | 568 | IN OUT LIST_ENTRY *NotifyList\r |
5899f27e | 569 | );\r |
570 | \r | |
5899f27e | 571 | /**\r |
b4e73a63 | 572 | Check whether the pressed key matches a registered key or not.\r |
5899f27e | 573 | \r |
b4e73a63 | 574 | @param RegsiteredData A pointer to keystroke data for the key that was registered.\r |
575 | @param InputData A pointer to keystroke data for the key that was pressed.\r | |
5899f27e | 576 | \r |
577 | @retval TRUE Key pressed matches a registered key.\r | |
b4e73a63 | 578 | @retval FLASE Key pressed does not matche a registered key.\r |
5899f27e | 579 | \r |
580 | **/\r | |
581 | BOOLEAN\r | |
5899f27e | 582 | IsKeyRegistered (\r |
583 | IN EFI_KEY_DATA *RegsiteredData,\r | |
584 | IN EFI_KEY_DATA *InputData\r | |
585 | );\r | |
586 | \r | |
c1fd2767 RN |
587 | /**\r |
588 | Timer handler to convert the key from USB.\r | |
589 | \r | |
590 | @param Event Indicates the event that invoke this function.\r | |
591 | @param Context Indicates the calling context.\r | |
592 | **/\r | |
593 | VOID\r | |
594 | EFIAPI\r | |
595 | USBKeyboardTimerHandler (\r | |
596 | IN EFI_EVENT Event,\r | |
597 | IN VOID *Context\r | |
598 | );\r | |
599 | \r | |
ed838d0c | 600 | #endif\r |
66aa04e4 | 601 | \r |