]>
Commit | Line | Data |
---|---|---|
09f72ae8 | 1 | /** @file\r |
67b8a9ce | 2 | USB Mouse Driver that manages USB mouse and produces Absolute Pointer Protocol.\r |
09f72ae8 | 3 | \r |
67b8a9ce | 4 | Copyright (c) 2004 - 2008, Intel Corporation\r |
09f72ae8 | 5 | All rights reserved. This program and the accompanying materials\r |
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 | |
09f72ae8 | 13 | **/\r |
14 | \r | |
15 | #include "UsbMouseAbsolutePointer.h"\r | |
16 | \r | |
09f72ae8 | 17 | EFI_DRIVER_BINDING_PROTOCOL gUsbMouseAbsolutePointerDriverBinding = {\r |
18 | USBMouseAbsolutePointerDriverBindingSupported,\r | |
19 | USBMouseAbsolutePointerDriverBindingStart,\r | |
20 | USBMouseAbsolutePointerDriverBindingStop,\r | |
21 | 0x1,\r | |
22 | NULL,\r | |
23 | NULL\r | |
24 | };\r | |
25 | \r | |
67b8a9ce | 26 | /**\r |
27 | Entrypoint of USB Mouse Absolute Pointer Driver.\r | |
09f72ae8 | 28 | \r |
67b8a9ce | 29 | This function is the entrypoint of USB Mouse Driver. It installs Driver Binding\r |
30 | Protocols together with Component Name Protocols.\r | |
09f72ae8 | 31 | \r |
67b8a9ce | 32 | @param ImageHandle The firmware allocated handle for the EFI image.\r |
33 | @param SystemTable A pointer to the EFI System Table.\r | |
09f72ae8 | 34 | \r |
67b8a9ce | 35 | @retval EFI_SUCCESS The entry point is executed successfully.\r |
09f72ae8 | 36 | \r |
67b8a9ce | 37 | **/\r |
09f72ae8 | 38 | EFI_STATUS\r |
39 | EFIAPI\r | |
40 | USBMouseAbsolutePointerDriverBindingEntryPoint (\r | |
41 | IN EFI_HANDLE ImageHandle,\r | |
42 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
43 | )\r | |
67b8a9ce | 44 | {\r |
45 | EFI_STATUS Status;\r | |
09f72ae8 | 46 | \r |
67b8a9ce | 47 | Status = EfiLibInstallDriverBindingComponentName2 (\r |
48 | ImageHandle,\r | |
49 | SystemTable,\r | |
50 | &gUsbMouseAbsolutePointerDriverBinding,\r | |
51 | ImageHandle,\r | |
52 | &gUsbMouseAbsolutePointerComponentName,\r | |
53 | &gUsbMouseAbsolutePointerComponentName2\r | |
54 | );\r | |
55 | ASSERT_EFI_ERROR (Status);\r | |
09f72ae8 | 56 | \r |
67b8a9ce | 57 | return EFI_SUCCESS;\r |
09f72ae8 | 58 | }\r |
59 | \r | |
60 | \r | |
61 | /**\r | |
67b8a9ce | 62 | Check whether USB Mouse Absolute Pointer Driver supports this device.\r |
09f72ae8 | 63 | \r |
67b8a9ce | 64 | @param This The driver binding protocol.\r |
65 | @param Controller The controller handle to check.\r | |
66 | @param RemainingDevicePath The remaining device path.\r | |
09f72ae8 | 67 | \r |
67b8a9ce | 68 | @retval EFI_SUCCESS The driver supports this controller.\r |
69 | @retval other This device isn't supported.\r | |
09f72ae8 | 70 | \r |
71 | **/\r | |
72 | EFI_STATUS\r | |
73 | EFIAPI\r | |
74 | USBMouseAbsolutePointerDriverBindingSupported (\r | |
75 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
76 | IN EFI_HANDLE Controller,\r | |
77 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
78 | )\r | |
79 | {\r | |
09f72ae8 | 80 | EFI_STATUS Status;\r |
67b8a9ce | 81 | EFI_USB_IO_PROTOCOL *UsbIo;\r |
09f72ae8 | 82 | \r |
67b8a9ce | 83 | Status = gBS->OpenProtocol (\r |
84 | Controller,\r | |
85 | &gEfiUsbIoProtocolGuid,\r | |
86 | (VOID **) &UsbIo,\r | |
87 | This->DriverBindingHandle,\r | |
88 | Controller,\r | |
89 | EFI_OPEN_PROTOCOL_BY_DRIVER\r | |
90 | );\r | |
91 | if (EFI_ERROR (Status)) {\r | |
92 | return Status;\r | |
09f72ae8 | 93 | }\r |
94 | \r | |
95 | //\r | |
67b8a9ce | 96 | // Use the USB I/O Protocol interface to check whether Controller is\r |
97 | // a mouse device that can be managed by this driver.\r | |
09f72ae8 | 98 | //\r |
99 | Status = EFI_SUCCESS;\r | |
67b8a9ce | 100 | if (!IsUsbMouse (UsbIo)) {\r |
09f72ae8 | 101 | Status = EFI_UNSUPPORTED;\r |
102 | }\r | |
103 | \r | |
104 | gBS->CloseProtocol (\r | |
105 | Controller,\r | |
106 | &gEfiUsbIoProtocolGuid,\r | |
107 | This->DriverBindingHandle,\r | |
108 | Controller\r | |
109 | );\r | |
110 | \r | |
111 | return Status;\r | |
112 | }\r | |
113 | \r | |
114 | \r | |
115 | /**\r | |
67b8a9ce | 116 | Starts the mouse device with this driver.\r |
09f72ae8 | 117 | \r |
67b8a9ce | 118 | This function consumes USB I/O Portocol, intializes USB mouse device,\r |
119 | installs Absolute Pointer Protocol, and submits Asynchronous Interrupt\r | |
120 | Transfer to manage the USB mouse device.\r | |
121 | \r | |
122 | @param This The driver binding instance.\r | |
123 | @param Controller Handle of device to bind driver to.\r | |
124 | @param RemainingDevicePath Optional parameter use to pick a specific child\r | |
125 | device to start.\r | |
09f72ae8 | 126 | \r |
127 | @retval EFI_SUCCESS This driver supports this device.\r | |
128 | @retval EFI_UNSUPPORTED This driver does not support this device.\r | |
67b8a9ce | 129 | @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.\r |
130 | @retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.\r | |
131 | @retval EFI_ALREADY_STARTED This driver has been started.\r | |
09f72ae8 | 132 | \r |
133 | **/\r | |
134 | EFI_STATUS\r | |
135 | EFIAPI\r | |
136 | USBMouseAbsolutePointerDriverBindingStart (\r | |
137 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
138 | IN EFI_HANDLE Controller,\r | |
139 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
140 | )\r | |
141 | {\r | |
67b8a9ce | 142 | EFI_STATUS Status;\r |
143 | EFI_USB_IO_PROTOCOL *UsbIo;\r | |
144 | USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDevice;\r | |
145 | UINT8 EndpointNumber;\r | |
146 | EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;\r | |
147 | UINT8 Index;\r | |
148 | UINT8 EndpointAddr;\r | |
149 | UINT8 PollingInterval;\r | |
150 | UINT8 PacketSize;\r | |
151 | BOOLEAN Found;\r | |
09f72ae8 | 152 | \r |
67b8a9ce | 153 | //\r |
154 | // Open USB I/O Protocol\r | |
155 | //\r | |
09f72ae8 | 156 | Status = gBS->OpenProtocol (\r |
157 | Controller,\r | |
158 | &gEfiUsbIoProtocolGuid,\r | |
159 | (VOID **) &UsbIo,\r | |
160 | This->DriverBindingHandle,\r | |
161 | Controller,\r | |
162 | EFI_OPEN_PROTOCOL_BY_DRIVER \r | |
163 | );\r | |
164 | if (EFI_ERROR (Status)) {\r | |
67b8a9ce | 165 | return Status;\r |
09f72ae8 | 166 | }\r |
167 | \r | |
168 | UsbMouseAbsolutePointerDevice = AllocateZeroPool (sizeof (USB_MOUSE_ABSOLUTE_POINTER_DEV));\r | |
67b8a9ce | 169 | ASSERT (UsbMouseAbsolutePointerDevice != NULL);\r |
09f72ae8 | 170 | \r |
67b8a9ce | 171 | UsbMouseAbsolutePointerDevice->UsbIo = UsbIo;\r |
172 | UsbMouseAbsolutePointerDevice->Signature = USB_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE;\r | |
09f72ae8 | 173 | \r |
09f72ae8 | 174 | //\r |
175 | // Get the Device Path Protocol on Controller's handle\r | |
176 | //\r | |
177 | Status = gBS->OpenProtocol (\r | |
178 | Controller,\r | |
179 | &gEfiDevicePathProtocolGuid,\r | |
180 | (VOID **) &UsbMouseAbsolutePointerDevice->DevicePath,\r | |
181 | This->DriverBindingHandle,\r | |
182 | Controller,\r | |
183 | EFI_OPEN_PROTOCOL_GET_PROTOCOL\r | |
184 | );\r | |
185 | \r | |
186 | if (EFI_ERROR (Status)) {\r | |
187 | goto ErrorExit;\r | |
188 | }\r | |
189 | //\r | |
190 | // Get interface & endpoint descriptor\r | |
191 | //\r | |
192 | UsbIo->UsbGetInterfaceDescriptor (\r | |
67b8a9ce | 193 | UsbIo,\r |
194 | &UsbMouseAbsolutePointerDevice->InterfaceDescriptor\r | |
195 | );\r | |
09f72ae8 | 196 | \r |
67b8a9ce | 197 | EndpointNumber = UsbMouseAbsolutePointerDevice->InterfaceDescriptor.NumEndpoints;\r |
09f72ae8 | 198 | \r |
67b8a9ce | 199 | //\r |
200 | // Traverse endpoints to find interrupt endpoint\r | |
201 | //\r | |
202 | Found = FALSE;\r | |
09f72ae8 | 203 | for (Index = 0; Index < EndpointNumber; Index++) {\r |
204 | UsbIo->UsbGetEndpointDescriptor (\r | |
67b8a9ce | 205 | UsbIo,\r |
206 | Index,\r | |
207 | &EndpointDescriptor\r | |
208 | );\r | |
09f72ae8 | 209 | \r |
67b8a9ce | 210 | if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) {\r |
09f72ae8 | 211 | //\r |
212 | // We only care interrupt endpoint here\r | |
213 | //\r | |
67b8a9ce | 214 | CopyMem (&UsbMouseAbsolutePointerDevice->IntEndpointDescriptor, &EndpointDescriptor, sizeof(EndpointDescriptor));\r |
215 | Found = TRUE;\r | |
216 | break;\r | |
09f72ae8 | 217 | }\r |
218 | }\r | |
219 | \r | |
67b8a9ce | 220 | if (!Found) {\r |
09f72ae8 | 221 | //\r |
67b8a9ce | 222 | // No interrupt endpoint found, then return unsupported.\r |
09f72ae8 | 223 | //\r |
224 | Status = EFI_UNSUPPORTED;\r | |
225 | goto ErrorExit;\r | |
226 | }\r | |
227 | \r | |
67b8a9ce | 228 | Status = InitializeUsbMouseDevice (UsbMouseAbsolutePointerDevice);\r |
09f72ae8 | 229 | if (EFI_ERROR (Status)) {\r |
67b8a9ce | 230 | //\r |
231 | // Fail to initialize USB mouse device.\r | |
232 | //\r | |
233 | REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r | |
09f72ae8 | 234 | EFI_ERROR_CODE | EFI_ERROR_MINOR,\r |
67b8a9ce | 235 | PcdGet32 (PcdStatusCodeValueMouseInterfaceError),\r |
236 | UsbMouseAbsolutePointerDevice->DevicePath\r | |
09f72ae8 | 237 | );\r |
238 | \r | |
239 | goto ErrorExit;\r | |
240 | }\r | |
241 | \r | |
67b8a9ce | 242 | //\r |
243 | // Initialize and install EFI Absolute Pointer Protocol.\r | |
244 | //\r | |
09f72ae8 | 245 | UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol.GetState = GetMouseAbsolutePointerState;\r |
67b8a9ce | 246 | UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol.Reset = UsbMouseAbsolutePointerReset;\r |
247 | UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol.Mode = &UsbMouseAbsolutePointerDevice->Mode;\r | |
09f72ae8 | 248 | \r |
249 | Status = gBS->CreateEvent (\r | |
67b8a9ce | 250 | EVT_NOTIFY_WAIT,\r |
251 | TPL_NOTIFY,\r | |
252 | UsbMouseAbsolutePointerWaitForInput,\r | |
253 | UsbMouseAbsolutePointerDevice,\r | |
254 | &((UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol).WaitForInput)\r | |
255 | );\r | |
09f72ae8 | 256 | if (EFI_ERROR (Status)) {\r |
257 | goto ErrorExit;\r | |
258 | }\r | |
259 | \r | |
260 | Status = gBS->InstallProtocolInterface (\r | |
67b8a9ce | 261 | &Controller,\r |
262 | &gEfiAbsolutePointerProtocolGuid,\r | |
263 | EFI_NATIVE_INTERFACE,\r | |
264 | &UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol\r | |
265 | );\r | |
09f72ae8 | 266 | \r |
267 | if (EFI_ERROR (Status)) {\r | |
09f72ae8 | 268 | goto ErrorExit;\r |
269 | }\r | |
270 | \r | |
271 | //\r | |
67b8a9ce | 272 | // The next step would be submitting Asynchronous Interrupt Transfer on this mouse device.\r |
273 | // After that we will be able to get key data from it. Thus this is deemed as\r | |
274 | // the enable action of the mouse, so report status code accordingly.\r | |
09f72ae8 | 275 | //\r |
67b8a9ce | 276 | REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r |
09f72ae8 | 277 | EFI_PROGRESS_CODE,\r |
67b8a9ce | 278 | PcdGet32 (PcdStatusCodeValueMouseEnable),\r |
279 | UsbMouseAbsolutePointerDevice->DevicePath\r | |
09f72ae8 | 280 | );\r |
281 | \r | |
282 | //\r | |
67b8a9ce | 283 | // Submit Asynchronous Interrupt Transfer to manage this device.\r |
09f72ae8 | 284 | //\r |
67b8a9ce | 285 | EndpointAddr = UsbMouseAbsolutePointerDevice->IntEndpointDescriptor.EndpointAddress;\r |
286 | PollingInterval = UsbMouseAbsolutePointerDevice->IntEndpointDescriptor.Interval;\r | |
287 | PacketSize = (UINT8) (UsbMouseAbsolutePointerDevice->IntEndpointDescriptor.MaxPacketSize);\r | |
09f72ae8 | 288 | \r |
289 | Status = UsbIo->UsbAsyncInterruptTransfer (\r | |
290 | UsbIo,\r | |
291 | EndpointAddr,\r | |
292 | TRUE,\r | |
293 | PollingInterval,\r | |
294 | PacketSize,\r | |
67b8a9ce | 295 | OnMouseInterruptComplete,\r |
09f72ae8 | 296 | UsbMouseAbsolutePointerDevice\r |
297 | );\r | |
298 | \r | |
67b8a9ce | 299 | if (EFI_ERROR (Status)) {\r |
300 | //\r | |
301 | // If submit error, uninstall that interface\r | |
302 | //\r | |
303 | gBS->UninstallProtocolInterface (\r | |
304 | Controller,\r | |
305 | &gEfiAbsolutePointerProtocolGuid,\r | |
306 | &UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol\r | |
307 | );\r | |
308 | goto ErrorExit;\r | |
309 | }\r | |
09f72ae8 | 310 | \r |
67b8a9ce | 311 | UsbMouseAbsolutePointerDevice->ControllerNameTable = NULL;\r |
312 | AddUnicodeString2 (\r | |
313 | "eng",\r | |
314 | gUsbMouseAbsolutePointerComponentName.SupportedLanguages,\r | |
315 | &UsbMouseAbsolutePointerDevice->ControllerNameTable,\r | |
316 | L"Generic Usb Mouse Absolute Pointer",\r | |
09f72ae8 | 317 | TRUE\r |
318 | );\r | |
67b8a9ce | 319 | AddUnicodeString2 (\r |
320 | "en",\r | |
321 | gUsbMouseAbsolutePointerComponentName2.SupportedLanguages,\r | |
322 | &UsbMouseAbsolutePointerDevice->ControllerNameTable,\r | |
323 | L"Generic Usb Mouse Absolute Pointer",\r | |
324 | FALSE\r | |
325 | );\r | |
09f72ae8 | 326 | \r |
67b8a9ce | 327 | return EFI_SUCCESS;\r |
09f72ae8 | 328 | \r |
67b8a9ce | 329 | //\r |
330 | // Error handler\r | |
331 | //\r | |
09f72ae8 | 332 | ErrorExit:\r |
333 | if (EFI_ERROR (Status)) {\r | |
334 | gBS->CloseProtocol (\r | |
335 | Controller,\r | |
336 | &gEfiUsbIoProtocolGuid,\r | |
337 | This->DriverBindingHandle,\r | |
338 | Controller\r | |
339 | );\r | |
340 | \r | |
341 | if (UsbMouseAbsolutePointerDevice != NULL) {\r | |
09f72ae8 | 342 | if ((UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol).WaitForInput != NULL) {\r |
343 | gBS->CloseEvent ((UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol).WaitForInput);\r | |
344 | }\r | |
345 | \r | |
67b8a9ce | 346 | FreePool (UsbMouseAbsolutePointerDevice);\r |
09f72ae8 | 347 | UsbMouseAbsolutePointerDevice = NULL;\r |
348 | }\r | |
349 | }\r | |
350 | \r | |
351 | return Status;\r | |
352 | }\r | |
353 | \r | |
354 | \r | |
355 | /**\r | |
67b8a9ce | 356 | Stop the USB mouse device handled by this driver.\r |
09f72ae8 | 357 | \r |
67b8a9ce | 358 | @param This The driver binding protocol.\r |
359 | @param Controller The controller to release.\r | |
360 | @param NumberOfChildren The number of handles in ChildHandleBuffer.\r | |
361 | @param ChildHandleBuffer The array of child handle.\r | |
09f72ae8 | 362 | \r |
67b8a9ce | 363 | @retval EFI_SUCCESS The device was stopped.\r |
364 | @retval EFI_UNSUPPORTED Absolute Pointer Protocol is not installed on Controller.\r | |
365 | @retval Others Fail to uninstall protocols attached on the device.\r | |
09f72ae8 | 366 | \r |
367 | **/\r | |
368 | EFI_STATUS\r | |
369 | EFIAPI\r | |
370 | USBMouseAbsolutePointerDriverBindingStop (\r | |
371 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
372 | IN EFI_HANDLE Controller,\r | |
373 | IN UINTN NumberOfChildren,\r | |
374 | IN EFI_HANDLE *ChildHandleBuffer\r | |
375 | )\r | |
376 | {\r | |
67b8a9ce | 377 | EFI_STATUS Status;\r |
378 | USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDevice;\r | |
379 | EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol;\r | |
380 | EFI_USB_IO_PROTOCOL *UsbIo;\r | |
09f72ae8 | 381 | \r |
09f72ae8 | 382 | Status = gBS->OpenProtocol (\r |
67b8a9ce | 383 | Controller,\r |
384 | &gEfiAbsolutePointerProtocolGuid,\r | |
385 | (VOID **) &AbsolutePointerProtocol,\r | |
386 | This->DriverBindingHandle,\r | |
387 | Controller,\r | |
388 | EFI_OPEN_PROTOCOL_GET_PROTOCOL\r | |
389 | );\r | |
09f72ae8 | 390 | \r |
391 | if (EFI_ERROR (Status)) {\r | |
67b8a9ce | 392 | return EFI_UNSUPPORTED;\r |
09f72ae8 | 393 | }\r |
09f72ae8 | 394 | \r |
67b8a9ce | 395 | UsbMouseAbsolutePointerDevice = USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (AbsolutePointerProtocol);\r |
09f72ae8 | 396 | \r |
397 | UsbIo = UsbMouseAbsolutePointerDevice->UsbIo;\r | |
398 | \r | |
399 | //\r | |
67b8a9ce | 400 | // The key data input from this device will be disabled.\r |
09f72ae8 | 401 | //\r |
67b8a9ce | 402 | REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r |
09f72ae8 | 403 | EFI_PROGRESS_CODE,\r |
67b8a9ce | 404 | PcdGet32 (PcdStatusCodeValueMouseDisable),\r |
405 | UsbMouseAbsolutePointerDevice->DevicePath\r | |
09f72ae8 | 406 | );\r |
407 | \r | |
408 | //\r | |
67b8a9ce | 409 | // Delete the Asynchronous Interrupt Transfer from this device\r |
09f72ae8 | 410 | //\r |
411 | UsbIo->UsbAsyncInterruptTransfer (\r | |
67b8a9ce | 412 | UsbIo,\r |
413 | UsbMouseAbsolutePointerDevice->IntEndpointDescriptor.EndpointAddress,\r | |
414 | FALSE,\r | |
415 | UsbMouseAbsolutePointerDevice->IntEndpointDescriptor.Interval,\r | |
416 | 0,\r | |
417 | NULL,\r | |
418 | NULL\r | |
419 | );\r | |
09f72ae8 | 420 | \r |
421 | Status = gBS->UninstallProtocolInterface (\r | |
422 | Controller,\r | |
423 | &gEfiAbsolutePointerProtocolGuid,\r | |
424 | &UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol\r | |
425 | );\r | |
426 | if (EFI_ERROR (Status)) {\r | |
427 | return Status;\r | |
428 | }\r | |
429 | \r | |
430 | gBS->CloseProtocol (\r | |
67b8a9ce | 431 | Controller,\r |
432 | &gEfiUsbIoProtocolGuid,\r | |
433 | This->DriverBindingHandle,\r | |
434 | Controller\r | |
435 | );\r | |
09f72ae8 | 436 | \r |
67b8a9ce | 437 | //\r |
438 | // Free all resources.\r | |
439 | //\r | |
440 | gBS->CloseEvent (UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol.WaitForInput);\r | |
441 | \r | |
442 | if (UsbMouseAbsolutePointerDevice->DelayedRecoveryEvent != NULL) {\r | |
443 | gBS->CloseEvent (UsbMouseAbsolutePointerDevice->DelayedRecoveryEvent);\r | |
444 | UsbMouseAbsolutePointerDevice->DelayedRecoveryEvent = NULL;\r | |
445 | }\r | |
09f72ae8 | 446 | \r |
67b8a9ce | 447 | if (UsbMouseAbsolutePointerDevice->ControllerNameTable != NULL) {\r |
09f72ae8 | 448 | FreeUnicodeStringTable (UsbMouseAbsolutePointerDevice->ControllerNameTable);\r |
449 | }\r | |
450 | \r | |
67b8a9ce | 451 | FreePool (UsbMouseAbsolutePointerDevice);\r |
09f72ae8 | 452 | \r |
453 | return EFI_SUCCESS;\r | |
454 | \r | |
455 | }\r | |
456 | \r | |
457 | \r | |
458 | /**\r | |
67b8a9ce | 459 | Uses USB I/O to check whether the device is a USB mouse device.\r |
09f72ae8 | 460 | \r |
67b8a9ce | 461 | @param UsbIo Pointer to a USB I/O protocol instance.\r |
09f72ae8 | 462 | \r |
67b8a9ce | 463 | @retval TRUE Device is a USB mouse device.\r |
464 | @retval FALSE Device is a not USB mouse device.\r | |
09f72ae8 | 465 | \r |
466 | **/\r | |
467 | BOOLEAN\r | |
67b8a9ce | 468 | IsUsbMouse (\r |
09f72ae8 | 469 | IN EFI_USB_IO_PROTOCOL *UsbIo\r |
470 | )\r | |
471 | {\r | |
472 | EFI_STATUS Status;\r | |
473 | EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;\r | |
474 | \r | |
475 | //\r | |
67b8a9ce | 476 | // Get the default interface descriptor\r |
09f72ae8 | 477 | //\r |
478 | Status = UsbIo->UsbGetInterfaceDescriptor (\r | |
479 | UsbIo,\r | |
480 | &InterfaceDescriptor\r | |
481 | );\r | |
482 | \r | |
483 | if (EFI_ERROR (Status)) {\r | |
484 | return FALSE;\r | |
485 | }\r | |
486 | \r | |
487 | if ((InterfaceDescriptor.InterfaceClass == CLASS_HID) &&\r | |
488 | (InterfaceDescriptor.InterfaceSubClass == SUBCLASS_BOOT) &&\r | |
489 | (InterfaceDescriptor.InterfaceProtocol == PROTOCOL_MOUSE)\r | |
490 | ) {\r | |
09f72ae8 | 491 | return TRUE;\r |
492 | }\r | |
493 | \r | |
494 | return FALSE;\r | |
495 | }\r | |
496 | \r | |
497 | \r | |
498 | /**\r | |
67b8a9ce | 499 | Initialize the USB mouse device.\r |
09f72ae8 | 500 | \r |
67b8a9ce | 501 | This function retrieves and parses HID report descriptor, and\r |
502 | initializes state of USB_MOUSE_ABSOLUTE_POINTER_DEV. Then it sets indefinite idle\r | |
503 | rate for the device. Finally it creates event for delayed recovery,\r | |
504 | which deals with device error.\r | |
09f72ae8 | 505 | \r |
67b8a9ce | 506 | @param UsbMouseAbsolutePointerDev Device instance to be initialized.\r |
507 | \r | |
508 | @retval EFI_SUCCESS USB mouse device successfully initialized.\r | |
509 | @retval EFI_UNSUPPORTED HID descriptor type is not report descriptor.\r | |
510 | @retval Other USB mouse device was not initialized successfully.\r | |
09f72ae8 | 511 | \r |
512 | **/\r | |
09f72ae8 | 513 | EFI_STATUS\r |
67b8a9ce | 514 | InitializeUsbMouseDevice (\r |
09f72ae8 | 515 | IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDev\r |
516 | )\r | |
517 | {\r | |
518 | EFI_USB_IO_PROTOCOL *UsbIo;\r | |
519 | UINT8 Protocol;\r | |
520 | EFI_STATUS Status;\r | |
521 | EFI_USB_HID_DESCRIPTOR MouseHidDesc;\r | |
522 | UINT8 *ReportDesc;\r | |
67b8a9ce | 523 | UINT8 ReportId;\r |
524 | UINT8 Duration;\r | |
09f72ae8 | 525 | \r |
526 | UsbIo = UsbMouseAbsolutePointerDev->UsbIo;\r | |
527 | \r | |
528 | //\r | |
529 | // Get HID descriptor\r | |
530 | //\r | |
531 | Status = UsbGetHidDescriptor (\r | |
67b8a9ce | 532 | UsbIo,\r |
533 | UsbMouseAbsolutePointerDev->InterfaceDescriptor.InterfaceNumber,\r | |
534 | &MouseHidDesc\r | |
535 | );\r | |
09f72ae8 | 536 | if (EFI_ERROR (Status)) {\r |
537 | return Status;\r | |
538 | }\r | |
539 | \r | |
540 | //\r | |
67b8a9ce | 541 | // Get report descriptor\r |
09f72ae8 | 542 | //\r |
67b8a9ce | 543 | if (MouseHidDesc.HidClassDesc[0].DescriptorType != USB_DESC_TYPE_REPORT) {\r |
09f72ae8 | 544 | return EFI_UNSUPPORTED;\r |
545 | }\r | |
546 | \r | |
547 | ReportDesc = AllocateZeroPool (MouseHidDesc.HidClassDesc[0].DescriptorLength);\r | |
67b8a9ce | 548 | ASSERT (ReportDesc != NULL);\r |
09f72ae8 | 549 | \r |
550 | Status = UsbGetReportDescriptor (\r | |
67b8a9ce | 551 | UsbIo,\r |
552 | UsbMouseAbsolutePointerDev->InterfaceDescriptor.InterfaceNumber,\r | |
553 | MouseHidDesc.HidClassDesc[0].DescriptorLength,\r | |
554 | ReportDesc\r | |
555 | );\r | |
09f72ae8 | 556 | \r |
557 | if (EFI_ERROR (Status)) {\r | |
67b8a9ce | 558 | FreePool (ReportDesc);\r |
09f72ae8 | 559 | return Status;\r |
560 | }\r | |
561 | \r | |
562 | //\r | |
563 | // Parse report descriptor\r | |
564 | //\r | |
565 | Status = ParseMouseReportDescriptor (\r | |
67b8a9ce | 566 | UsbMouseAbsolutePointerDev,\r |
567 | ReportDesc,\r | |
568 | MouseHidDesc.HidClassDesc[0].DescriptorLength\r | |
569 | );\r | |
09f72ae8 | 570 | \r |
571 | if (EFI_ERROR (Status)) {\r | |
67b8a9ce | 572 | FreePool (ReportDesc);\r |
09f72ae8 | 573 | return Status;\r |
574 | }\r | |
575 | \r | |
67b8a9ce | 576 | UsbMouseAbsolutePointerDev->Mode.AbsoluteMaxX = 1024;\r |
577 | UsbMouseAbsolutePointerDev->Mode.AbsoluteMaxY = 1024;\r | |
578 | UsbMouseAbsolutePointerDev->Mode.AbsoluteMaxZ = 0;\r | |
579 | UsbMouseAbsolutePointerDev->Mode.AbsoluteMinX = 0;\r | |
580 | UsbMouseAbsolutePointerDev->Mode.AbsoluteMinY = 0;\r | |
581 | UsbMouseAbsolutePointerDev->Mode.AbsoluteMinZ = 0;\r | |
582 | UsbMouseAbsolutePointerDev->Mode.Attributes = 0x3;\r | |
09f72ae8 | 583 | \r |
584 | //\r | |
67b8a9ce | 585 | // Set boot protocol for the USB mouse.\r |
586 | // This driver only supports boot protocol.\r | |
09f72ae8 | 587 | //\r |
588 | UsbGetProtocolRequest (\r | |
589 | UsbIo,\r | |
67b8a9ce | 590 | UsbMouseAbsolutePointerDev->InterfaceDescriptor.InterfaceNumber,\r |
09f72ae8 | 591 | &Protocol\r |
592 | );\r | |
09f72ae8 | 593 | if (Protocol != BOOT_PROTOCOL) {\r |
594 | Status = UsbSetProtocolRequest (\r | |
67b8a9ce | 595 | UsbIo,\r |
596 | 0,\r | |
597 | BOOT_PROTOCOL\r | |
598 | );\r | |
09f72ae8 | 599 | \r |
600 | if (EFI_ERROR (Status)) {\r | |
67b8a9ce | 601 | FreePool (ReportDesc);\r |
602 | return Status;\r | |
09f72ae8 | 603 | }\r |
604 | }\r | |
605 | \r | |
606 | //\r | |
67b8a9ce | 607 | // ReportId is zero, which means the idle rate applies to all input reports.\r |
09f72ae8 | 608 | //\r |
67b8a9ce | 609 | ReportId = 0;\r |
610 | //\r | |
611 | // Duration is zero, which means the duration is infinite.\r | |
612 | // so the endpoint will inhibit reporting forever,\r | |
613 | // and only reporting when a change is detected in the report data.\r | |
614 | //\r | |
615 | Duration = 0;\r | |
09f72ae8 | 616 | UsbSetIdleRequest (\r |
617 | UsbIo,\r | |
67b8a9ce | 618 | UsbMouseAbsolutePointerDev->InterfaceDescriptor.InterfaceNumber,\r |
619 | ReportId,\r | |
620 | Duration\r | |
09f72ae8 | 621 | );\r |
622 | \r | |
67b8a9ce | 623 | FreePool (ReportDesc);\r |
09f72ae8 | 624 | \r |
67b8a9ce | 625 | //\r |
626 | // Create event for delayed recovery, which deals with device error.\r | |
627 | //\r | |
628 | if (UsbMouseAbsolutePointerDev->DelayedRecoveryEvent != NULL) {\r | |
09f72ae8 | 629 | gBS->CloseEvent (UsbMouseAbsolutePointerDev->DelayedRecoveryEvent);\r |
630 | UsbMouseAbsolutePointerDev->DelayedRecoveryEvent = 0;\r | |
631 | }\r | |
632 | \r | |
67b8a9ce | 633 | gBS->CreateEvent (\r |
634 | EVT_TIMER | EVT_NOTIFY_SIGNAL,\r | |
635 | TPL_NOTIFY,\r | |
636 | USBMouseRecoveryHandler,\r | |
637 | UsbMouseAbsolutePointerDev,\r | |
638 | &UsbMouseAbsolutePointerDev->DelayedRecoveryEvent\r | |
639 | );\r | |
09f72ae8 | 640 | \r |
641 | return EFI_SUCCESS;\r | |
642 | }\r | |
643 | \r | |
644 | \r | |
645 | /**\r | |
67b8a9ce | 646 | Handler function for USB mouse's asynchronous interrupt transfer.\r |
647 | \r | |
648 | This function is the handler function for USB mouse's asynchronous interrupt transfer\r | |
649 | to manage the mouse. It parses data returned from asynchronous interrupt transfer, and\r | |
650 | get button and movement state.\r | |
09f72ae8 | 651 | \r |
67b8a9ce | 652 | @param Data A pointer to a buffer that is filled with key data which is\r |
653 | retrieved via asynchronous interrupt transfer.\r | |
654 | @param DataLength Indicates the size of the data buffer.\r | |
655 | @param Context Pointing to USB_KB_DEV instance.\r | |
656 | @param Result Indicates the result of the asynchronous interrupt transfer.\r | |
09f72ae8 | 657 | \r |
67b8a9ce | 658 | @retval EFI_SUCCESS Asynchronous interrupt transfer is handled successfully.\r |
659 | @retval EFI_DEVICE_ERROR Hardware error occurs.\r | |
09f72ae8 | 660 | \r |
661 | **/\r | |
09f72ae8 | 662 | EFI_STATUS\r |
663 | EFIAPI\r | |
67b8a9ce | 664 | OnMouseInterruptComplete (\r |
09f72ae8 | 665 | IN VOID *Data,\r |
666 | IN UINTN DataLength,\r | |
667 | IN VOID *Context,\r | |
668 | IN UINT32 Result\r | |
669 | )\r | |
670 | {\r | |
67b8a9ce | 671 | USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDevice;\r |
672 | EFI_USB_IO_PROTOCOL *UsbIo;\r | |
673 | UINT8 EndpointAddr;\r | |
674 | UINT32 UsbResult;\r | |
09f72ae8 | 675 | \r |
676 | UsbMouseAbsolutePointerDevice = (USB_MOUSE_ABSOLUTE_POINTER_DEV *) Context;\r | |
67b8a9ce | 677 | UsbIo = UsbMouseAbsolutePointerDevice->UsbIo;\r |
09f72ae8 | 678 | \r |
679 | if (Result != EFI_USB_NOERROR) {\r | |
680 | //\r | |
681 | // Some errors happen during the process\r | |
682 | //\r | |
67b8a9ce | 683 | REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r |
09f72ae8 | 684 | EFI_ERROR_CODE | EFI_ERROR_MINOR,\r |
67b8a9ce | 685 | PcdGet32 (PcdStatusCodeValueMouseInputError),\r |
686 | UsbMouseAbsolutePointerDevice->DevicePath\r | |
09f72ae8 | 687 | );\r |
688 | \r | |
689 | if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) {\r | |
67b8a9ce | 690 | EndpointAddr = UsbMouseAbsolutePointerDevice->IntEndpointDescriptor.EndpointAddress;\r |
09f72ae8 | 691 | \r |
692 | UsbClearEndpointHalt (\r | |
693 | UsbIo,\r | |
694 | EndpointAddr,\r | |
695 | &UsbResult\r | |
696 | );\r | |
697 | }\r | |
698 | \r | |
67b8a9ce | 699 | //\r |
700 | // Delete & Submit this interrupt again\r | |
701 | // Handler of DelayedRecoveryEvent triggered by timer will re-submit the interrupt. \r | |
702 | //\r | |
09f72ae8 | 703 | UsbIo->UsbAsyncInterruptTransfer (\r |
67b8a9ce | 704 | UsbIo,\r |
705 | UsbMouseAbsolutePointerDevice->IntEndpointDescriptor.EndpointAddress,\r | |
706 | FALSE,\r | |
707 | 0,\r | |
708 | 0,\r | |
709 | NULL,\r | |
710 | NULL\r | |
711 | );\r | |
712 | //\r | |
713 | // EFI_USB_INTERRUPT_DELAY is defined in USB standard for error handling.\r | |
714 | //\r | |
09f72ae8 | 715 | gBS->SetTimer (\r |
67b8a9ce | 716 | UsbMouseAbsolutePointerDevice->DelayedRecoveryEvent,\r |
717 | TimerRelative,\r | |
718 | EFI_USB_INTERRUPT_DELAY\r | |
719 | );\r | |
09f72ae8 | 720 | return EFI_DEVICE_ERROR;\r |
721 | }\r | |
722 | \r | |
67b8a9ce | 723 | //\r |
724 | // If no error and no data, just return EFI_SUCCESS.\r | |
725 | //\r | |
09f72ae8 | 726 | if (DataLength == 0 || Data == NULL) {\r |
727 | return EFI_SUCCESS;\r | |
728 | }\r | |
729 | \r | |
67b8a9ce | 730 | UsbMouseAbsolutePointerDevice->StateChanged = TRUE;\r |
731 | \r | |
09f72ae8 | 732 | //\r |
67b8a9ce | 733 | // Check mouse Data\r |
734 | // USB HID Specification specifies following data format:\r | |
735 | // Byte Bits Description\r | |
736 | // 0 0 Button 1\r | |
737 | // 1 Button 2\r | |
738 | // 2 Button 3\r | |
739 | // 4 to 7 Device-specific\r | |
740 | // 1 0 to 7 X displacement\r | |
741 | // 2 0 to 7 Y displacement\r | |
742 | // 3 to n 0 to 7 Device specific (optional)\r | |
09f72ae8 | 743 | //\r |
67b8a9ce | 744 | UsbMouseAbsolutePointerDevice->State.CurrentX += *((INT8 *) Data + 1);\r |
745 | UsbMouseAbsolutePointerDevice->State.CurrentY += *((INT8 *) Data + 2);\r | |
746 | \r | |
09f72ae8 | 747 | if (DataLength > 3) {\r |
67b8a9ce | 748 | UsbMouseAbsolutePointerDevice->State.CurrentZ += *((INT8 *) Data + 3);\r |
09f72ae8 | 749 | }\r |
67b8a9ce | 750 | UsbMouseAbsolutePointerDevice->State.ActiveButtons = *(UINT8 *) Data & (BIT0 | BIT1);\r |
09f72ae8 | 751 | \r |
752 | return EFI_SUCCESS;\r | |
753 | }\r | |
754 | \r | |
755 | /**\r | |
67b8a9ce | 756 | Retrieves the current state of a pointer device.\r |
09f72ae8 | 757 | \r |
67b8a9ce | 758 | @param This A pointer to the EFI_ABSOLUTE_POINTER_PROTOCOL instance. \r |
759 | @param MouseState A pointer to the state information on the pointer device.\r | |
09f72ae8 | 760 | \r |
67b8a9ce | 761 | @retval EFI_SUCCESS The state of the pointer device was returned in State.\r |
762 | @retval EFI_NOT_READY The state of the pointer device has not changed since the last call to\r | |
763 | GetState(). \r | |
764 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to retrieve the pointer device's\r | |
765 | current state. \r | |
766 | @retval EFI_INVALID_PARAMETER State is NULL. \r | |
09f72ae8 | 767 | \r |
768 | **/\r | |
09f72ae8 | 769 | EFI_STATUS\r |
770 | EFIAPI\r | |
771 | GetMouseAbsolutePointerState (\r | |
772 | IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r | |
67b8a9ce | 773 | OUT EFI_ABSOLUTE_POINTER_STATE *State\r |
09f72ae8 | 774 | )\r |
775 | {\r | |
776 | USB_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev;\r | |
777 | \r | |
67b8a9ce | 778 | if (State == NULL) {\r |
779 | return EFI_INVALID_PARAMETER;\r | |
09f72ae8 | 780 | }\r |
781 | \r | |
782 | MouseAbsolutePointerDev = USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (This);\r | |
783 | \r | |
67b8a9ce | 784 | if (!MouseAbsolutePointerDev->StateChanged) {\r |
09f72ae8 | 785 | return EFI_NOT_READY;\r |
786 | }\r | |
787 | \r | |
67b8a9ce | 788 | //\r |
789 | // Retrieve mouse state from USB_MOUSE_ABSOLUTE_POINTER_DEV,\r | |
790 | // which was filled by OnMouseInterruptComplete()\r | |
791 | //\r | |
09f72ae8 | 792 | CopyMem (\r |
67b8a9ce | 793 | State,\r |
794 | &MouseAbsolutePointerDev->State,\r | |
09f72ae8 | 795 | sizeof (EFI_ABSOLUTE_POINTER_STATE)\r |
796 | );\r | |
797 | \r | |
798 | //\r | |
799 | // Clear previous move state\r | |
800 | //\r | |
67b8a9ce | 801 | MouseAbsolutePointerDev->State.CurrentX = 0;\r |
802 | MouseAbsolutePointerDev->State.CurrentY = 0;\r | |
803 | MouseAbsolutePointerDev->State.CurrentZ = 0;\r | |
804 | MouseAbsolutePointerDev->State.ActiveButtons = 0;\r | |
09f72ae8 | 805 | \r |
67b8a9ce | 806 | MouseAbsolutePointerDev->StateChanged = FALSE;\r |
09f72ae8 | 807 | \r |
808 | return EFI_SUCCESS;\r | |
809 | }\r | |
810 | \r | |
811 | \r | |
812 | /**\r | |
67b8a9ce | 813 | Resets the pointer device hardware.\r |
09f72ae8 | 814 | \r |
67b8a9ce | 815 | @param This A pointer to the EFI_ABSOLUTE_POINTER_PROTOCOL instance.\r |
816 | @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r | |
817 | verification operation of the device during reset.\r | |
09f72ae8 | 818 | \r |
67b8a9ce | 819 | @retval EFI_SUCCESS The device was reset.\r |
820 | @retval EFI_DEVICE_ERROR The device is not functioning correctly and could not be reset.\r | |
09f72ae8 | 821 | \r |
822 | **/\r | |
09f72ae8 | 823 | EFI_STATUS\r |
824 | EFIAPI\r | |
825 | UsbMouseAbsolutePointerReset (\r | |
67b8a9ce | 826 | IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,\r |
09f72ae8 | 827 | IN BOOLEAN ExtendedVerification\r |
828 | )\r | |
829 | {\r | |
830 | USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDevice;\r | |
831 | \r | |
832 | UsbMouseAbsolutePointerDevice = USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (This);\r | |
833 | \r | |
67b8a9ce | 834 | REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r |
09f72ae8 | 835 | EFI_PROGRESS_CODE,\r |
67b8a9ce | 836 | PcdGet32 (PcdStatusCodeValueMouseReset),\r |
837 | UsbMouseAbsolutePointerDevice->DevicePath\r | |
09f72ae8 | 838 | );\r |
839 | \r | |
67b8a9ce | 840 | //\r |
841 | // Clear mouse state.\r | |
842 | //\r | |
09f72ae8 | 843 | ZeroMem (\r |
67b8a9ce | 844 | &UsbMouseAbsolutePointerDevice->State,\r |
09f72ae8 | 845 | sizeof (EFI_ABSOLUTE_POINTER_STATE)\r |
846 | );\r | |
67b8a9ce | 847 | UsbMouseAbsolutePointerDevice->StateChanged = FALSE;\r |
09f72ae8 | 848 | \r |
849 | return EFI_SUCCESS;\r | |
850 | }\r | |
851 | \r | |
852 | /**\r | |
67b8a9ce | 853 | Event notification function for EFI_ABSOLUTE_POINTER_PROTOCOL.WaitForInput event.\r |
09f72ae8 | 854 | \r |
67b8a9ce | 855 | @param Event Event to be signaled when there's input from mouse.\r |
856 | @param Context Points to USB_MOUSE_ABSOLUTE_POINTER_DEV instance.\r | |
09f72ae8 | 857 | \r |
858 | **/\r | |
09f72ae8 | 859 | VOID\r |
860 | EFIAPI\r | |
861 | UsbMouseAbsolutePointerWaitForInput (\r | |
862 | IN EFI_EVENT Event,\r | |
863 | IN VOID *Context\r | |
864 | )\r | |
865 | {\r | |
866 | USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDev;\r | |
867 | \r | |
868 | UsbMouseAbsolutePointerDev = (USB_MOUSE_ABSOLUTE_POINTER_DEV *) Context;\r | |
869 | \r | |
870 | //\r | |
67b8a9ce | 871 | // If there's input from mouse, signal the event.\r |
09f72ae8 | 872 | //\r |
67b8a9ce | 873 | if (UsbMouseAbsolutePointerDev->StateChanged) {\r |
09f72ae8 | 874 | gBS->SignalEvent (Event);\r |
875 | }\r | |
876 | }\r | |
877 | \r | |
878 | /**\r | |
67b8a9ce | 879 | Handler for Delayed Recovery event.\r |
09f72ae8 | 880 | \r |
67b8a9ce | 881 | This function is the handler for Delayed Recovery event triggered\r |
882 | by timer.\r | |
883 | After a device error occurs, the event would be triggered\r | |
884 | with interval of EFI_USB_INTERRUPT_DELAY. EFI_USB_INTERRUPT_DELAY\r | |
885 | is defined in USB standard for error handling.\r | |
09f72ae8 | 886 | \r |
67b8a9ce | 887 | @param Event The Delayed Recovery event.\r |
888 | @param Context Points to the USB_MOUSE_ABSOLUTE_POINTER_DEV instance.\r | |
09f72ae8 | 889 | \r |
890 | **/\r | |
891 | VOID\r | |
892 | EFIAPI\r | |
67b8a9ce | 893 | USBMouseRecoveryHandler (\r |
09f72ae8 | 894 | IN EFI_EVENT Event,\r |
895 | IN VOID *Context\r | |
896 | )\r | |
897 | {\r | |
898 | USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDev;\r | |
67b8a9ce | 899 | EFI_USB_IO_PROTOCOL *UsbIo;\r |
09f72ae8 | 900 | \r |
901 | UsbMouseAbsolutePointerDev = (USB_MOUSE_ABSOLUTE_POINTER_DEV *) Context;\r | |
902 | \r | |
903 | UsbIo = UsbMouseAbsolutePointerDev->UsbIo;\r | |
904 | \r | |
67b8a9ce | 905 | //\r |
906 | // Re-submit Asynchronous Interrupt Transfer for recovery.\r | |
907 | //\r | |
09f72ae8 | 908 | UsbIo->UsbAsyncInterruptTransfer (\r |
67b8a9ce | 909 | UsbIo,\r |
910 | UsbMouseAbsolutePointerDev->IntEndpointDescriptor.EndpointAddress,\r | |
911 | TRUE,\r | |
912 | UsbMouseAbsolutePointerDev->IntEndpointDescriptor.Interval,\r | |
913 | UsbMouseAbsolutePointerDev->IntEndpointDescriptor.MaxPacketSize,\r | |
914 | OnMouseInterruptComplete,\r | |
915 | UsbMouseAbsolutePointerDev\r | |
916 | );\r | |
09f72ae8 | 917 | }\r |