mirror of https://github.com/acidanthera/audk.git
the last check-in for UsbMouseAbsolutePointer is not correct. do it again.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4342 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
6a6d955c5f
commit
09f72ae883
|
@ -0,0 +1,377 @@
|
|||
/** @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:
|
||||
|
||||
UsbMouseAbsolutePointerComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "UsbMouseAbsolutePointer.h"
|
||||
#include <Library/DebugLib.h>
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified
|
||||
in RFC 3066 or ISO 639-2 language code format.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UsbMouseAbsolutePointerComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
|
||||
This function retrieves the user readable name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||
driver specified by This has a user readable name in the language specified by
|
||||
Language, then a pointer to the controller name is returned in ControllerName,
|
||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||
managing the controller specified by ControllerHandle and ChildHandle,
|
||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver
|
||||
specified by This is managing. This handle
|
||||
specifies the controller whose name is to be
|
||||
returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||
the name of. This is an optional parameter that
|
||||
may be NULL. It will be NULL for device
|
||||
drivers. It will also be NULL for a bus drivers
|
||||
that wish to retrieve the name of the bus
|
||||
controller. It will not be NULL for a bus
|
||||
driver that wishes to retrieve the name of a
|
||||
child controller.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified in
|
||||
RFC 3066 or ISO 639-2 language code format.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle in the language specified by
|
||||
Language from the point of view of the driver
|
||||
specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||
the language specified by Language for the
|
||||
driver specified by This was returned in
|
||||
DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UsbMouseAbsolutePointerComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
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 gUsbMouseAbsolutePointerComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UsbMouseAbsolutePointerComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UsbMouseAbsolutePointerComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUsbMouseAbsolutePointerDriverNameTable[] = {
|
||||
{ "eng;en", L"Usb Mouse Simulate TouchPad Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified
|
||||
in RFC 3066 or ISO 639-2 language code format.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UsbMouseAbsolutePointerComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
{
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
mUsbMouseAbsolutePointerDriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN)(This == &gUsbMouseAbsolutePointerComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
|
||||
This function retrieves the user readable name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||
driver specified by This has a user readable name in the language specified by
|
||||
Language, then a pointer to the controller name is returned in ControllerName,
|
||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||
managing the controller specified by ControllerHandle and ChildHandle,
|
||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver
|
||||
specified by This is managing. This handle
|
||||
specifies the controller whose name is to be
|
||||
returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||
the name of. This is an optional parameter that
|
||||
may be NULL. It will be NULL for device
|
||||
drivers. It will also be NULL for a bus drivers
|
||||
that wish to retrieve the name of the bus
|
||||
controller. It will not be NULL for a bus
|
||||
driver that wishes to retrieve the name of a
|
||||
child controller.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified in
|
||||
RFC 3066 or ISO 639-2 language code format.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle in the language specified by
|
||||
Language from the point of view of the driver
|
||||
specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||
the language specified by Language for the
|
||||
driver specified by This was returned in
|
||||
DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UsbMouseAbsolutePointerComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointerDev;
|
||||
EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointerProtocol;
|
||||
EFI_USB_IO_PROTOCOL *UsbIoProtocol;
|
||||
|
||||
//
|
||||
// This is a device driver, so ChildHandle must be NULL.
|
||||
//
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Controller's handle
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiUsbIoProtocolGuid,
|
||||
(VOID **) &UsbIoProtocol,
|
||||
gUsbMouseAbsolutePointerDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiUsbIoProtocolGuid,
|
||||
gUsbMouseAbsolutePointerDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (Status != EFI_ALREADY_STARTED) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
//
|
||||
// Get the device context
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiAbsolutePointerProtocolGuid,
|
||||
(VOID **) &AbsolutePointerProtocol,
|
||||
gUsbMouseAbsolutePointerDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
UsbMouseAbsolutePointerDev = USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL (AbsolutePointerProtocol);
|
||||
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
UsbMouseAbsolutePointerDev->ControllerNameTable,
|
||||
ControllerName,
|
||||
(BOOLEAN)(This == &gUsbMouseAbsolutePointerComponentName)
|
||||
);
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -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 <PiDxe.h>
|
||||
|
||||
#include <Protocol/AbsolutePointer.h>
|
||||
#include <Protocol/UsbIo.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/UsbLib.h>
|
||||
|
||||
#include <IndustryStandard/Usb.h>
|
||||
|
||||
#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
|
|
@ -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
|
||||
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>UsbMouseAbsolutePointerDxe</ModuleName>
|
||||
<ModuleType>DXE_DRIVER</ModuleType>
|
||||
<GuidValue>4EA43463-747C-46eb-97FB-B0E5C5F05306</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Component name for module UsbMouseAbsolutePointer</Abstract>
|
||||
<Description>FIX ME!</Description>
|
||||
<Copyright>Copyright (c) 2006, Intel Corporation. </Copyright>
|
||||
<License>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.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>UsbMouseAbsolutePointerDxe</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>ReportStatusCodeLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>UsbMouseAbsolutePointer.h</Filename>
|
||||
<Filename>mousehid.c</Filename>
|
||||
<Filename>UsbMouseAbsolutePointer.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
<Filename>mousehid.h</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="1E73767F-8F52-4603-AEB4-F29B510B6766"/>
|
||||
<Package PackageGuid="2759ded5-bb57-4b06-af4f-c398fa552719"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiAbsolutePointerProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="ALWAYS_CONSUMED">
|
||||
<ProtocolCName>gEfiUsbIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<ModuleEntryPoint>USBMouseAbsolutePointerDriverBindingEntryPoint</ModuleEntryPoint>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
|
@ -0,0 +1,362 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2004, 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:
|
||||
|
||||
Mousehid.c
|
||||
|
||||
Abstract:
|
||||
Parse mouse hid descriptor
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "mousehid.h"
|
||||
|
||||
|
||||
//
|
||||
// Get an item from report descriptor
|
||||
//
|
||||
|
||||
/**
|
||||
Get Next Item
|
||||
|
||||
@param StartPos Start Position
|
||||
@param EndPos End Position
|
||||
@param HidItem HidItem to return
|
||||
|
||||
@return Position
|
||||
|
||||
**/
|
||||
STATIC
|
||||
UINT8 *
|
||||
GetNextItem (
|
||||
IN UINT8 *StartPos,
|
||||
IN UINT8 *EndPos,
|
||||
OUT HID_ITEM *HidItem
|
||||
)
|
||||
{
|
||||
UINT8 Temp;
|
||||
|
||||
if ((EndPos - StartPos) <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Temp = *StartPos;
|
||||
StartPos++;
|
||||
//
|
||||
// bit 2,3
|
||||
//
|
||||
HidItem->Type = (UINT8) ((Temp >> 2) & 0x03);
|
||||
//
|
||||
// bit 4-7
|
||||
//
|
||||
HidItem->Tag = (UINT8) ((Temp >> 4) & 0x0F);
|
||||
|
||||
if (HidItem->Tag == HID_ITEM_TAG_LONG) {
|
||||
//
|
||||
// Long Items are not supported by HID rev1.0,
|
||||
// although we try to parse it.
|
||||
//
|
||||
HidItem->Format = HID_ITEM_FORMAT_LONG;
|
||||
|
||||
if ((EndPos - StartPos) >= 2) {
|
||||
HidItem->Size = *StartPos++;
|
||||
HidItem->Tag = *StartPos++;
|
||||
|
||||
if ((EndPos - StartPos) >= HidItem->Size) {
|
||||
HidItem->Data.LongData = StartPos;
|
||||
StartPos += HidItem->Size;
|
||||
return StartPos;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
HidItem->Format = HID_ITEM_FORMAT_SHORT;
|
||||
//
|
||||
// bit 0, 1
|
||||
//
|
||||
HidItem->Size = (UINT8) (Temp & 0x03);
|
||||
switch (HidItem->Size) {
|
||||
|
||||
case 0:
|
||||
//
|
||||
// No data
|
||||
//
|
||||
return StartPos;
|
||||
|
||||
case 1:
|
||||
//
|
||||
// One byte data
|
||||
//
|
||||
if ((EndPos - StartPos) >= 1) {
|
||||
HidItem->Data.U8 = *StartPos++;
|
||||
return StartPos;
|
||||
}
|
||||
|
||||
case 2:
|
||||
//
|
||||
// Two byte data
|
||||
//
|
||||
if ((EndPos - StartPos) >= 2) {
|
||||
CopyMem (&HidItem->Data.U16, StartPos, sizeof (UINT16));
|
||||
StartPos += 2;
|
||||
return StartPos;
|
||||
}
|
||||
|
||||
case 3:
|
||||
//
|
||||
// 4 byte data, adjust size
|
||||
//
|
||||
HidItem->Size++;
|
||||
if ((EndPos - StartPos) >= 4) {
|
||||
CopyMem (&HidItem->Data.U32, StartPos, sizeof (UINT32));
|
||||
StartPos += 4;
|
||||
return StartPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get Item Data
|
||||
|
||||
@param HidItem HID_ITEM
|
||||
|
||||
@return HidItem Data
|
||||
|
||||
**/
|
||||
STATIC
|
||||
UINT32
|
||||
GetItemData (
|
||||
IN HID_ITEM *HidItem
|
||||
)
|
||||
{
|
||||
//
|
||||
// Get Data from HID_ITEM structure
|
||||
//
|
||||
switch (HidItem->Size) {
|
||||
|
||||
case 1:
|
||||
return HidItem->Data.U8;
|
||||
|
||||
case 2:
|
||||
return HidItem->Data.U16;
|
||||
|
||||
case 4:
|
||||
return HidItem->Data.U32;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Parse Local Item
|
||||
|
||||
@param UsbMouseAbsolutePointer USB_MOUSE_ABSOLUTE_POINTER_DEV
|
||||
@param LocalItem Local Item
|
||||
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
ParseLocalItem (
|
||||
IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer,
|
||||
IN HID_ITEM *LocalItem
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
|
||||
if (LocalItem->Size == 0) {
|
||||
//
|
||||
// No expected data for local item
|
||||
//
|
||||
return ;
|
||||
}
|
||||
|
||||
Data = GetItemData (LocalItem);
|
||||
|
||||
switch (LocalItem->Tag) {
|
||||
|
||||
case HID_LOCAL_ITEM_TAG_DELIMITER:
|
||||
//
|
||||
// we don't support delimiter here
|
||||
//
|
||||
return ;
|
||||
|
||||
case HID_LOCAL_ITEM_TAG_USAGE:
|
||||
return ;
|
||||
|
||||
case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM:
|
||||
if (UsbMouseAbsolutePointer->PrivateData.ButtonDetected) {
|
||||
UsbMouseAbsolutePointer->PrivateData.ButtonMinIndex = (UINT8) Data;
|
||||
}
|
||||
|
||||
return ;
|
||||
|
||||
case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM:
|
||||
{
|
||||
if (UsbMouseAbsolutePointer->PrivateData.ButtonDetected) {
|
||||
UsbMouseAbsolutePointer->PrivateData.ButtonMaxIndex = (UINT8) Data;
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
ParseGlobalItem (
|
||||
IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer,
|
||||
IN HID_ITEM *GlobalItem
|
||||
)
|
||||
{
|
||||
UINT8 UsagePage;
|
||||
|
||||
switch (GlobalItem->Tag) {
|
||||
case HID_GLOBAL_ITEM_TAG_USAGE_PAGE:
|
||||
{
|
||||
UsagePage = (UINT8) GetItemData (GlobalItem);
|
||||
|
||||
//
|
||||
// We only care Button Page here
|
||||
//
|
||||
if (UsagePage == 0x09) {
|
||||
//
|
||||
// Button Page
|
||||
//
|
||||
UsbMouseAbsolutePointer->PrivateData.ButtonDetected = TRUE;
|
||||
return ;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Parse Main Item
|
||||
|
||||
@param UsbMouseAbsolutePointer USB_MOUSE_ABSOLUTE_POINTER_DEV
|
||||
@param MainItem HID_ITEM to parse
|
||||
|
||||
@return VOID
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
ParseMainItem (
|
||||
IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer,
|
||||
IN HID_ITEM *MainItem
|
||||
)
|
||||
{
|
||||
//
|
||||
// we don't care any main items, just skip
|
||||
//
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Parse Hid Item
|
||||
|
||||
@param UsbMouseAbsolutePointer USB_MOUSE_ABSOLUTE_POINTER_DEV
|
||||
@param HidItem HidItem to parse
|
||||
|
||||
@return VOID
|
||||
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
ParseHidItem (
|
||||
IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer,
|
||||
IN HID_ITEM *HidItem
|
||||
)
|
||||
{
|
||||
switch (HidItem->Type) {
|
||||
|
||||
case HID_ITEM_TYPE_MAIN:
|
||||
//
|
||||
// For Main Item, parse main item
|
||||
//
|
||||
ParseMainItem (UsbMouseAbsolutePointer, HidItem);
|
||||
break;
|
||||
|
||||
case HID_ITEM_TYPE_GLOBAL:
|
||||
//
|
||||
// For global Item, parse global item
|
||||
//
|
||||
ParseGlobalItem (UsbMouseAbsolutePointer, HidItem);
|
||||
break;
|
||||
|
||||
case HID_ITEM_TYPE_LOCAL:
|
||||
//
|
||||
// For Local Item, parse local item
|
||||
//
|
||||
ParseLocalItem (UsbMouseAbsolutePointer, HidItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//
|
||||
// A simple parse just read some field we are interested in
|
||||
//
|
||||
|
||||
/**
|
||||
Parse Mouse Report Descriptor
|
||||
|
||||
@param UsbMouse USB_MOUSE_DEV
|
||||
@param ReportDescriptor Report descriptor to parse
|
||||
@param ReportSize Report descriptor size
|
||||
|
||||
@retval EFI_DEVICE_ERROR Report descriptor error
|
||||
@retval EFI_SUCCESS Success
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
ParseMouseReportDescriptor (
|
||||
IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer,
|
||||
IN UINT8 *ReportDescriptor,
|
||||
IN UINTN ReportSize
|
||||
)
|
||||
{
|
||||
UINT8 *DescriptorEnd;
|
||||
UINT8 *ptr;
|
||||
HID_ITEM HidItem;
|
||||
|
||||
DescriptorEnd = ReportDescriptor + ReportSize;
|
||||
|
||||
ptr = GetNextItem (ReportDescriptor, DescriptorEnd, &HidItem);
|
||||
|
||||
while (ptr != NULL) {
|
||||
if (HidItem.Format != HID_ITEM_FORMAT_SHORT) {
|
||||
//
|
||||
// Long Format Item is not supported at current HID revision
|
||||
//
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
ParseHidItem (UsbMouseAbsolutePointer, &HidItem);
|
||||
|
||||
ptr = GetNextItem (ptr, DescriptorEnd, &HidItem);
|
||||
}
|
||||
|
||||
UsbMouseAbsolutePointer->NumberOfButtons = (UINT8) (UsbMouseAbsolutePointer->PrivateData.ButtonMaxIndex - UsbMouseAbsolutePointer->PrivateData.ButtonMinIndex + 1);
|
||||
UsbMouseAbsolutePointer->XLogicMax = UsbMouseAbsolutePointer->YLogicMax = 1023;
|
||||
UsbMouseAbsolutePointer->XLogicMin = UsbMouseAbsolutePointer->YLogicMin = -1023;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
/** @file
|
||||
|
||||
Copyright (c) 2004, 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:
|
||||
|
||||
MouseHid.h
|
||||
|
||||
Abstract:
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __MOUSE_HID_H
|
||||
#define __MOUSE_HID_H
|
||||
|
||||
#include "UsbMouseAbsolutePointer.h"
|
||||
|
||||
//
|
||||
// HID Item general structure
|
||||
//
|
||||
typedef struct _hid_item {
|
||||
UINT16 Format;
|
||||
UINT8 Size;
|
||||
UINT8 Type;
|
||||
UINT8 Tag;
|
||||
union {
|
||||
UINT8 U8;
|
||||
UINT16 U16;
|
||||
UINT32 U32;
|
||||
INT8 I8;
|
||||
INT16 I16;
|
||||
INT32 I32;
|
||||
UINT8 *LongData;
|
||||
} Data;
|
||||
} HID_ITEM;
|
||||
|
||||
typedef struct {
|
||||
UINT16 UsagePage;
|
||||
INT32 LogicMin;
|
||||
INT32 LogicMax;
|
||||
INT32 PhysicalMin;
|
||||
INT32 PhysicalMax;
|
||||
UINT16 UnitExp;
|
||||
UINT16 UINT;
|
||||
UINT16 ReportId;
|
||||
UINT16 ReportSize;
|
||||
UINT16 ReportCount;
|
||||
} HID_GLOBAL;
|
||||
|
||||
typedef struct {
|
||||
UINT16 Usage[16]; /* usage array */
|
||||
UINT16 UsageIndex;
|
||||
UINT16 UsageMin;
|
||||
} HID_LOCAL;
|
||||
|
||||
typedef struct {
|
||||
UINT16 Type;
|
||||
UINT16 Usage;
|
||||
} HID_COLLECTION;
|
||||
|
||||
typedef struct {
|
||||
HID_GLOBAL Global;
|
||||
HID_GLOBAL GlobalStack[8];
|
||||
UINT32 GlobalStackPtr;
|
||||
HID_LOCAL Local;
|
||||
HID_COLLECTION CollectionStack[8];
|
||||
UINT32 CollectionStackPtr;
|
||||
} HID_PARSER;
|
||||
|
||||
EFI_STATUS
|
||||
ParseMouseReportDescriptor (
|
||||
IN USB_MOUSE_ABSOLUTE_POINTER_DEV *UsbMouseAbsolutePointer,
|
||||
IN UINT8 *ReportDescriptor,
|
||||
IN UINTN ReportSize
|
||||
);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue