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