From 2170f9dd367a762593dc35617b2784e13e29b447 Mon Sep 17 00:00:00 2001 From: eric_tian Date: Wed, 28 Nov 2007 03:37:58 +0000 Subject: change "UsbMouseSimulateTouchPad" to "UsbMouseAbsolutePointer" for more clearing the name's meaning. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4336 6f19259b-4bc3-4df7-8a09-765794883524 --- .../UsbMouseSimulateTouchPadDxe/ComponentName.c | 44 +- .../UsbMouseAbsolutePointer.c | 1025 ++++++++++++++++++++ .../UsbMouseAbsolutePointer.h | 106 ++ .../UsbMouseAbsolutePointerDxe.inf | 67 ++ .../UsbMouseAbsolutePointerDxe.msa | 12 +- .../UsbMouseSimulateTouchPad.c | 1025 -------------------- .../UsbMouseSimulateTouchPad.h | 106 -- .../UsbMouseSimulateTouchPadDxe.inf | 67 -- .../Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.c | 40 +- .../Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.h | 4 +- 10 files changed, 1248 insertions(+), 1248 deletions(-) create mode 100644 MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointer.c create mode 100644 MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointer.h create mode 100644 MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointerDxe.inf delete mode 100644 MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPad.c delete mode 100644 MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPad.h delete mode 100644 MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPadDxe.inf (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/ComponentName.c b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/ComponentName.c index 0c5f88d43b..3e71f4e748 100644 --- a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/ComponentName.c +++ b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/ComponentName.c @@ -11,14 +11,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: - UsbMouseSimulateTouchPadComponentName.c + UsbMouseAbsolutePointerComponentName.c Abstract: **/ -#include "UsbMouseSimulateTouchPad.h" +#include "UsbMouseAbsolutePointer.h" #include // @@ -65,7 +65,7 @@ Abstract: **/ EFI_STATUS EFIAPI -UsbMouseSimulateTouchPadComponentNameGetDriverName ( +UsbMouseAbsolutePointerComponentNameGetDriverName ( IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName @@ -142,7 +142,7 @@ UsbMouseSimulateTouchPadComponentNameGetDriverName ( **/ EFI_STATUS EFIAPI -UsbMouseSimulateTouchPadComponentNameGetControllerName ( +UsbMouseAbsolutePointerComponentNameGetControllerName ( IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, @@ -154,24 +154,24 @@ UsbMouseSimulateTouchPadComponentNameGetControllerName ( // // EFI Component Name Protocol // -GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUsbMouseSimulateTouchPadComponentName = { - UsbMouseSimulateTouchPadComponentNameGetDriverName, - UsbMouseSimulateTouchPadComponentNameGetControllerName, +GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUsbMouseAbsolutePointerComponentName = { + UsbMouseAbsolutePointerComponentNameGetDriverName, + UsbMouseAbsolutePointerComponentNameGetControllerName, "eng" }; // // EFI Component Name 2 Protocol // -GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUsbMouseSimulateTouchPadComponentName2 = { - (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UsbMouseSimulateTouchPadComponentNameGetDriverName, - (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UsbMouseSimulateTouchPadComponentNameGetControllerName, +GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUsbMouseAbsolutePointerComponentName2 = { + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UsbMouseAbsolutePointerComponentNameGetDriverName, + (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UsbMouseAbsolutePointerComponentNameGetControllerName, "en" }; -GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUsbMouseSimulateTouchPadDriverNameTable[] = { +GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUsbMouseAbsolutePointerDriverNameTable[] = { { "eng;en", L"Usb Mouse Simulate TouchPad Driver" }, { NULL , NULL } }; @@ -218,7 +218,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUsbMouseSimulateTouchPad **/ EFI_STATUS EFIAPI -UsbMouseSimulateTouchPadComponentNameGetDriverName ( +UsbMouseAbsolutePointerComponentNameGetDriverName ( IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName @@ -227,9 +227,9 @@ UsbMouseSimulateTouchPadComponentNameGetDriverName ( return LookupUnicodeString2 ( Language, This->SupportedLanguages, - mUsbMouseSimulateTouchPadDriverNameTable, + mUsbMouseAbsolutePointerDriverNameTable, DriverName, - (BOOLEAN)(This == &gUsbMouseSimulateTouchPadComponentName) + (BOOLEAN)(This == &gUsbMouseAbsolutePointerComponentName) ); } @@ -303,7 +303,7 @@ UsbMouseSimulateTouchPadComponentNameGetDriverName ( **/ EFI_STATUS EFIAPI -UsbMouseSimulateTouchPadComponentNameGetControllerName ( +UsbMouseAbsolutePointerComponentNameGetControllerName ( IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, @@ -312,7 +312,7 @@ UsbMouseSimulateTouchPadComponentNameGetControllerName ( ) { EFI_STATUS Status; - USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDev; + USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDev; EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol; EFI_USB_IO_PROTOCOL *UsbIoProtocol; @@ -330,7 +330,7 @@ UsbMouseSimulateTouchPadComponentNameGetControllerName ( ControllerHandle, &gEfiUsbIoProtocolGuid, (VOID **) &UsbIoProtocol, - gUsbMouseSimulateTouchPadDriverBinding.DriverBindingHandle, + gUsbMouseAbsolutePointerDriverBinding.DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER ); @@ -338,7 +338,7 @@ UsbMouseSimulateTouchPadComponentNameGetControllerName ( gBS->CloseProtocol ( ControllerHandle, &gEfiUsbIoProtocolGuid, - gUsbMouseSimulateTouchPadDriverBinding.DriverBindingHandle, + gUsbMouseAbsolutePointerDriverBinding.DriverBindingHandle, ControllerHandle ); @@ -355,7 +355,7 @@ UsbMouseSimulateTouchPadComponentNameGetControllerName ( ControllerHandle, &gEfiAbsolutePointerProtocolGuid, (VOID **) &AbsolutePointerProtocol, - gUsbMouseSimulateTouchPadDriverBinding.DriverBindingHandle, + gUsbMouseAbsolutePointerDriverBinding.DriverBindingHandle, ControllerHandle, EFI_OPEN_PROTOCOL_GET_PROTOCOL ); @@ -364,14 +364,14 @@ UsbMouseSimulateTouchPadComponentNameGetControllerName ( return Status; } - UsbMouseSimulateTouchPadDev = USB_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_MOUSE_PROTOCOL (AbsolutePointerProtocol); + UsbMouseAbsolutePointerDev = USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (AbsolutePointerProtocol); return LookupUnicodeString2 ( Language, This->SupportedLanguages, - UsbMouseSimulateTouchPadDev->ControllerNameTable, + UsbMouseAbsolutePointerDev->ControllerNameTable, ControllerName, - (BOOLEAN)(This == &gUsbMouseSimulateTouchPadComponentName) + (BOOLEAN)(This == &gUsbMouseAbsolutePointerComponentName) ); } diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointer.c b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointer.c new file mode 100644 index 0000000000..af68e610a3 --- /dev/null +++ b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointer.c @@ -0,0 +1,1025 @@ +/** @file + +Copyright (c) 2004 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: + + UsbMouseAbsolutePointer.c + + Abstract: + + +**/ + +#include "UsbMouseAbsolutePointer.h" + +#include +#include + +#include "mousehid.h" + +// +// Prototypes +// Driver model protocol interface +// +EFI_STATUS +EFIAPI +USBMouseAbsolutePointerDriverBindingEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); + +EFI_STATUS +EFIAPI +USBMouseAbsolutePointerDriverBindingSupported ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +EFI_STATUS +EFIAPI +USBMouseAbsolutePointerDriverBindingStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +EFI_STATUS +EFIAPI +USBMouseAbsolutePointerDriverBindingStop ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer + ); + +EFI_GUID gEfiUsbMouseAbsolutePointerDriverGuid = { + 0xa579f729, 0xa71d, 0x4b45, { 0xbe, 0xd7, 0xd, 0xb0, 0xa8, 0x7c, 0x3e, 0x8d } +}; + +EFI_DRIVER_BINDING_PROTOCOL gUsbMouseAbsolutePointerDriverBinding = { + USBMouseAbsolutePointerDriverBindingSupported, + USBMouseAbsolutePointerDriverBindingStart, + USBMouseAbsolutePointerDriverBindingStop, + 0x1, + NULL, + NULL +}; + +// +// helper functions +// +STATIC +BOOLEAN +IsUsbMouseAbsolutePointer ( + IN EFI_USB_IO_PROTOCOL *UsbIo + ); + +STATIC +EFI_STATUS +InitializeUsbMouseAbsolutePointerDevice ( + IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDev + ); + +STATIC +VOID +EFIAPI +UsbMouseAbsolutePointerWaitForInput ( + IN EFI_EVENT Event, + IN VOID *Context + ); + +// +// Mouse interrupt handler +// +STATIC +EFI_STATUS +EFIAPI +OnMouseAbsolutePointerInterruptComplete ( + IN VOID *Data, + IN UINTN DataLength, + IN VOID *Context, + IN UINT32 Result + ); + +// +// Mouse simulate TouchPad, Using AbsolutePointer Protocol +// +STATIC +EFI_STATUS +EFIAPI +GetMouseAbsolutePointerState ( + IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, + OUT EFI_ABSOLUTE_POINTER_STATE *MouseAbsolutePointerState + ); + +STATIC +EFI_STATUS +EFIAPI +UsbMouseAbsolutePointerReset ( + IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ); + +// +// Driver start here +// +EFI_STATUS +EFIAPI +USBMouseAbsolutePointerDriverBindingEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + + Routine Description: + Entry point for EFI drivers. + + Arguments: + ImageHandle - EFI_HANDLE + SystemTable - EFI_SYSTEM_TABLE + Returns: + EFI_SUCCESS + others + +--*/ +{ + return EfiLibInstallDriverBindingComponentName2 ( + ImageHandle, + SystemTable, + &gUsbMouseAbsolutePointerDriverBinding, + ImageHandle, + &gUsbMouseAbsolutePointerComponentName, + &gUsbMouseAbsolutePointerComponentName2 + ); +} + + +/** + Test to see if this driver supports ControllerHandle. Any ControllerHandle + that has UsbHcProtocol installed will be supported. + + @param This Protocol instance pointer. + @param Controller Handle of device to test + @param RemainingDevicePath Not used + + @retval EFI_SUCCESS This driver supports this device. + @retval EFI_UNSUPPORTED This driver does not support this device. + +**/ +EFI_STATUS +EFIAPI +USBMouseAbsolutePointerDriverBindingSupported ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ) +{ + EFI_STATUS OpenStatus; + EFI_USB_IO_PROTOCOL *UsbIo; + EFI_STATUS Status; + + OpenStatus = gBS->OpenProtocol ( + Controller, + &gEfiUsbIoProtocolGuid, + (VOID **) &UsbIo, + This->DriverBindingHandle, + Controller, + EFI_OPEN_PROTOCOL_BY_DRIVER + ); + if (EFI_ERROR (OpenStatus) && (OpenStatus != EFI_ALREADY_STARTED)) { + return EFI_UNSUPPORTED; + } + + if (OpenStatus == EFI_ALREADY_STARTED) { + return EFI_ALREADY_STARTED; + } + + // + // Use the USB I/O protocol interface to see the Controller is + // the Mouse controller that can be managed by this driver. + // + Status = EFI_SUCCESS; + if (!IsUsbMouseAbsolutePointer (UsbIo)) { + Status = EFI_UNSUPPORTED; + } + + gBS->CloseProtocol ( + Controller, + &gEfiUsbIoProtocolGuid, + This->DriverBindingHandle, + Controller + ); + + return Status; +} + + +/** + Starting the Usb Bus Driver + + @param This Protocol instance pointer. + @param Controller Handle of device to test + @param RemainingDevicePath Not used + + @retval EFI_SUCCESS This driver supports this device. + @retval EFI_UNSUPPORTED This driver does not support this device. + @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error + EFI_OUT_OF_RESOURCES- Can't allocate memory + resources + @retval EFI_ALREADY_STARTED Thios driver has been started + +**/ +EFI_STATUS +EFIAPI +USBMouseAbsolutePointerDriverBindingStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ) +{ + EFI_STATUS Status; + EFI_USB_IO_PROTOCOL *UsbIo; + EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDesc; + USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDevice; + UINT8 EndpointNumber; + UINT8 Index; + UINT8 EndpointAddr; + UINT8 PollingInterval; + UINT8 PacketSize; + + UsbMouseAbsolutePointerDevice = NULL; + Status = EFI_SUCCESS; + + Status = gBS->OpenProtocol ( + Controller, + &gEfiUsbIoProtocolGuid, + (VOID **) &UsbIo, + This->DriverBindingHandle, + Controller, + EFI_OPEN_PROTOCOL_BY_DRIVER + ); + if (EFI_ERROR (Status)) { + goto ErrorExit; + } + + UsbMouseAbsolutePointerDevice = AllocateZeroPool (sizeof (USB_MOUSE_ABSOLUTE_POINTER_DEV)); + if (UsbMouseAbsolutePointerDevice == NULL) { + Status = EFI_OUT_OF_RESOURCES; + goto ErrorExit; + } + + UsbMouseAbsolutePointerDevice->UsbIo = UsbIo; + + UsbMouseAbsolutePointerDevice->Signature = USB_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE; + + UsbMouseAbsolutePointerDevice->InterfaceDescriptor = AllocatePool (sizeof (EFI_USB_INTERFACE_DESCRIPTOR)); + + if (UsbMouseAbsolutePointerDevice->InterfaceDescriptor == NULL) { + Status = EFI_OUT_OF_RESOURCES; + goto ErrorExit; + } + + EndpointDesc = AllocatePool (sizeof (EFI_USB_ENDPOINT_DESCRIPTOR)); + if (EndpointDesc == NULL) { + Status = EFI_OUT_OF_RESOURCES; + goto ErrorExit; + } + // + // Get the Device Path Protocol on Controller's handle + // + Status = gBS->OpenProtocol ( + Controller, + &gEfiDevicePathProtocolGuid, + (VOID **) &UsbMouseAbsolutePointerDevice->DevicePath, + This->DriverBindingHandle, + Controller, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + + if (EFI_ERROR (Status)) { + goto ErrorExit; + } + // + // Get interface & endpoint descriptor + // + UsbIo->UsbGetInterfaceDescriptor ( + UsbIo, + UsbMouseAbsolutePointerDevice->InterfaceDescriptor + ); + + EndpointNumber = UsbMouseAbsolutePointerDevice->InterfaceDescriptor->NumEndpoints; + + for (Index = 0; Index < EndpointNumber; Index++) { + UsbIo->UsbGetEndpointDescriptor ( + UsbIo, + Index, + EndpointDesc + ); + + if ((EndpointDesc->Attributes & 0x03) == 0x03) { + + // + // We only care interrupt endpoint here + // + UsbMouseAbsolutePointerDevice->IntEndpointDescriptor = EndpointDesc; + } + } + + if (UsbMouseAbsolutePointerDevice->IntEndpointDescriptor == NULL) { + // + // No interrupt endpoint, then error + // + Status = EFI_UNSUPPORTED; + goto ErrorExit; + } + + Status = InitializeUsbMouseAbsolutePointerDevice (UsbMouseAbsolutePointerDevice); + if (EFI_ERROR (Status)) { + MouseAbsolutePointerReportStatusCode ( + UsbMouseAbsolutePointerDevice->DevicePath, + EFI_ERROR_CODE | EFI_ERROR_MINOR, + PcdGet32 (PcdStatusCodeValueMouseInterfaceError) + ); + + goto ErrorExit; + } + + UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol.GetState = GetMouseAbsolutePointerState; + UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol.Reset = UsbMouseAbsolutePointerReset; + UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol.Mode = &UsbMouseAbsolutePointerDevice->AbsolutePointerMode; + + Status = gBS->CreateEvent ( + EVT_NOTIFY_WAIT, + TPL_NOTIFY, + UsbMouseAbsolutePointerWaitForInput, + UsbMouseAbsolutePointerDevice, + &((UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol).WaitForInput) + ); + if (EFI_ERROR (Status)) { + goto ErrorExit; + } + + Status = gBS->InstallProtocolInterface ( + &Controller, + &gEfiAbsolutePointerProtocolGuid, + EFI_NATIVE_INTERFACE, + &UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol + ); + + if (EFI_ERROR (Status)) { + Status = EFI_DEVICE_ERROR; + goto ErrorExit; + } + + // + // After Enabling Async Interrupt Transfer on this mouse Device + // we will be able to get key data from it. Thus this is deemed as + // the enable action of the mouse + // + + MouseAbsolutePointerReportStatusCode ( + UsbMouseAbsolutePointerDevice->DevicePath, + EFI_PROGRESS_CODE, + PcdGet32 (PcdStatusCodeValueMouseEnable) + ); + + // + // submit async interrupt transfer + // + EndpointAddr = UsbMouseAbsolutePointerDevice->IntEndpointDescriptor->EndpointAddress; + PollingInterval = UsbMouseAbsolutePointerDevice->IntEndpointDescriptor->Interval; + PacketSize = (UINT8) (UsbMouseAbsolutePointerDevice->IntEndpointDescriptor->MaxPacketSize); + + Status = UsbIo->UsbAsyncInterruptTransfer ( + UsbIo, + EndpointAddr, + TRUE, + PollingInterval, + PacketSize, + OnMouseAbsolutePointerInterruptComplete, + UsbMouseAbsolutePointerDevice + ); + + if (!EFI_ERROR (Status)) { + + UsbMouseAbsolutePointerDevice->ControllerNameTable = NULL; + AddUnicodeString2 ( + "eng", + gUsbMouseAbsolutePointerComponentName.SupportedLanguages, + &UsbMouseAbsolutePointerDevice->ControllerNameTable, + L"Generic Usb Mouse Simulate TouchPad", + TRUE + ); + AddUnicodeString2 ( + "en", + gUsbMouseAbsolutePointerComponentName2.SupportedLanguages, + &UsbMouseAbsolutePointerDevice->ControllerNameTable, + L"Generic Usb Mouse Simulate TouchPad2", + FALSE + ); + + return EFI_SUCCESS; + } + + // + // If submit error, uninstall that interface + // + Status = EFI_DEVICE_ERROR; + + gBS->UninstallProtocolInterface ( + Controller, + &gEfiAbsolutePointerProtocolGuid, + &UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol + ); + +ErrorExit: + if (EFI_ERROR (Status)) { + gBS->CloseProtocol ( + Controller, + &gEfiUsbIoProtocolGuid, + This->DriverBindingHandle, + Controller + ); + + if (UsbMouseAbsolutePointerDevice != NULL) { + if (UsbMouseAbsolutePointerDevice->InterfaceDescriptor != NULL) { + gBS->FreePool (UsbMouseAbsolutePointerDevice->InterfaceDescriptor); + } + + if (UsbMouseAbsolutePointerDevice->IntEndpointDescriptor != NULL) { + gBS->FreePool (UsbMouseAbsolutePointerDevice->IntEndpointDescriptor); + } + + if ((UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol).WaitForInput != NULL) { + gBS->CloseEvent ((UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol).WaitForInput); + } + + gBS->FreePool (UsbMouseAbsolutePointerDevice); + UsbMouseAbsolutePointerDevice = NULL; + } + } + + return Status; +} + + +/** + Stop this driver on ControllerHandle. Support stoping any child handles + created by this driver. + + @param This Protocol instance pointer. + @param Controller Handle of device to stop driver on + @param NumberOfChildren Number of Children in the ChildHandleBuffer + @param ChildHandleBuffer List of handles for the children we need to stop. + + @return EFI_SUCCESS + @return EFI_DEVICE_ERROR + @return others + +**/ +EFI_STATUS +EFIAPI +USBMouseAbsolutePointerDriverBindingStop ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer + ) +{ + EFI_STATUS Status; + USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDevice; + EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol; + EFI_USB_IO_PROTOCOL *UsbIo; + + // + // Get our context back. + // + Status = gBS->OpenProtocol ( + Controller, + &gEfiAbsolutePointerProtocolGuid, + (VOID **) &AbsolutePointerProtocol, + This->DriverBindingHandle, + Controller, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; + } + UsbMouseAbsolutePointerDevice = USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (AbsolutePointerProtocol); + + gBS->CloseProtocol ( + Controller, + &gEfiAbsolutePointerProtocolGuid, + This->DriverBindingHandle, + Controller + ); + + UsbIo = UsbMouseAbsolutePointerDevice->UsbIo; + + // + // Uninstall the Asyn Interrupt Transfer from this device + // will disable the mouse data input from this device + // + MouseAbsolutePointerReportStatusCode ( + UsbMouseAbsolutePointerDevice->DevicePath, + EFI_PROGRESS_CODE, + PcdGet32 (PcdStatusCodeValueMouseDisable) + ); + + // + // Delete Mouse Async Interrupt Transfer + // + UsbIo->UsbAsyncInterruptTransfer ( + UsbIo, + UsbMouseAbsolutePointerDevice->IntEndpointDescriptor->EndpointAddress, + FALSE, + UsbMouseAbsolutePointerDevice->IntEndpointDescriptor->Interval, + 0, + NULL, + NULL + ); + + gBS->CloseEvent (UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol.WaitForInput); + + if (UsbMouseAbsolutePointerDevice->DelayedRecoveryEvent) { + gBS->CloseEvent (UsbMouseAbsolutePointerDevice->DelayedRecoveryEvent); + UsbMouseAbsolutePointerDevice->DelayedRecoveryEvent = 0; + } + + Status = gBS->UninstallProtocolInterface ( + Controller, + &gEfiAbsolutePointerProtocolGuid, + &UsbMouseAbsolutePointerDevice->AbsolutePointerProtocol + ); + if (EFI_ERROR (Status)) { + return Status; + } + + gBS->CloseProtocol ( + Controller, + &gEfiUsbIoProtocolGuid, + This->DriverBindingHandle, + Controller + ); + + gBS->FreePool (UsbMouseAbsolutePointerDevice->InterfaceDescriptor); + gBS->FreePool (UsbMouseAbsolutePointerDevice->IntEndpointDescriptor); + + if (UsbMouseAbsolutePointerDevice->ControllerNameTable) { + FreeUnicodeStringTable (UsbMouseAbsolutePointerDevice->ControllerNameTable); + } + + gBS->FreePool (UsbMouseAbsolutePointerDevice); + + return EFI_SUCCESS; + +} + + +/** + Tell if a Usb Controller is a mouse + + @param UsbIo Protocol instance pointer. + + @retval TRUE It is a mouse + @retval FALSE It is not a mouse + +**/ +BOOLEAN +IsUsbMouseAbsolutePointer ( + IN EFI_USB_IO_PROTOCOL *UsbIo + ) +{ + EFI_STATUS Status; + EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; + + // + // Get the Default interface descriptor, now we only + // suppose it is interface 1 + // + Status = UsbIo->UsbGetInterfaceDescriptor ( + UsbIo, + &InterfaceDescriptor + ); + + if (EFI_ERROR (Status)) { + return FALSE; + } + + if ((InterfaceDescriptor.InterfaceClass == CLASS_HID) && + (InterfaceDescriptor.InterfaceSubClass == SUBCLASS_BOOT) && + (InterfaceDescriptor.InterfaceProtocol == PROTOCOL_MOUSE) + ) { + + return TRUE; + } + + return FALSE; +} + + +/** + Initialize the Usb Mouse Simulate TouchPad Device. + + @param UsbMouseAbsolutePointerDev Device instance to be initialized + + @retval EFI_SUCCESS Success + @retval EFI_DEVICE_ERROR Init error. EFI_OUT_OF_RESOURCES- Can't allocate + memory + +**/ +STATIC +EFI_STATUS +InitializeUsbMouseAbsolutePointerDevice ( + IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDev + ) +{ + EFI_USB_IO_PROTOCOL *UsbIo; + UINT8 Protocol; + EFI_STATUS Status; + EFI_USB_HID_DESCRIPTOR MouseHidDesc; + UINT8 *ReportDesc; + + UsbIo = UsbMouseAbsolutePointerDev->UsbIo; + + // + // Get HID descriptor + // + Status = UsbGetHidDescriptor ( + UsbIo, + UsbMouseAbsolutePointerDev->InterfaceDescriptor->InterfaceNumber, + &MouseHidDesc + ); + + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Get Report descriptor + // + if (MouseHidDesc.HidClassDesc[0].DescriptorType != 0x22) { + return EFI_UNSUPPORTED; + } + + ReportDesc = AllocateZeroPool (MouseHidDesc.HidClassDesc[0].DescriptorLength); + if (ReportDesc == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Status = UsbGetReportDescriptor ( + UsbIo, + UsbMouseAbsolutePointerDev->InterfaceDescriptor->InterfaceNumber, + MouseHidDesc.HidClassDesc[0].DescriptorLength, + ReportDesc + ); + + if (EFI_ERROR (Status)) { + gBS->FreePool (ReportDesc); + return Status; + } + + // + // Parse report descriptor + // + Status = ParseMouseReportDescriptor ( + UsbMouseAbsolutePointerDev, + ReportDesc, + MouseHidDesc.HidClassDesc[0].DescriptorLength + ); + + if (EFI_ERROR (Status)) { + gBS->FreePool (ReportDesc); + return Status; + } + + UsbMouseAbsolutePointerDev->AbsolutePointerMode.AbsoluteMaxX = 1024; + UsbMouseAbsolutePointerDev->AbsolutePointerMode.AbsoluteMaxY = 1024; + UsbMouseAbsolutePointerDev->AbsolutePointerMode.AbsoluteMaxZ = 0; + UsbMouseAbsolutePointerDev->AbsolutePointerMode.AbsoluteMinX = 0; + UsbMouseAbsolutePointerDev->AbsolutePointerMode.AbsoluteMinY = 0; + UsbMouseAbsolutePointerDev->AbsolutePointerMode.AbsoluteMinZ = 0; + UsbMouseAbsolutePointerDev->AbsolutePointerMode.Attributes = 0x3; + + // + // Here we just assume interface 0 is the mouse interface + // + UsbGetProtocolRequest ( + UsbIo, + 0, + &Protocol + ); + + if (Protocol != BOOT_PROTOCOL) { + Status = UsbSetProtocolRequest ( + UsbIo, + 0, + BOOT_PROTOCOL + ); + + if (EFI_ERROR (Status)) { + gBS->FreePool (ReportDesc); + return EFI_DEVICE_ERROR; + } + } + + // + // Set indefinite Idle rate for USB Mouse + // + UsbSetIdleRequest ( + UsbIo, + 0, + 0, + 0 + ); + + gBS->FreePool (ReportDesc); + + if (UsbMouseAbsolutePointerDev->DelayedRecoveryEvent) { + gBS->CloseEvent (UsbMouseAbsolutePointerDev->DelayedRecoveryEvent); + UsbMouseAbsolutePointerDev->DelayedRecoveryEvent = 0; + } + + Status = gBS->CreateEvent ( + EVT_TIMER | EVT_NOTIFY_SIGNAL, + TPL_NOTIFY, + USBMouseAbsolutePointerRecoveryHandler, + UsbMouseAbsolutePointerDev, + &UsbMouseAbsolutePointerDev->DelayedRecoveryEvent + ); + + return EFI_SUCCESS; +} + + +/** + It is called whenever there is data received from async interrupt + transfer. + + @param Data Data received. + @param DataLength Length of Data + @param Context Passed in context + @param Result Async Interrupt Transfer result + + @return EFI_SUCCESS + @return EFI_DEVICE_ERROR + +**/ +STATIC +EFI_STATUS +EFIAPI +OnMouseAbsolutePointerInterruptComplete ( + IN VOID *Data, + IN UINTN DataLength, + IN VOID *Context, + IN UINT32 Result + ) +{ + USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDevice; + EFI_USB_IO_PROTOCOL *UsbIo; + UINT8 EndpointAddr; + UINT32 UsbResult; + + UsbMouseAbsolutePointerDevice = (USB_MOUSE_ABSOLUTE_POINTER_DEV *) Context; + UsbIo = UsbMouseAbsolutePointerDevice->UsbIo; + + if (Result != EFI_USB_NOERROR) { + // + // Some errors happen during the process + // + MouseAbsolutePointerReportStatusCode ( + UsbMouseAbsolutePointerDevice->DevicePath, + EFI_ERROR_CODE | EFI_ERROR_MINOR, + PcdGet32 (PcdStatusCodeValueMouseInputError) + ); + + if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) { + EndpointAddr = UsbMouseAbsolutePointerDevice->IntEndpointDescriptor->EndpointAddress; + + UsbClearEndpointHalt ( + UsbIo, + EndpointAddr, + &UsbResult + ); + } + + UsbIo->UsbAsyncInterruptTransfer ( + UsbIo, + UsbMouseAbsolutePointerDevice->IntEndpointDescriptor->EndpointAddress, + FALSE, + 0, + 0, + NULL, + NULL + ); + + gBS->SetTimer ( + UsbMouseAbsolutePointerDevice->DelayedRecoveryEvent, + TimerRelative, + EFI_USB_INTERRUPT_DELAY + ); + return EFI_DEVICE_ERROR; + } + + if (DataLength == 0 || Data == NULL) { + return EFI_SUCCESS; + } + + // + //Check mouse Data + // + UsbMouseAbsolutePointerDevice->AbsolutePointerStateChanged = TRUE; + UsbMouseAbsolutePointerDevice->AbsolutePointerState.CurrentX += *((INT8 *) Data + 1); + UsbMouseAbsolutePointerDevice->AbsolutePointerState.CurrentY += *((INT8 *) Data + 2); + if (DataLength > 3) { + UsbMouseAbsolutePointerDevice->AbsolutePointerState.CurrentZ += *((INT8 *) Data + 3); + } + UsbMouseAbsolutePointerDevice->AbsolutePointerState.ActiveButtons = *(UINT8 *)Data & 0x3; + + return EFI_SUCCESS; +} + +/** + Get the mouse state, see ABSOLUTE POINTER PROTOCOL. + + @param This Protocol instance pointer. + @param MouseState Current mouse state + + @return EFI_SUCCESS + @return EFI_DEVICE_ERROR + @return EFI_NOT_READY + +**/ +STATIC +EFI_STATUS +EFIAPI +GetMouseAbsolutePointerState ( + IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, + OUT EFI_ABSOLUTE_POINTER_STATE *MouseAbsolutePointerState + ) +{ + USB_MOUSE_ABSOLUTE_POINTER_DEV *MouseAbsolutePointerDev; + + if (MouseAbsolutePointerState == NULL) { + return EFI_DEVICE_ERROR; + } + + MouseAbsolutePointerDev = USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (This); + + if (!MouseAbsolutePointerDev->AbsolutePointerStateChanged) { + return EFI_NOT_READY; + } + + CopyMem ( + MouseAbsolutePointerState, + &MouseAbsolutePointerDev->AbsolutePointerState, + sizeof (EFI_ABSOLUTE_POINTER_STATE) + ); + + // + // Clear previous move state + // + MouseAbsolutePointerDev->AbsolutePointerState.CurrentX = 0; + MouseAbsolutePointerDev->AbsolutePointerState.CurrentY = 0; + MouseAbsolutePointerDev->AbsolutePointerState.CurrentZ = 0; + MouseAbsolutePointerDev->AbsolutePointerState.ActiveButtons = 0; + + MouseAbsolutePointerDev->AbsolutePointerStateChanged = FALSE; + + return EFI_SUCCESS; +} + + +/** + Reset the mouse device, see ABSOLUTE POINTER PROTOCOL. + + @param This Protocol instance pointer. + @param ExtendedVerification Ignored here/ + + @return EFI_SUCCESS + +**/ +STATIC +EFI_STATUS +EFIAPI +UsbMouseAbsolutePointerReset ( + IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ) +{ + USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDevice; + + UsbMouseAbsolutePointerDevice = USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (This); + + MouseAbsolutePointerReportStatusCode ( + UsbMouseAbsolutePointerDevice->DevicePath, + EFI_PROGRESS_CODE, + PcdGet32 (PcdStatusCodeValueMouseReset) + ); + + ZeroMem ( + &UsbMouseAbsolutePointerDevice->AbsolutePointerState, + sizeof (EFI_ABSOLUTE_POINTER_STATE) + ); + UsbMouseAbsolutePointerDevice->AbsolutePointerStateChanged = FALSE; + + return EFI_SUCCESS; +} + +/** + Event notification function for ABSOLUTE_POINTER.WaitForInput event + Signal the event if there is input from mouse + + @param Event Wait Event + @param Context Passed parameter to event handler + VOID + +**/ +STATIC +VOID +EFIAPI +UsbMouseAbsolutePointerWaitForInput ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDev; + + UsbMouseAbsolutePointerDev = (USB_MOUSE_ABSOLUTE_POINTER_DEV *) Context; + + // + // Someone is waiting on the mouse event, if there's + // input from mouse, signal the event + // + if (UsbMouseAbsolutePointerDev->AbsolutePointerStateChanged) { + gBS->SignalEvent (Event); + } +} + +/** + Timer handler for Delayed Recovery timer. + + @param Event The Delayed Recovery event. + @param Context Points to the USB_KB_DEV instance. + + +**/ +VOID +EFIAPI +USBMouseAbsolutePointerRecoveryHandler ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDev; + EFI_USB_IO_PROTOCOL *UsbIo; + + UsbMouseAbsolutePointerDev = (USB_MOUSE_ABSOLUTE_POINTER_DEV *) Context; + + UsbIo = UsbMouseAbsolutePointerDev->UsbIo; + + UsbIo->UsbAsyncInterruptTransfer ( + UsbIo, + UsbMouseAbsolutePointerDev->IntEndpointDescriptor->EndpointAddress, + TRUE, + UsbMouseAbsolutePointerDev->IntEndpointDescriptor->Interval, + UsbMouseAbsolutePointerDev->IntEndpointDescriptor->MaxPacketSize, + OnMouseAbsolutePointerInterruptComplete, + UsbMouseAbsolutePointerDev + ); +} + + +/** + Report Status Code in Usb Bot Driver + + @param DevicePath Use this to get Device Path + @param CodeType Status Code Type + @param CodeValue Status Code Value + + @return None + +**/ +VOID +MouseAbsolutePointerReportStatusCode ( + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value + ) +{ + REPORT_STATUS_CODE_WITH_DEVICE_PATH ( + CodeType, + Value, + DevicePath + ); +} diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointer.h b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointer.h new file mode 100644 index 0000000000..9c7d22f6cc --- /dev/null +++ b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointer.h @@ -0,0 +1,106 @@ +/** @file + +Copyright (c) 2004 - 2007, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + Module Name: + + UsbMouseAbsolutePointer.h + + Abstract: + + +**/ + +#ifndef _USB_MOUSE_ABSOLUTE_POINTER_H +#define _USB_MOUSE_ABSOLUTE_POINTER_H + + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define CLASS_HID 3 +#define SUBCLASS_BOOT 1 +#define PROTOCOL_MOUSE 2 + +#define BOOT_PROTOCOL 0 +#define REPORT_PROTOCOL 1 + +#define USB_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'm', 's', 't') + +typedef struct { + BOOLEAN ButtonDetected; + UINT8 ButtonMinIndex; + UINT8 ButtonMaxIndex; + UINT8 Reserved; +} PRIVATE_DATA; + +typedef struct { + UINTN Signature; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_EVENT DelayedRecoveryEvent; + EFI_USB_IO_PROTOCOL *UsbIo; + EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor; + EFI_USB_ENDPOINT_DESCRIPTOR *IntEndpointDescriptor; + UINT8 NumberOfButtons; + INT32 XLogicMax; + INT32 XLogicMin; + INT32 YLogicMax; + INT32 YLogicMin; + + EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointerProtocol; + EFI_ABSOLUTE_POINTER_STATE AbsolutePointerState; + EFI_ABSOLUTE_POINTER_MODE AbsolutePointerMode; + BOOLEAN AbsolutePointerStateChanged; + + PRIVATE_DATA PrivateData; + EFI_UNICODE_STRING_TABLE *ControllerNameTable; +} USB_MOUSE_ABSOLUTE_POINTER_DEV; + +#define USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL(a) \ + CR(a, USB_MOUSE_ABSOLUTE_POINTER_DEV, AbsolutePointerProtocol, USB_MOUSE_ABSOLUTE_POINTER_DEV_SIGNATURE) + +VOID +EFIAPI +USBMouseAbsolutePointerRecoveryHandler ( + IN EFI_EVENT Event, + IN VOID *Context + ); + +// +// Global Variables +// +extern EFI_DRIVER_BINDING_PROTOCOL gUsbMouseAbsolutePointerDriverBinding; +extern EFI_COMPONENT_NAME_PROTOCOL gUsbMouseAbsolutePointerComponentName; +extern EFI_COMPONENT_NAME2_PROTOCOL gUsbMouseAbsolutePointerComponentName2; +extern EFI_GUID gEfiUsbMouseAbsolutePointerDriverGuid; + +VOID +MouseAbsolutePointerReportStatusCode ( + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, + IN EFI_STATUS_CODE_TYPE CodeType, + IN EFI_STATUS_CODE_VALUE Value + ); + +#endif diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointerDxe.inf b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointerDxe.inf new file mode 100644 index 0000000000..14f7298a7c --- /dev/null +++ b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointerDxe.inf @@ -0,0 +1,67 @@ +#/** @file +# Component name for module UsbMouseAbsolutePointerDxe +# +# FIX ME! +# Copyright (c) 2006, Intel Corporation. +# +# All rights reserved. This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = UsbMouseAbsolutePointerDxe + FILE_GUID = 4EA43463-747C-46eb-97FB-B0E5C5F05306 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x00020000 + + ENTRY_POINT = USBMouseAbsolutePointerDriverBindingEntryPoint + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + mousehid.h + ComponentName.c + UsbMouseAbsolutePointer.c + mousehid.c + UsbMouseAbsolutePointer.h + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + MemoryAllocationLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + BaseMemoryLib + ReportStatusCodeLib + PcdLib + UsbLib + +[Protocols] + gEfiUsbIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED + gEfiAbsolutePointerProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[FixedPcd] + gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInterfaceError + gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseEnable + gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseDisable + gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInputError + gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseReset + + diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointerDxe.msa b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointerDxe.msa index fad0d09787..5ab61542b0 100644 --- a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointerDxe.msa +++ b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseAbsolutePointerDxe.msa @@ -1,10 +1,10 @@ - UsbMouseSimulateTouchPadDxe + UsbMouseAbsolutePointerDxe DXE_DRIVER 4EA43463-747C-46eb-97FB-B0E5C5F05306 1.0 - Component name for module UsbMouseSimulateTouchPad + Component name for module UsbMouseAbsolutePointer FIX ME! Copyright (c) 2006, Intel Corporation. All rights reserved. This program and the accompanying materials @@ -19,7 +19,7 @@ IA32 X64 IPF EBC false - UsbMouseSimulateTouchPadDxe + UsbMouseAbsolutePointerDxe @@ -42,9 +42,9 @@ - UsbMouseSimulateTouchPad.h + UsbMouseAbsolutePointer.h mousehid.c - UsbMouseSimulateTouchPad.c + UsbMouseAbsolutePointer.c ComponentName.c mousehid.h @@ -67,7 +67,7 @@ EFI_SPECIFICATION_VERSION 0x00020000 EDK_RELEASE_VERSION 0x00020000 - USBMouseSimulateTouchPadDriverBindingEntryPoint + USBMouseAbsolutePointerDriverBindingEntryPoint \ No newline at end of file diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPad.c b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPad.c deleted file mode 100644 index d16e2b62f8..0000000000 --- a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPad.c +++ /dev/null @@ -1,1025 +0,0 @@ -/** @file - -Copyright (c) 2004 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - Module Name: - - UsbMouseSimulateTouchPad.c - - Abstract: - - -**/ - -#include "UsbMouseSimulateTouchPad.h" - -#include -#include - -#include "mousehid.h" - -// -// Prototypes -// Driver model protocol interface -// -EFI_STATUS -EFIAPI -USBMouseSimulateTouchPadDriverBindingEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -EFI_STATUS -EFIAPI -USBMouseSimulateTouchPadDriverBindingSupported ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ); - -EFI_STATUS -EFIAPI -USBMouseSimulateTouchPadDriverBindingStart ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ); - -EFI_STATUS -EFIAPI -USBMouseSimulateTouchPadDriverBindingStop ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer - ); - -EFI_GUID gEfiUsbMouseSimulateTouchPadDriverGuid = { - 0xa579f729, 0xa71d, 0x4b45, { 0xbe, 0xd7, 0xd, 0xb0, 0xa8, 0x7c, 0x3e, 0x8d } -}; - -EFI_DRIVER_BINDING_PROTOCOL gUsbMouseSimulateTouchPadDriverBinding = { - USBMouseSimulateTouchPadDriverBindingSupported, - USBMouseSimulateTouchPadDriverBindingStart, - USBMouseSimulateTouchPadDriverBindingStop, - 0x1, - NULL, - NULL -}; - -// -// helper functions -// -STATIC -BOOLEAN -IsUsbMouseSimulateTouchPad ( - IN EFI_USB_IO_PROTOCOL *UsbIo - ); - -STATIC -EFI_STATUS -InitializeUsbMouseSimulateTouchPadDevice ( - IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDev - ); - -STATIC -VOID -EFIAPI -UsbMouseSimulateTouchPadWaitForInput ( - IN EFI_EVENT Event, - IN VOID *Context - ); - -// -// Mouse interrupt handler -// -STATIC -EFI_STATUS -EFIAPI -OnMouseSimulateTouchPadInterruptComplete ( - IN VOID *Data, - IN UINTN DataLength, - IN VOID *Context, - IN UINT32 Result - ); - -// -// Mouse simulate TouchPad, Using AbsolutePointer Protocol -// -STATIC -EFI_STATUS -EFIAPI -GetMouseSimulateTouchPadState ( - IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, - OUT EFI_ABSOLUTE_POINTER_STATE *MouseSimulateTouchPadState - ); - -STATIC -EFI_STATUS -EFIAPI -UsbMouseSimulateTouchPadReset ( - IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ); - -// -// Driver start here -// -EFI_STATUS -EFIAPI -USBMouseSimulateTouchPadDriverBindingEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - - Routine Description: - Entry point for EFI drivers. - - Arguments: - ImageHandle - EFI_HANDLE - SystemTable - EFI_SYSTEM_TABLE - Returns: - EFI_SUCCESS - others - ---*/ -{ - return EfiLibInstallDriverBindingComponentName2 ( - ImageHandle, - SystemTable, - &gUsbMouseSimulateTouchPadDriverBinding, - ImageHandle, - &gUsbMouseSimulateTouchPadComponentName, - &gUsbMouseSimulateTouchPadComponentName2 - ); -} - - -/** - Test to see if this driver supports ControllerHandle. Any ControllerHandle - that has UsbHcProtocol installed will be supported. - - @param This Protocol instance pointer. - @param Controller Handle of device to test - @param RemainingDevicePath Not used - - @retval EFI_SUCCESS This driver supports this device. - @retval EFI_UNSUPPORTED This driver does not support this device. - -**/ -EFI_STATUS -EFIAPI -USBMouseSimulateTouchPadDriverBindingSupported ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ) -{ - EFI_STATUS OpenStatus; - EFI_USB_IO_PROTOCOL *UsbIo; - EFI_STATUS Status; - - OpenStatus = gBS->OpenProtocol ( - Controller, - &gEfiUsbIoProtocolGuid, - (VOID **) &UsbIo, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); - if (EFI_ERROR (OpenStatus) && (OpenStatus != EFI_ALREADY_STARTED)) { - return EFI_UNSUPPORTED; - } - - if (OpenStatus == EFI_ALREADY_STARTED) { - return EFI_ALREADY_STARTED; - } - - // - // Use the USB I/O protocol interface to see the Controller is - // the Mouse controller that can be managed by this driver. - // - Status = EFI_SUCCESS; - if (!IsUsbMouseSimulateTouchPad (UsbIo)) { - Status = EFI_UNSUPPORTED; - } - - gBS->CloseProtocol ( - Controller, - &gEfiUsbIoProtocolGuid, - This->DriverBindingHandle, - Controller - ); - - return Status; -} - - -/** - Starting the Usb Bus Driver - - @param This Protocol instance pointer. - @param Controller Handle of device to test - @param RemainingDevicePath Not used - - @retval EFI_SUCCESS This driver supports this device. - @retval EFI_UNSUPPORTED This driver does not support this device. - @retval EFI_DEVICE_ERROR This driver cannot be started due to device Error - EFI_OUT_OF_RESOURCES- Can't allocate memory - resources - @retval EFI_ALREADY_STARTED Thios driver has been started - -**/ -EFI_STATUS -EFIAPI -USBMouseSimulateTouchPadDriverBindingStart ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ) -{ - EFI_STATUS Status; - EFI_USB_IO_PROTOCOL *UsbIo; - EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDesc; - USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDevice; - UINT8 EndpointNumber; - UINT8 Index; - UINT8 EndpointAddr; - UINT8 PollingInterval; - UINT8 PacketSize; - - UsbMouseSimulateTouchPadDevice = NULL; - Status = EFI_SUCCESS; - - Status = gBS->OpenProtocol ( - Controller, - &gEfiUsbIoProtocolGuid, - (VOID **) &UsbIo, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); - if (EFI_ERROR (Status)) { - goto ErrorExit; - } - - UsbMouseSimulateTouchPadDevice = AllocateZeroPool (sizeof (USB_MOUSE_SIMULATE_TOUCHPAD_DEV)); - if (UsbMouseSimulateTouchPadDevice == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ErrorExit; - } - - UsbMouseSimulateTouchPadDevice->UsbIo = UsbIo; - - UsbMouseSimulateTouchPadDevice->Signature = USB_MOUSE_SIMULATE_TOUCHPAD_DEV_SIGNATURE; - - UsbMouseSimulateTouchPadDevice->InterfaceDescriptor = AllocatePool (sizeof (EFI_USB_INTERFACE_DESCRIPTOR)); - - if (UsbMouseSimulateTouchPadDevice->InterfaceDescriptor == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ErrorExit; - } - - EndpointDesc = AllocatePool (sizeof (EFI_USB_ENDPOINT_DESCRIPTOR)); - if (EndpointDesc == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto ErrorExit; - } - // - // Get the Device Path Protocol on Controller's handle - // - Status = gBS->OpenProtocol ( - Controller, - &gEfiDevicePathProtocolGuid, - (VOID **) &UsbMouseSimulateTouchPadDevice->DevicePath, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - goto ErrorExit; - } - // - // Get interface & endpoint descriptor - // - UsbIo->UsbGetInterfaceDescriptor ( - UsbIo, - UsbMouseSimulateTouchPadDevice->InterfaceDescriptor - ); - - EndpointNumber = UsbMouseSimulateTouchPadDevice->InterfaceDescriptor->NumEndpoints; - - for (Index = 0; Index < EndpointNumber; Index++) { - UsbIo->UsbGetEndpointDescriptor ( - UsbIo, - Index, - EndpointDesc - ); - - if ((EndpointDesc->Attributes & 0x03) == 0x03) { - - // - // We only care interrupt endpoint here - // - UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor = EndpointDesc; - } - } - - if (UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor == NULL) { - // - // No interrupt endpoint, then error - // - Status = EFI_UNSUPPORTED; - goto ErrorExit; - } - - Status = InitializeUsbMouseSimulateTouchPadDevice (UsbMouseSimulateTouchPadDevice); - if (EFI_ERROR (Status)) { - MouseSimulateTouchPadReportStatusCode ( - UsbMouseSimulateTouchPadDevice->DevicePath, - EFI_ERROR_CODE | EFI_ERROR_MINOR, - PcdGet32 (PcdStatusCodeValueMouseInterfaceError) - ); - - goto ErrorExit; - } - - UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol.GetState = GetMouseSimulateTouchPadState; - UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol.Reset = UsbMouseSimulateTouchPadReset; - UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol.Mode = &UsbMouseSimulateTouchPadDevice->AbsolutePointerMode; - - Status = gBS->CreateEvent ( - EVT_NOTIFY_WAIT, - TPL_NOTIFY, - UsbMouseSimulateTouchPadWaitForInput, - UsbMouseSimulateTouchPadDevice, - &((UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol).WaitForInput) - ); - if (EFI_ERROR (Status)) { - goto ErrorExit; - } - - Status = gBS->InstallProtocolInterface ( - &Controller, - &gEfiAbsolutePointerProtocolGuid, - EFI_NATIVE_INTERFACE, - &UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol - ); - - if (EFI_ERROR (Status)) { - Status = EFI_DEVICE_ERROR; - goto ErrorExit; - } - - // - // After Enabling Async Interrupt Transfer on this mouse Device - // we will be able to get key data from it. Thus this is deemed as - // the enable action of the mouse - // - - MouseSimulateTouchPadReportStatusCode ( - UsbMouseSimulateTouchPadDevice->DevicePath, - EFI_PROGRESS_CODE, - PcdGet32 (PcdStatusCodeValueMouseEnable) - ); - - // - // submit async interrupt transfer - // - EndpointAddr = UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor->EndpointAddress; - PollingInterval = UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor->Interval; - PacketSize = (UINT8) (UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor->MaxPacketSize); - - Status = UsbIo->UsbAsyncInterruptTransfer ( - UsbIo, - EndpointAddr, - TRUE, - PollingInterval, - PacketSize, - OnMouseSimulateTouchPadInterruptComplete, - UsbMouseSimulateTouchPadDevice - ); - - if (!EFI_ERROR (Status)) { - - UsbMouseSimulateTouchPadDevice->ControllerNameTable = NULL; - AddUnicodeString2 ( - "eng", - gUsbMouseSimulateTouchPadComponentName.SupportedLanguages, - &UsbMouseSimulateTouchPadDevice->ControllerNameTable, - L"Generic Usb Mouse Simulate TouchPad", - TRUE - ); - AddUnicodeString2 ( - "en", - gUsbMouseSimulateTouchPadComponentName2.SupportedLanguages, - &UsbMouseSimulateTouchPadDevice->ControllerNameTable, - L"Generic Usb Mouse Simulate TouchPad2", - FALSE - ); - - return EFI_SUCCESS; - } - - // - // If submit error, uninstall that interface - // - Status = EFI_DEVICE_ERROR; - - gBS->UninstallProtocolInterface ( - Controller, - &gEfiAbsolutePointerProtocolGuid, - &UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol - ); - -ErrorExit: - if (EFI_ERROR (Status)) { - gBS->CloseProtocol ( - Controller, - &gEfiUsbIoProtocolGuid, - This->DriverBindingHandle, - Controller - ); - - if (UsbMouseSimulateTouchPadDevice != NULL) { - if (UsbMouseSimulateTouchPadDevice->InterfaceDescriptor != NULL) { - gBS->FreePool (UsbMouseSimulateTouchPadDevice->InterfaceDescriptor); - } - - if (UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor != NULL) { - gBS->FreePool (UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor); - } - - if ((UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol).WaitForInput != NULL) { - gBS->CloseEvent ((UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol).WaitForInput); - } - - gBS->FreePool (UsbMouseSimulateTouchPadDevice); - UsbMouseSimulateTouchPadDevice = NULL; - } - } - - return Status; -} - - -/** - Stop this driver on ControllerHandle. Support stoping any child handles - created by this driver. - - @param This Protocol instance pointer. - @param Controller Handle of device to stop driver on - @param NumberOfChildren Number of Children in the ChildHandleBuffer - @param ChildHandleBuffer List of handles for the children we need to stop. - - @return EFI_SUCCESS - @return EFI_DEVICE_ERROR - @return others - -**/ -EFI_STATUS -EFIAPI -USBMouseSimulateTouchPadDriverBindingStop ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer - ) -{ - EFI_STATUS Status; - USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDevice; - EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol; - EFI_USB_IO_PROTOCOL *UsbIo; - - // - // Get our context back. - // - Status = gBS->OpenProtocol ( - Controller, - &gEfiAbsolutePointerProtocolGuid, - (VOID **) &AbsolutePointerProtocol, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - return EFI_UNSUPPORTED; - } - UsbMouseSimulateTouchPadDevice = USB_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_MOUSE_PROTOCOL (AbsolutePointerProtocol); - - gBS->CloseProtocol ( - Controller, - &gEfiAbsolutePointerProtocolGuid, - This->DriverBindingHandle, - Controller - ); - - UsbIo = UsbMouseSimulateTouchPadDevice->UsbIo; - - // - // Uninstall the Asyn Interrupt Transfer from this device - // will disable the mouse data input from this device - // - MouseSimulateTouchPadReportStatusCode ( - UsbMouseSimulateTouchPadDevice->DevicePath, - EFI_PROGRESS_CODE, - PcdGet32 (PcdStatusCodeValueMouseDisable) - ); - - // - // Delete Mouse Async Interrupt Transfer - // - UsbIo->UsbAsyncInterruptTransfer ( - UsbIo, - UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor->EndpointAddress, - FALSE, - UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor->Interval, - 0, - NULL, - NULL - ); - - gBS->CloseEvent (UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol.WaitForInput); - - if (UsbMouseSimulateTouchPadDevice->DelayedRecoveryEvent) { - gBS->CloseEvent (UsbMouseSimulateTouchPadDevice->DelayedRecoveryEvent); - UsbMouseSimulateTouchPadDevice->DelayedRecoveryEvent = 0; - } - - Status = gBS->UninstallProtocolInterface ( - Controller, - &gEfiAbsolutePointerProtocolGuid, - &UsbMouseSimulateTouchPadDevice->AbsolutePointerProtocol - ); - if (EFI_ERROR (Status)) { - return Status; - } - - gBS->CloseProtocol ( - Controller, - &gEfiUsbIoProtocolGuid, - This->DriverBindingHandle, - Controller - ); - - gBS->FreePool (UsbMouseSimulateTouchPadDevice->InterfaceDescriptor); - gBS->FreePool (UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor); - - if (UsbMouseSimulateTouchPadDevice->ControllerNameTable) { - FreeUnicodeStringTable (UsbMouseSimulateTouchPadDevice->ControllerNameTable); - } - - gBS->FreePool (UsbMouseSimulateTouchPadDevice); - - return EFI_SUCCESS; - -} - - -/** - Tell if a Usb Controller is a mouse - - @param UsbIo Protocol instance pointer. - - @retval TRUE It is a mouse - @retval FALSE It is not a mouse - -**/ -BOOLEAN -IsUsbMouseSimulateTouchPad ( - IN EFI_USB_IO_PROTOCOL *UsbIo - ) -{ - EFI_STATUS Status; - EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; - - // - // Get the Default interface descriptor, now we only - // suppose it is interface 1 - // - Status = UsbIo->UsbGetInterfaceDescriptor ( - UsbIo, - &InterfaceDescriptor - ); - - if (EFI_ERROR (Status)) { - return FALSE; - } - - if ((InterfaceDescriptor.InterfaceClass == CLASS_HID) && - (InterfaceDescriptor.InterfaceSubClass == SUBCLASS_BOOT) && - (InterfaceDescriptor.InterfaceProtocol == PROTOCOL_MOUSE) - ) { - - return TRUE; - } - - return FALSE; -} - - -/** - Initialize the Usb Mouse Simulate TouchPad Device. - - @param UsbMouseSimulateTouchPadDev Device instance to be initialized - - @retval EFI_SUCCESS Success - @retval EFI_DEVICE_ERROR Init error. EFI_OUT_OF_RESOURCES- Can't allocate - memory - -**/ -STATIC -EFI_STATUS -InitializeUsbMouseSimulateTouchPadDevice ( - IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDev - ) -{ - EFI_USB_IO_PROTOCOL *UsbIo; - UINT8 Protocol; - EFI_STATUS Status; - EFI_USB_HID_DESCRIPTOR MouseHidDesc; - UINT8 *ReportDesc; - - UsbIo = UsbMouseSimulateTouchPadDev->UsbIo; - - // - // Get HID descriptor - // - Status = UsbGetHidDescriptor ( - UsbIo, - UsbMouseSimulateTouchPadDev->InterfaceDescriptor->InterfaceNumber, - &MouseHidDesc - ); - - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Get Report descriptor - // - if (MouseHidDesc.HidClassDesc[0].DescriptorType != 0x22) { - return EFI_UNSUPPORTED; - } - - ReportDesc = AllocateZeroPool (MouseHidDesc.HidClassDesc[0].DescriptorLength); - if (ReportDesc == NULL) { - return EFI_OUT_OF_RESOURCES; - } - - Status = UsbGetReportDescriptor ( - UsbIo, - UsbMouseSimulateTouchPadDev->InterfaceDescriptor->InterfaceNumber, - MouseHidDesc.HidClassDesc[0].DescriptorLength, - ReportDesc - ); - - if (EFI_ERROR (Status)) { - gBS->FreePool (ReportDesc); - return Status; - } - - // - // Parse report descriptor - // - Status = ParseMouseReportDescriptor ( - UsbMouseSimulateTouchPadDev, - ReportDesc, - MouseHidDesc.HidClassDesc[0].DescriptorLength - ); - - if (EFI_ERROR (Status)) { - gBS->FreePool (ReportDesc); - return Status; - } - - UsbMouseSimulateTouchPadDev->AbsolutePointerMode.AbsoluteMaxX = 1024; - UsbMouseSimulateTouchPadDev->AbsolutePointerMode.AbsoluteMaxY = 1024; - UsbMouseSimulateTouchPadDev->AbsolutePointerMode.AbsoluteMaxZ = 0; - UsbMouseSimulateTouchPadDev->AbsolutePointerMode.AbsoluteMinX = 0; - UsbMouseSimulateTouchPadDev->AbsolutePointerMode.AbsoluteMinY = 0; - UsbMouseSimulateTouchPadDev->AbsolutePointerMode.AbsoluteMinZ = 0; - UsbMouseSimulateTouchPadDev->AbsolutePointerMode.Attributes = 0x3; - - // - // Here we just assume interface 0 is the mouse interface - // - UsbGetProtocolRequest ( - UsbIo, - 0, - &Protocol - ); - - if (Protocol != BOOT_PROTOCOL) { - Status = UsbSetProtocolRequest ( - UsbIo, - 0, - BOOT_PROTOCOL - ); - - if (EFI_ERROR (Status)) { - gBS->FreePool (ReportDesc); - return EFI_DEVICE_ERROR; - } - } - - // - // Set indefinite Idle rate for USB Mouse - // - UsbSetIdleRequest ( - UsbIo, - 0, - 0, - 0 - ); - - gBS->FreePool (ReportDesc); - - if (UsbMouseSimulateTouchPadDev->DelayedRecoveryEvent) { - gBS->CloseEvent (UsbMouseSimulateTouchPadDev->DelayedRecoveryEvent); - UsbMouseSimulateTouchPadDev->DelayedRecoveryEvent = 0; - } - - Status = gBS->CreateEvent ( - EVT_TIMER | EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - USBMouseSimulateTouchPadRecoveryHandler, - UsbMouseSimulateTouchPadDev, - &UsbMouseSimulateTouchPadDev->DelayedRecoveryEvent - ); - - return EFI_SUCCESS; -} - - -/** - It is called whenever there is data received from async interrupt - transfer. - - @param Data Data received. - @param DataLength Length of Data - @param Context Passed in context - @param Result Async Interrupt Transfer result - - @return EFI_SUCCESS - @return EFI_DEVICE_ERROR - -**/ -STATIC -EFI_STATUS -EFIAPI -OnMouseSimulateTouchPadInterruptComplete ( - IN VOID *Data, - IN UINTN DataLength, - IN VOID *Context, - IN UINT32 Result - ) -{ - USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDevice; - EFI_USB_IO_PROTOCOL *UsbIo; - UINT8 EndpointAddr; - UINT32 UsbResult; - - UsbMouseSimulateTouchPadDevice = (USB_MOUSE_SIMULATE_TOUCHPAD_DEV *) Context; - UsbIo = UsbMouseSimulateTouchPadDevice->UsbIo; - - if (Result != EFI_USB_NOERROR) { - // - // Some errors happen during the process - // - MouseSimulateTouchPadReportStatusCode ( - UsbMouseSimulateTouchPadDevice->DevicePath, - EFI_ERROR_CODE | EFI_ERROR_MINOR, - PcdGet32 (PcdStatusCodeValueMouseInputError) - ); - - if ((Result & EFI_USB_ERR_STALL) == EFI_USB_ERR_STALL) { - EndpointAddr = UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor->EndpointAddress; - - UsbClearEndpointHalt ( - UsbIo, - EndpointAddr, - &UsbResult - ); - } - - UsbIo->UsbAsyncInterruptTransfer ( - UsbIo, - UsbMouseSimulateTouchPadDevice->IntEndpointDescriptor->EndpointAddress, - FALSE, - 0, - 0, - NULL, - NULL - ); - - gBS->SetTimer ( - UsbMouseSimulateTouchPadDevice->DelayedRecoveryEvent, - TimerRelative, - EFI_USB_INTERRUPT_DELAY - ); - return EFI_DEVICE_ERROR; - } - - if (DataLength == 0 || Data == NULL) { - return EFI_SUCCESS; - } - - // - //Check mouse Data - // - UsbMouseSimulateTouchPadDevice->AbsolutePointerStateChanged = TRUE; - UsbMouseSimulateTouchPadDevice->AbsolutePointerState.CurrentX += *((INT8 *) Data + 1); - UsbMouseSimulateTouchPadDevice->AbsolutePointerState.CurrentY += *((INT8 *) Data + 2); - if (DataLength > 3) { - UsbMouseSimulateTouchPadDevice->AbsolutePointerState.CurrentZ += *((INT8 *) Data + 3); - } - UsbMouseSimulateTouchPadDevice->AbsolutePointerState.ActiveButtons = *(UINT8 *)Data & 0x3; - - return EFI_SUCCESS; -} - -/** - Get the mouse state, see ABSOLUTE POINTER PROTOCOL. - - @param This Protocol instance pointer. - @param MouseState Current mouse state - - @return EFI_SUCCESS - @return EFI_DEVICE_ERROR - @return EFI_NOT_READY - -**/ -STATIC -EFI_STATUS -EFIAPI -GetMouseSimulateTouchPadState ( - IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, - OUT EFI_ABSOLUTE_POINTER_STATE *MouseSimulateTouchPadState - ) -{ - USB_MOUSE_SIMULATE_TOUCHPAD_DEV *MouseSimulateTouchPadDev; - - if (MouseSimulateTouchPadState == NULL) { - return EFI_DEVICE_ERROR; - } - - MouseSimulateTouchPadDev = USB_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_MOUSE_PROTOCOL (This); - - if (!MouseSimulateTouchPadDev->AbsolutePointerStateChanged) { - return EFI_NOT_READY; - } - - CopyMem ( - MouseSimulateTouchPadState, - &MouseSimulateTouchPadDev->AbsolutePointerState, - sizeof (EFI_ABSOLUTE_POINTER_STATE) - ); - - // - // Clear previous move state - // - MouseSimulateTouchPadDev->AbsolutePointerState.CurrentX = 0; - MouseSimulateTouchPadDev->AbsolutePointerState.CurrentY = 0; - MouseSimulateTouchPadDev->AbsolutePointerState.CurrentZ = 0; - MouseSimulateTouchPadDev->AbsolutePointerState.ActiveButtons = 0; - - MouseSimulateTouchPadDev->AbsolutePointerStateChanged = FALSE; - - return EFI_SUCCESS; -} - - -/** - Reset the mouse device, see ABSOLUTE POINTER PROTOCOL. - - @param This Protocol instance pointer. - @param ExtendedVerification Ignored here/ - - @return EFI_SUCCESS - -**/ -STATIC -EFI_STATUS -EFIAPI -UsbMouseSimulateTouchPadReset ( - IN EFI_ABSOLUTE_POINTER_PROTOCOL *This, - IN BOOLEAN ExtendedVerification - ) -{ - USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDevice; - - UsbMouseSimulateTouchPadDevice = USB_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_MOUSE_PROTOCOL (This); - - MouseSimulateTouchPadReportStatusCode ( - UsbMouseSimulateTouchPadDevice->DevicePath, - EFI_PROGRESS_CODE, - PcdGet32 (PcdStatusCodeValueMouseReset) - ); - - ZeroMem ( - &UsbMouseSimulateTouchPadDevice->AbsolutePointerState, - sizeof (EFI_ABSOLUTE_POINTER_STATE) - ); - UsbMouseSimulateTouchPadDevice->AbsolutePointerStateChanged = FALSE; - - return EFI_SUCCESS; -} - -/** - Event notification function for ABSOLUTE_POINTER.WaitForInput event - Signal the event if there is input from mouse - - @param Event Wait Event - @param Context Passed parameter to event handler - VOID - -**/ -STATIC -VOID -EFIAPI -UsbMouseSimulateTouchPadWaitForInput ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDev; - - UsbMouseSimulateTouchPadDev = (USB_MOUSE_SIMULATE_TOUCHPAD_DEV *) Context; - - // - // Someone is waiting on the mouse event, if there's - // input from mouse, signal the event - // - if (UsbMouseSimulateTouchPadDev->AbsolutePointerStateChanged) { - gBS->SignalEvent (Event); - } -} - -/** - Timer handler for Delayed Recovery timer. - - @param Event The Delayed Recovery event. - @param Context Points to the USB_KB_DEV instance. - - -**/ -VOID -EFIAPI -USBMouseSimulateTouchPadRecoveryHandler ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDev; - EFI_USB_IO_PROTOCOL *UsbIo; - - UsbMouseSimulateTouchPadDev = (USB_MOUSE_SIMULATE_TOUCHPAD_DEV *) Context; - - UsbIo = UsbMouseSimulateTouchPadDev->UsbIo; - - UsbIo->UsbAsyncInterruptTransfer ( - UsbIo, - UsbMouseSimulateTouchPadDev->IntEndpointDescriptor->EndpointAddress, - TRUE, - UsbMouseSimulateTouchPadDev->IntEndpointDescriptor->Interval, - UsbMouseSimulateTouchPadDev->IntEndpointDescriptor->MaxPacketSize, - OnMouseSimulateTouchPadInterruptComplete, - UsbMouseSimulateTouchPadDev - ); -} - - -/** - Report Status Code in Usb Bot Driver - - @param DevicePath Use this to get Device Path - @param CodeType Status Code Type - @param CodeValue Status Code Value - - @return None - -**/ -VOID -MouseSimulateTouchPadReportStatusCode ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN EFI_STATUS_CODE_TYPE CodeType, - IN EFI_STATUS_CODE_VALUE Value - ) -{ - REPORT_STATUS_CODE_WITH_DEVICE_PATH ( - CodeType, - Value, - DevicePath - ); -} diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPad.h b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPad.h deleted file mode 100644 index 65a87f1d2e..0000000000 --- a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPad.h +++ /dev/null @@ -1,106 +0,0 @@ -/** @file - -Copyright (c) 2004 - 2007, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - Module Name: - - UsbMouseSimulateTouchPad.h - - Abstract: - - -**/ - -#ifndef _USB_MOUSE_SIMULATE_TOUCHPAD_H -#define _USB_MOUSE_SIMULATE_TOUCHPAD_H - - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define CLASS_HID 3 -#define SUBCLASS_BOOT 1 -#define PROTOCOL_MOUSE 2 - -#define BOOT_PROTOCOL 0 -#define REPORT_PROTOCOL 1 - -#define USB_MOUSE_SIMULATE_TOUCHPAD_DEV_SIGNATURE EFI_SIGNATURE_32 ('u', 'm', 's', 't') - -typedef struct { - BOOLEAN ButtonDetected; - UINT8 ButtonMinIndex; - UINT8 ButtonMaxIndex; - UINT8 Reserved; -} PRIVATE_DATA; - -typedef struct { - UINTN Signature; - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_EVENT DelayedRecoveryEvent; - EFI_USB_IO_PROTOCOL *UsbIo; - EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor; - EFI_USB_ENDPOINT_DESCRIPTOR *IntEndpointDescriptor; - UINT8 NumberOfButtons; - INT32 XLogicMax; - INT32 XLogicMin; - INT32 YLogicMax; - INT32 YLogicMin; - - EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointerProtocol; - EFI_ABSOLUTE_POINTER_STATE AbsolutePointerState; - EFI_ABSOLUTE_POINTER_MODE AbsolutePointerMode; - BOOLEAN AbsolutePointerStateChanged; - - PRIVATE_DATA PrivateData; - EFI_UNICODE_STRING_TABLE *ControllerNameTable; -} USB_MOUSE_SIMULATE_TOUCHPAD_DEV; - -#define USB_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_MOUSE_PROTOCOL(a) \ - CR(a, USB_MOUSE_SIMULATE_TOUCHPAD_DEV, AbsolutePointerProtocol, USB_MOUSE_SIMULATE_TOUCHPAD_DEV_SIGNATURE) - -VOID -EFIAPI -USBMouseSimulateTouchPadRecoveryHandler ( - IN EFI_EVENT Event, - IN VOID *Context - ); - -// -// Global Variables -// -extern EFI_DRIVER_BINDING_PROTOCOL gUsbMouseSimulateTouchPadDriverBinding; -extern EFI_COMPONENT_NAME_PROTOCOL gUsbMouseSimulateTouchPadComponentName; -extern EFI_COMPONENT_NAME2_PROTOCOL gUsbMouseSimulateTouchPadComponentName2; -extern EFI_GUID gEfiUsbMouseSimulateTouchPadDriverGuid; - -VOID -MouseSimulateTouchPadReportStatusCode ( - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN EFI_STATUS_CODE_TYPE CodeType, - IN EFI_STATUS_CODE_VALUE Value - ); - -#endif diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPadDxe.inf b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPadDxe.inf deleted file mode 100644 index a1e98d6da2..0000000000 --- a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPadDxe.inf +++ /dev/null @@ -1,67 +0,0 @@ -#/** @file -# Component name for module UsbMouseSimulateTouchPad -# -# FIX ME! -# Copyright (c) 2006, Intel Corporation. -# -# All rights reserved. This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -# -#**/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = UsbMouseSimulateTouchPadDxe - FILE_GUID = 4EA43463-747C-46eb-97FB-B0E5C5F05306 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - EDK_RELEASE_VERSION = 0x00020000 - EFI_SPECIFICATION_VERSION = 0x00020000 - - ENTRY_POINT = USBMouseSimulateTouchPadDriverBindingEntryPoint - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = IA32 X64 IPF EBC -# - -[Sources.common] - mousehid.h - ComponentName.c - UsbMouseSimulateTouchPad.c - mousehid.c - UsbMouseSimulateTouchPad.h - -[Packages] - MdePkg/MdePkg.dec - -[LibraryClasses] - MemoryAllocationLib - UefiLib - UefiBootServicesTableLib - UefiDriverEntryPoint - BaseMemoryLib - ReportStatusCodeLib - PcdLib - UsbLib - -[Protocols] - gEfiUsbIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiAbsolutePointerProtocolGuid # PROTOCOL ALWAYS_CONSUMED - -[FixedPcd] - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInterfaceError - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseEnable - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseDisable - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseInputError - gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMouseReset - - diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.c b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.c index 735a59e6a5..1d2721c310 100644 --- a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.c +++ b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.c @@ -164,7 +164,7 @@ GetItemData ( /** Parse Local Item - @param UsbMouseSimulateTouchPad USB_MOUSE_SIMULATE_TOUCHPAD_DEV + @param UsbMouseAbsolutePointer USB_MOUSE_ABSOLUTE_POINTER_DEV @param LocalItem Local Item @@ -172,7 +172,7 @@ GetItemData ( STATIC VOID ParseLocalItem ( - IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad, + IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer, IN HID_ITEM *LocalItem ) { @@ -199,16 +199,16 @@ ParseLocalItem ( return ; case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: - if (UsbMouseSimulateTouchPad->PrivateData.ButtonDetected) { - UsbMouseSimulateTouchPad->PrivateData.ButtonMinIndex = (UINT8) Data; + if (UsbMouseAbsolutePointer->PrivateData.ButtonDetected) { + UsbMouseAbsolutePointer->PrivateData.ButtonMinIndex = (UINT8) Data; } return ; case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM: { - if (UsbMouseSimulateTouchPad->PrivateData.ButtonDetected) { - UsbMouseSimulateTouchPad->PrivateData.ButtonMaxIndex = (UINT8) Data; + if (UsbMouseAbsolutePointer->PrivateData.ButtonDetected) { + UsbMouseAbsolutePointer->PrivateData.ButtonMaxIndex = (UINT8) Data; } return ; @@ -219,7 +219,7 @@ ParseLocalItem ( STATIC VOID ParseGlobalItem ( - IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad, + IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer, IN HID_ITEM *GlobalItem ) { @@ -237,7 +237,7 @@ ParseGlobalItem ( // // Button Page // - UsbMouseSimulateTouchPad->PrivateData.ButtonDetected = TRUE; + UsbMouseAbsolutePointer->PrivateData.ButtonDetected = TRUE; return ; } break; @@ -251,7 +251,7 @@ ParseGlobalItem ( /** Parse Main Item - @param UsbMouseSimulateTouchPad USB_MOUSE_SIMULATE_TOUCHPAD_DEV + @param UsbMouseAbsolutePointer USB_MOUSE_ABSOLUTE_POINTER_DEV @param MainItem HID_ITEM to parse @return VOID @@ -260,7 +260,7 @@ ParseGlobalItem ( STATIC VOID ParseMainItem ( - IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad, + IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer, IN HID_ITEM *MainItem ) { @@ -274,7 +274,7 @@ ParseMainItem ( /** Parse Hid Item - @param UsbMouseSimulateTouchPad USB_MOUSE_SIMULATE_TOUCHPAD_DEV + @param UsbMouseAbsolutePointer USB_MOUSE_ABSOLUTE_POINTER_DEV @param HidItem HidItem to parse @return VOID @@ -283,7 +283,7 @@ ParseMainItem ( STATIC VOID ParseHidItem ( - IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad, + IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer, IN HID_ITEM *HidItem ) { @@ -293,21 +293,21 @@ ParseHidItem ( // // For Main Item, parse main item // - ParseMainItem (UsbMouseSimulateTouchPad, HidItem); + ParseMainItem (UsbMouseAbsolutePointer, HidItem); break; case HID_ITEM_TYPE_GLOBAL: // // For global Item, parse global item // - ParseGlobalItem (UsbMouseSimulateTouchPad, HidItem); + ParseGlobalItem (UsbMouseAbsolutePointer, HidItem); break; case HID_ITEM_TYPE_LOCAL: // // For Local Item, parse local item // - ParseLocalItem (UsbMouseSimulateTouchPad, HidItem); + ParseLocalItem (UsbMouseAbsolutePointer, HidItem); break; } } @@ -328,7 +328,7 @@ ParseHidItem ( **/ EFI_STATUS ParseMouseReportDescriptor ( - IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad, + IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer, IN UINT8 *ReportDescriptor, IN UINTN ReportSize ) @@ -349,14 +349,14 @@ ParseMouseReportDescriptor ( return EFI_DEVICE_ERROR; } - ParseHidItem (UsbMouseSimulateTouchPad, &HidItem); + ParseHidItem (UsbMouseAbsolutePointer, &HidItem); ptr = GetNextItem (ptr, DescriptorEnd, &HidItem); } - UsbMouseSimulateTouchPad->NumberOfButtons = (UINT8) (UsbMouseSimulateTouchPad->PrivateData.ButtonMaxIndex - UsbMouseSimulateTouchPad->PrivateData.ButtonMinIndex + 1); - UsbMouseSimulateTouchPad->XLogicMax = UsbMouseSimulateTouchPad->YLogicMax = 1023; - UsbMouseSimulateTouchPad->XLogicMin = UsbMouseSimulateTouchPad->YLogicMin = -1023; + UsbMouseAbsolutePointer->NumberOfButtons = (UINT8) (UsbMouseAbsolutePointer->PrivateData.ButtonMaxIndex - UsbMouseAbsolutePointer->PrivateData.ButtonMinIndex + 1); + UsbMouseAbsolutePointer->XLogicMax = UsbMouseAbsolutePointer->YLogicMax = 1023; + UsbMouseAbsolutePointer->XLogicMin = UsbMouseAbsolutePointer->YLogicMin = -1023; return EFI_SUCCESS; } diff --git a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.h b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.h index 4a1fadea93..4c4a2332ca 100644 --- a/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.h +++ b/MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/mousehid.h @@ -21,7 +21,7 @@ Abstract: #ifndef __MOUSE_HID_H #define __MOUSE_HID_H -#include "UsbMouseSimulateTouchPad.h" +#include "UsbMouseAbsolutePointer.h" // // HID Item general structure @@ -77,7 +77,7 @@ typedef struct { EFI_STATUS ParseMouseReportDescriptor ( - IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad, + IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer, IN UINT8 *ReportDescriptor, IN UINTN ReportSize ); -- cgit v1.2.3