3 Copyright (c) 2004 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 UsbMouseAbsolutePointer.c
21 #include "UsbMouseAbsolutePointer.h"
23 #include <Library/DebugLib.h>
24 #include <IndustryStandard/Usb.h>
29 EFI_GUID gEfiUsbMouseAbsolutePointerDriverGuid
= {
30 0xa579f729, 0xa71d, 0x4b45, { 0xbe, 0xd7, 0xd, 0xb0, 0xa8, 0x7c, 0x3e, 0x8d }
33 EFI_DRIVER_BINDING_PROTOCOL gUsbMouseAbsolutePointerDriverBinding
= {
34 USBMouseAbsolutePointerDriverBindingSupported
,
35 USBMouseAbsolutePointerDriverBindingStart
,
36 USBMouseAbsolutePointerDriverBindingStop
,
46 IsUsbMouseAbsolutePointer (
47 IN EFI_USB_IO_PROTOCOL
*UsbIo
51 InitializeUsbMouseAbsolutePointerDevice (
52 IN USB_MOUSE_ABSOLUTE_POINTER_DEV
*UsbMouseAbsolutePointerDev
57 UsbMouseAbsolutePointerWaitForInput (
63 // Mouse interrupt handler
67 OnMouseAbsolutePointerInterruptComplete (
75 // Mouse simulate TouchPad, Using AbsolutePointer Protocol
79 GetMouseAbsolutePointerState (
80 IN EFI_ABSOLUTE_POINTER_PROTOCOL
*This
,
81 OUT EFI_ABSOLUTE_POINTER_STATE
*MouseAbsolutePointerState
86 UsbMouseAbsolutePointerReset (
87 IN EFI_ABSOLUTE_POINTER_PROTOCOL
*This
,
88 IN BOOLEAN ExtendedVerification
96 USBMouseAbsolutePointerDriverBindingEntryPoint (
97 IN EFI_HANDLE ImageHandle
,
98 IN EFI_SYSTEM_TABLE
*SystemTable
103 Entry point for EFI drivers.
106 ImageHandle - EFI_HANDLE
107 SystemTable - EFI_SYSTEM_TABLE
114 return EfiLibInstallDriverBindingComponentName2 (
117 &gUsbMouseAbsolutePointerDriverBinding
,
119 &gUsbMouseAbsolutePointerComponentName
,
120 &gUsbMouseAbsolutePointerComponentName2
126 Test to see if this driver supports ControllerHandle. Any ControllerHandle
127 that has UsbHcProtocol installed will be supported.
129 @param This Protocol instance pointer.
130 @param Controller Handle of device to test
131 @param RemainingDevicePath Not used
133 @retval EFI_SUCCESS This driver supports this device.
134 @retval EFI_UNSUPPORTED This driver does not support this device.
139 USBMouseAbsolutePointerDriverBindingSupported (
140 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
141 IN EFI_HANDLE Controller
,
142 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
145 EFI_STATUS OpenStatus
;
146 EFI_USB_IO_PROTOCOL
*UsbIo
;
149 OpenStatus
= gBS
->OpenProtocol (
151 &gEfiUsbIoProtocolGuid
,
153 This
->DriverBindingHandle
,
155 EFI_OPEN_PROTOCOL_BY_DRIVER
157 if (EFI_ERROR (OpenStatus
) && (OpenStatus
!= EFI_ALREADY_STARTED
)) {
158 return EFI_UNSUPPORTED
;
161 if (OpenStatus
== EFI_ALREADY_STARTED
) {
162 return EFI_ALREADY_STARTED
;
166 // Use the USB I/O protocol interface to see the Controller is
167 // the Mouse controller that can be managed by this driver.
169 Status
= EFI_SUCCESS
;
170 if (!IsUsbMouseAbsolutePointer (UsbIo
)) {
171 Status
= EFI_UNSUPPORTED
;
176 &gEfiUsbIoProtocolGuid
,
177 This
->DriverBindingHandle
,
186 Starting the Usb Bus Driver
188 @param This Protocol instance pointer.
189 @param Controller Handle of device to test
190 @param RemainingDevicePath Not used
192 @retval EFI_SUCCESS This driver supports this device.
193 @retval EFI_UNSUPPORTED This driver does not support this device.
194 @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error
195 EFI_OUT_OF_RESOURCES- Can't allocate memory
197 @retval EFI_ALREADY_STARTED Thios driver has been started
202 USBMouseAbsolutePointerDriverBindingStart (
203 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
204 IN EFI_HANDLE Controller
,
205 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
209 EFI_USB_IO_PROTOCOL
*UsbIo
;
210 EFI_USB_ENDPOINT_DESCRIPTOR
*EndpointDesc
;
211 USB_MOUSE_ABSOLUTE_POINTER_DEV
*UsbMouseAbsolutePointerDevice
;
212 UINT8 EndpointNumber
;
215 UINT8 PollingInterval
;
218 UsbMouseAbsolutePointerDevice
= NULL
;
219 Status
= EFI_SUCCESS
;
221 Status
= gBS
->OpenProtocol (
223 &gEfiUsbIoProtocolGuid
,
225 This
->DriverBindingHandle
,
227 EFI_OPEN_PROTOCOL_BY_DRIVER
229 if (EFI_ERROR (Status
)) {
233 UsbMouseAbsolutePointerDevice
= AllocateZeroPool (sizeof (USB_MOUSE_ABSOLUTE_POINTER_DEV
));
234 if (UsbMouseAbsolutePointerDevice
== NULL
) {
235 Status
= EFI_OUT_OF_RESOURCES
;
239 UsbMouseAbsolutePointerDevice
->UsbIo
= UsbIo
;
241 UsbMouseAbsolutePointerDevice
->Signature
= USB_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE
;
243 UsbMouseAbsolutePointerDevice
->InterfaceDescriptor
= AllocatePool (sizeof (EFI_USB_INTERFACE_DESCRIPTOR
));
245 if (UsbMouseAbsolutePointerDevice
->InterfaceDescriptor
== NULL
) {
246 Status
= EFI_OUT_OF_RESOURCES
;
250 EndpointDesc
= AllocatePool (sizeof (EFI_USB_ENDPOINT_DESCRIPTOR
));
251 if (EndpointDesc
== NULL
) {
252 Status
= EFI_OUT_OF_RESOURCES
;
256 // Get the Device Path Protocol on Controller's handle
258 Status
= gBS
->OpenProtocol (
260 &gEfiDevicePathProtocolGuid
,
261 (VOID
**) &UsbMouseAbsolutePointerDevice
->DevicePath
,
262 This
->DriverBindingHandle
,
264 EFI_OPEN_PROTOCOL_GET_PROTOCOL
267 if (EFI_ERROR (Status
)) {
271 // Get interface & endpoint descriptor
273 UsbIo
->UsbGetInterfaceDescriptor (
275 UsbMouseAbsolutePointerDevice
->InterfaceDescriptor
278 EndpointNumber
= UsbMouseAbsolutePointerDevice
->InterfaceDescriptor
->NumEndpoints
;
280 for (Index
= 0; Index
< EndpointNumber
; Index
++) {
281 UsbIo
->UsbGetEndpointDescriptor (
287 if ((EndpointDesc
->Attributes
& 0x03) == 0x03) {
290 // We only care interrupt endpoint here
292 UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
= EndpointDesc
;
296 if (UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
== NULL
) {
298 // No interrupt endpoint, then error
300 Status
= EFI_UNSUPPORTED
;
304 Status
= InitializeUsbMouseAbsolutePointerDevice (UsbMouseAbsolutePointerDevice
);
305 if (EFI_ERROR (Status
)) {
306 MouseAbsolutePointerReportStatusCode (
307 UsbMouseAbsolutePointerDevice
->DevicePath
,
308 EFI_ERROR_CODE
| EFI_ERROR_MINOR
,
309 PcdGet32 (PcdStatusCodeValueMouseInterfaceError
)
315 UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
.GetState
= GetMouseAbsolutePointerState
;
316 UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
.Reset
= UsbMouseAbsolutePointerReset
;
317 UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
.Mode
= &UsbMouseAbsolutePointerDevice
->AbsolutePointerMode
;
319 Status
= gBS
->CreateEvent (
322 UsbMouseAbsolutePointerWaitForInput
,
323 UsbMouseAbsolutePointerDevice
,
324 &((UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
).WaitForInput
)
326 if (EFI_ERROR (Status
)) {
330 Status
= gBS
->InstallProtocolInterface (
332 &gEfiAbsolutePointerProtocolGuid
,
333 EFI_NATIVE_INTERFACE
,
334 &UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
337 if (EFI_ERROR (Status
)) {
338 Status
= EFI_DEVICE_ERROR
;
343 // After Enabling Async Interrupt Transfer on this mouse Device
344 // we will be able to get key data from it. Thus this is deemed as
345 // the enable action of the mouse
348 MouseAbsolutePointerReportStatusCode (
349 UsbMouseAbsolutePointerDevice
->DevicePath
,
351 PcdGet32 (PcdStatusCodeValueMouseEnable
)
355 // submit async interrupt transfer
357 EndpointAddr
= UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
->EndpointAddress
;
358 PollingInterval
= UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
->Interval
;
359 PacketSize
= (UINT8
) (UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
->MaxPacketSize
);
361 Status
= UsbIo
->UsbAsyncInterruptTransfer (
367 OnMouseAbsolutePointerInterruptComplete
,
368 UsbMouseAbsolutePointerDevice
371 if (!EFI_ERROR (Status
)) {
373 UsbMouseAbsolutePointerDevice
->ControllerNameTable
= NULL
;
376 gUsbMouseAbsolutePointerComponentName
.SupportedLanguages
,
377 &UsbMouseAbsolutePointerDevice
->ControllerNameTable
,
378 L
"Generic Usb Mouse Simulate TouchPad",
383 gUsbMouseAbsolutePointerComponentName2
.SupportedLanguages
,
384 &UsbMouseAbsolutePointerDevice
->ControllerNameTable
,
385 L
"Generic Usb Mouse Simulate TouchPad2",
393 // If submit error, uninstall that interface
395 Status
= EFI_DEVICE_ERROR
;
397 gBS
->UninstallProtocolInterface (
399 &gEfiAbsolutePointerProtocolGuid
,
400 &UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
404 if (EFI_ERROR (Status
)) {
407 &gEfiUsbIoProtocolGuid
,
408 This
->DriverBindingHandle
,
412 if (UsbMouseAbsolutePointerDevice
!= NULL
) {
413 if (UsbMouseAbsolutePointerDevice
->InterfaceDescriptor
!= NULL
) {
414 gBS
->FreePool (UsbMouseAbsolutePointerDevice
->InterfaceDescriptor
);
417 if (UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
!= NULL
) {
418 gBS
->FreePool (UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
);
421 if ((UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
).WaitForInput
!= NULL
) {
422 gBS
->CloseEvent ((UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
).WaitForInput
);
425 gBS
->FreePool (UsbMouseAbsolutePointerDevice
);
426 UsbMouseAbsolutePointerDevice
= NULL
;
435 Stop this driver on ControllerHandle. Support stoping any child handles
436 created by this driver.
438 @param This Protocol instance pointer.
439 @param Controller Handle of device to stop driver on
440 @param NumberOfChildren Number of Children in the ChildHandleBuffer
441 @param ChildHandleBuffer List of handles for the children we need to stop.
444 @return EFI_DEVICE_ERROR
450 USBMouseAbsolutePointerDriverBindingStop (
451 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
452 IN EFI_HANDLE Controller
,
453 IN UINTN NumberOfChildren
,
454 IN EFI_HANDLE
*ChildHandleBuffer
458 USB_MOUSE_ABSOLUTE_POINTER_DEV
*UsbMouseAbsolutePointerDevice
;
459 EFI_ABSOLUTE_POINTER_PROTOCOL
*AbsolutePointerProtocol
;
460 EFI_USB_IO_PROTOCOL
*UsbIo
;
463 // Get our context back.
465 Status
= gBS
->OpenProtocol (
467 &gEfiAbsolutePointerProtocolGuid
,
468 (VOID
**) &AbsolutePointerProtocol
,
469 This
->DriverBindingHandle
,
471 EFI_OPEN_PROTOCOL_GET_PROTOCOL
474 if (EFI_ERROR (Status
)) {
475 return EFI_UNSUPPORTED
;
477 UsbMouseAbsolutePointerDevice
= USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (AbsolutePointerProtocol
);
481 &gEfiAbsolutePointerProtocolGuid
,
482 This
->DriverBindingHandle
,
486 UsbIo
= UsbMouseAbsolutePointerDevice
->UsbIo
;
489 // Uninstall the Asyn Interrupt Transfer from this device
490 // will disable the mouse data input from this device
492 MouseAbsolutePointerReportStatusCode (
493 UsbMouseAbsolutePointerDevice
->DevicePath
,
495 PcdGet32 (PcdStatusCodeValueMouseDisable
)
499 // Delete Mouse Async Interrupt Transfer
501 UsbIo
->UsbAsyncInterruptTransfer (
503 UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
->EndpointAddress
,
505 UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
->Interval
,
511 gBS
->CloseEvent (UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
.WaitForInput
);
513 if (UsbMouseAbsolutePointerDevice
->DelayedRecoveryEvent
) {
514 gBS
->CloseEvent (UsbMouseAbsolutePointerDevice
->DelayedRecoveryEvent
);
515 UsbMouseAbsolutePointerDevice
->DelayedRecoveryEvent
= 0;
518 Status
= gBS
->UninstallProtocolInterface (
520 &gEfiAbsolutePointerProtocolGuid
,
521 &UsbMouseAbsolutePointerDevice
->AbsolutePointerProtocol
523 if (EFI_ERROR (Status
)) {
529 &gEfiUsbIoProtocolGuid
,
530 This
->DriverBindingHandle
,
534 gBS
->FreePool (UsbMouseAbsolutePointerDevice
->InterfaceDescriptor
);
535 gBS
->FreePool (UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
);
537 if (UsbMouseAbsolutePointerDevice
->ControllerNameTable
) {
538 FreeUnicodeStringTable (UsbMouseAbsolutePointerDevice
->ControllerNameTable
);
541 gBS
->FreePool (UsbMouseAbsolutePointerDevice
);
549 Tell if a Usb Controller is a mouse
551 @param UsbIo Protocol instance pointer.
553 @retval TRUE It is a mouse
554 @retval FALSE It is not a mouse
558 IsUsbMouseAbsolutePointer (
559 IN EFI_USB_IO_PROTOCOL
*UsbIo
563 EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor
;
566 // Get the Default interface descriptor, now we only
567 // suppose it is interface 1
569 Status
= UsbIo
->UsbGetInterfaceDescriptor (
574 if (EFI_ERROR (Status
)) {
578 if ((InterfaceDescriptor
.InterfaceClass
== CLASS_HID
) &&
579 (InterfaceDescriptor
.InterfaceSubClass
== SUBCLASS_BOOT
) &&
580 (InterfaceDescriptor
.InterfaceProtocol
== PROTOCOL_MOUSE
)
591 Initialize the Usb Mouse Simulate TouchPad Device.
593 @param UsbMouseAbsolutePointerDev Device instance to be initialized
595 @retval EFI_SUCCESS Success
596 @retval EFI_DEVICE_ERROR Init error. EFI_OUT_OF_RESOURCES- Can't allocate
601 InitializeUsbMouseAbsolutePointerDevice (
602 IN USB_MOUSE_ABSOLUTE_POINTER_DEV
*UsbMouseAbsolutePointerDev
605 EFI_USB_IO_PROTOCOL
*UsbIo
;
608 EFI_USB_HID_DESCRIPTOR MouseHidDesc
;
611 UsbIo
= UsbMouseAbsolutePointerDev
->UsbIo
;
614 // Get HID descriptor
616 Status
= UsbGetHidDescriptor (
618 UsbMouseAbsolutePointerDev
->InterfaceDescriptor
->InterfaceNumber
,
622 if (EFI_ERROR (Status
)) {
627 // Get Report descriptor
629 if (MouseHidDesc
.HidClassDesc
[0].DescriptorType
!= 0x22) {
630 return EFI_UNSUPPORTED
;
633 ReportDesc
= AllocateZeroPool (MouseHidDesc
.HidClassDesc
[0].DescriptorLength
);
634 if (ReportDesc
== NULL
) {
635 return EFI_OUT_OF_RESOURCES
;
638 Status
= UsbGetReportDescriptor (
640 UsbMouseAbsolutePointerDev
->InterfaceDescriptor
->InterfaceNumber
,
641 MouseHidDesc
.HidClassDesc
[0].DescriptorLength
,
645 if (EFI_ERROR (Status
)) {
646 gBS
->FreePool (ReportDesc
);
651 // Parse report descriptor
653 Status
= ParseMouseReportDescriptor (
654 UsbMouseAbsolutePointerDev
,
656 MouseHidDesc
.HidClassDesc
[0].DescriptorLength
659 if (EFI_ERROR (Status
)) {
660 gBS
->FreePool (ReportDesc
);
664 UsbMouseAbsolutePointerDev
->AbsolutePointerMode
.AbsoluteMaxX
= 1024;
665 UsbMouseAbsolutePointerDev
->AbsolutePointerMode
.AbsoluteMaxY
= 1024;
666 UsbMouseAbsolutePointerDev
->AbsolutePointerMode
.AbsoluteMaxZ
= 0;
667 UsbMouseAbsolutePointerDev
->AbsolutePointerMode
.AbsoluteMinX
= 0;
668 UsbMouseAbsolutePointerDev
->AbsolutePointerMode
.AbsoluteMinY
= 0;
669 UsbMouseAbsolutePointerDev
->AbsolutePointerMode
.AbsoluteMinZ
= 0;
670 UsbMouseAbsolutePointerDev
->AbsolutePointerMode
.Attributes
= 0x3;
673 // Here we just assume interface 0 is the mouse interface
675 UsbGetProtocolRequest (
681 if (Protocol
!= BOOT_PROTOCOL
) {
682 Status
= UsbSetProtocolRequest (
688 if (EFI_ERROR (Status
)) {
689 gBS
->FreePool (ReportDesc
);
690 return EFI_DEVICE_ERROR
;
695 // Set indefinite Idle rate for USB Mouse
704 gBS
->FreePool (ReportDesc
);
706 if (UsbMouseAbsolutePointerDev
->DelayedRecoveryEvent
) {
707 gBS
->CloseEvent (UsbMouseAbsolutePointerDev
->DelayedRecoveryEvent
);
708 UsbMouseAbsolutePointerDev
->DelayedRecoveryEvent
= 0;
711 Status
= gBS
->CreateEvent (
712 EVT_TIMER
| EVT_NOTIFY_SIGNAL
,
714 USBMouseAbsolutePointerRecoveryHandler
,
715 UsbMouseAbsolutePointerDev
,
716 &UsbMouseAbsolutePointerDev
->DelayedRecoveryEvent
724 It is called whenever there is data received from async interrupt
727 @param Data Data received.
728 @param DataLength Length of Data
729 @param Context Passed in context
730 @param Result Async Interrupt Transfer result
733 @return EFI_DEVICE_ERROR
738 OnMouseAbsolutePointerInterruptComplete (
745 USB_MOUSE_ABSOLUTE_POINTER_DEV
*UsbMouseAbsolutePointerDevice
;
746 EFI_USB_IO_PROTOCOL
*UsbIo
;
750 UsbMouseAbsolutePointerDevice
= (USB_MOUSE_ABSOLUTE_POINTER_DEV
*) Context
;
751 UsbIo
= UsbMouseAbsolutePointerDevice
->UsbIo
;
753 if (Result
!= EFI_USB_NOERROR
) {
755 // Some errors happen during the process
757 MouseAbsolutePointerReportStatusCode (
758 UsbMouseAbsolutePointerDevice
->DevicePath
,
759 EFI_ERROR_CODE
| EFI_ERROR_MINOR
,
760 PcdGet32 (PcdStatusCodeValueMouseInputError
)
763 if ((Result
& EFI_USB_ERR_STALL
) == EFI_USB_ERR_STALL
) {
764 EndpointAddr
= UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
->EndpointAddress
;
766 UsbClearEndpointHalt (
773 UsbIo
->UsbAsyncInterruptTransfer (
775 UsbMouseAbsolutePointerDevice
->IntEndpointDescriptor
->EndpointAddress
,
784 UsbMouseAbsolutePointerDevice
->DelayedRecoveryEvent
,
786 EFI_USB_INTERRUPT_DELAY
788 return EFI_DEVICE_ERROR
;
791 if (DataLength
== 0 || Data
== NULL
) {
798 UsbMouseAbsolutePointerDevice
->AbsolutePointerStateChanged
= TRUE
;
799 UsbMouseAbsolutePointerDevice
->AbsolutePointerState
.CurrentX
+= *((INT8
*) Data
+ 1);
800 UsbMouseAbsolutePointerDevice
->AbsolutePointerState
.CurrentY
+= *((INT8
*) Data
+ 2);
801 if (DataLength
> 3) {
802 UsbMouseAbsolutePointerDevice
->AbsolutePointerState
.CurrentZ
+= *((INT8
*) Data
+ 3);
804 UsbMouseAbsolutePointerDevice
->AbsolutePointerState
.ActiveButtons
= *(UINT8
*)Data
& 0x3;
810 Get the mouse state, see ABSOLUTE POINTER PROTOCOL.
812 @param This Protocol instance pointer.
813 @param MouseState Current mouse state
816 @return EFI_DEVICE_ERROR
817 @return EFI_NOT_READY
822 GetMouseAbsolutePointerState (
823 IN EFI_ABSOLUTE_POINTER_PROTOCOL
*This
,
824 OUT EFI_ABSOLUTE_POINTER_STATE
*MouseAbsolutePointerState
827 USB_MOUSE_ABSOLUTE_POINTER_DEV
*MouseAbsolutePointerDev
;
829 if (MouseAbsolutePointerState
== NULL
) {
830 return EFI_DEVICE_ERROR
;
833 MouseAbsolutePointerDev
= USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (This
);
835 if (!MouseAbsolutePointerDev
->AbsolutePointerStateChanged
) {
836 return EFI_NOT_READY
;
840 MouseAbsolutePointerState
,
841 &MouseAbsolutePointerDev
->AbsolutePointerState
,
842 sizeof (EFI_ABSOLUTE_POINTER_STATE
)
846 // Clear previous move state
848 MouseAbsolutePointerDev
->AbsolutePointerState
.CurrentX
= 0;
849 MouseAbsolutePointerDev
->AbsolutePointerState
.CurrentY
= 0;
850 MouseAbsolutePointerDev
->AbsolutePointerState
.CurrentZ
= 0;
851 MouseAbsolutePointerDev
->AbsolutePointerState
.ActiveButtons
= 0;
853 MouseAbsolutePointerDev
->AbsolutePointerStateChanged
= FALSE
;
860 Reset the mouse device, see ABSOLUTE POINTER PROTOCOL.
862 @param This Protocol instance pointer.
863 @param ExtendedVerification Ignored here/
870 UsbMouseAbsolutePointerReset (
871 IN EFI_ABSOLUTE_POINTER_PROTOCOL
*This
,
872 IN BOOLEAN ExtendedVerification
875 USB_MOUSE_ABSOLUTE_POINTER_DEV
*UsbMouseAbsolutePointerDevice
;
877 UsbMouseAbsolutePointerDevice
= USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (This
);
879 MouseAbsolutePointerReportStatusCode (
880 UsbMouseAbsolutePointerDevice
->DevicePath
,
882 PcdGet32 (PcdStatusCodeValueMouseReset
)
886 &UsbMouseAbsolutePointerDevice
->AbsolutePointerState
,
887 sizeof (EFI_ABSOLUTE_POINTER_STATE
)
889 UsbMouseAbsolutePointerDevice
->AbsolutePointerStateChanged
= FALSE
;
895 Event notification function for ABSOLUTE_POINTER.WaitForInput event
896 Signal the event if there is input from mouse
898 @param Event Wait Event
899 @param Context Passed parameter to event handler
905 UsbMouseAbsolutePointerWaitForInput (
910 USB_MOUSE_ABSOLUTE_POINTER_DEV
*UsbMouseAbsolutePointerDev
;
912 UsbMouseAbsolutePointerDev
= (USB_MOUSE_ABSOLUTE_POINTER_DEV
*) Context
;
915 // Someone is waiting on the mouse event, if there's
916 // input from mouse, signal the event
918 if (UsbMouseAbsolutePointerDev
->AbsolutePointerStateChanged
) {
919 gBS
->SignalEvent (Event
);
924 Timer handler for Delayed Recovery timer.
926 @param Event The Delayed Recovery event.
927 @param Context Points to the USB_KB_DEV instance.
933 USBMouseAbsolutePointerRecoveryHandler (
938 USB_MOUSE_ABSOLUTE_POINTER_DEV
*UsbMouseAbsolutePointerDev
;
939 EFI_USB_IO_PROTOCOL
*UsbIo
;
941 UsbMouseAbsolutePointerDev
= (USB_MOUSE_ABSOLUTE_POINTER_DEV
*) Context
;
943 UsbIo
= UsbMouseAbsolutePointerDev
->UsbIo
;
945 UsbIo
->UsbAsyncInterruptTransfer (
947 UsbMouseAbsolutePointerDev
->IntEndpointDescriptor
->EndpointAddress
,
949 UsbMouseAbsolutePointerDev
->IntEndpointDescriptor
->Interval
,
950 UsbMouseAbsolutePointerDev
->IntEndpointDescriptor
->MaxPacketSize
,
951 OnMouseAbsolutePointerInterruptComplete
,
952 UsbMouseAbsolutePointerDev
958 Report Status Code in Usb Bot Driver
960 @param DevicePath Use this to get Device Path
961 @param CodeType Status Code Type
962 @param CodeValue Status Code Value
968 MouseAbsolutePointerReportStatusCode (
969 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
970 IN EFI_STATUS_CODE_TYPE CodeType
,
971 IN EFI_STATUS_CODE_VALUE Value
974 REPORT_STATUS_CODE_WITH_DEVICE_PATH (