add UsbMouseSimulateTouchPad driver to verify the correction of dispatching AbsolutePointer event of consplitter

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4297 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2007-11-14 07:08:55 +00:00
parent a8779537f3
commit 8ae0b360f5
13 changed files with 2793 additions and 5 deletions

View File

@ -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:
UsbMouseSimulateTouchPadComponentName.c
Abstract:
**/
#include "UsbMouseSimulateTouchPad.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
UsbMouseSimulateTouchPadComponentNameGetDriverName (
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
UsbMouseSimulateTouchPadComponentNameGetControllerName (
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 gUsbMouseSimulateTouchPadComponentName = {
UsbMouseSimulateTouchPadComponentNameGetDriverName,
UsbMouseSimulateTouchPadComponentNameGetControllerName,
"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,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUsbMouseSimulateTouchPadDriverNameTable[] = {
{ "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
UsbMouseSimulateTouchPadComponentNameGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mUsbMouseSimulateTouchPadDriverNameTable,
DriverName,
(BOOLEAN)(This == &gUsbMouseSimulateTouchPadComponentName)
);
}
/**
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
UsbMouseSimulateTouchPadComponentNameGetControllerName (
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_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPadDev;
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,
gUsbMouseSimulateTouchPadDriverBinding.DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (!EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
&gEfiUsbIoProtocolGuid,
gUsbMouseSimulateTouchPadDriverBinding.DriverBindingHandle,
ControllerHandle
);
return EFI_UNSUPPORTED;
}
if (Status != EFI_ALREADY_STARTED) {
return EFI_UNSUPPORTED;
}
//
// Get the device context
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiAbsolutePointerProtocolGuid,
(VOID **) &AbsolutePointerProtocol,
gUsbMouseSimulateTouchPadDriverBinding.DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
UsbMouseSimulateTouchPadDev = USB_MOUSE_SIMULATE_TOUCHPAD_DEV_FROM_MOUSE_PROTOCOL (AbsolutePointerProtocol);
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
UsbMouseSimulateTouchPadDev->ControllerNameTable,
ControllerName,
(BOOLEAN)(This == &gUsbMouseSimulateTouchPadComponentName)
);
}

View File

@ -0,0 +1,73 @@
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MsaHeader>
<ModuleName>UsbMouseSimulateTouchPadDxe</ModuleName>
<ModuleType>DXE_DRIVER</ModuleType>
<GuidValue>4EA43463-747C-46eb-97FB-B0E5C5F05306</GuidValue>
<Version>1.0</Version>
<Abstract>Component name for module UsbMouseSimulateTouchPad</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>UsbMouseSimulateTouchPadDxe</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>UsbMouseSimulateTouchPad.h</Filename>
<Filename>mousehid.c</Filename>
<Filename>UsbMouseSimulateTouchPad.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>USBMouseSimulateTouchPadDriverBindingEntryPoint</ModuleEntryPoint>
</Extern>
</Externs>
</ModuleSurfaceArea>

File diff suppressed because it is too large Load Diff

View File

@ -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:
UsbMouseSimulateTouchPad.h
Abstract:
**/
#ifndef _USB_MOUSE_SIMULATE_TOUCHPAD_H
#define _USB_MOUSE_SIMULATE_TOUCHPAD_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_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

View File

@ -0,0 +1,67 @@
#/** @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

View File

@ -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 UsbMouseSimulateTouchPad USB_MOUSE_SIMULATE_TOUCHPAD_DEV
@param LocalItem Local Item
**/
STATIC
VOID
ParseLocalItem (
IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad,
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 (UsbMouseSimulateTouchPad->PrivateData.ButtonDetected) {
UsbMouseSimulateTouchPad->PrivateData.ButtonMinIndex = (UINT8) Data;
}
return ;
case HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM:
{
if (UsbMouseSimulateTouchPad->PrivateData.ButtonDetected) {
UsbMouseSimulateTouchPad->PrivateData.ButtonMaxIndex = (UINT8) Data;
}
return ;
}
}
}
STATIC
VOID
ParseGlobalItem (
IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad,
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
//
UsbMouseSimulateTouchPad->PrivateData.ButtonDetected = TRUE;
return ;
}
break;
}
}
}
/**
Parse Main Item
@param UsbMouseSimulateTouchPad USB_MOUSE_SIMULATE_TOUCHPAD_DEV
@param MainItem HID_ITEM to parse
@return VOID
**/
STATIC
VOID
ParseMainItem (
IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad,
IN HID_ITEM *MainItem
)
{
//
// we don't care any main items, just skip
//
return ;
}
/**
Parse Hid Item
@param UsbMouseSimulateTouchPad USB_MOUSE_SIMULATE_TOUCHPAD_DEV
@param HidItem HidItem to parse
@return VOID
**/
STATIC
VOID
ParseHidItem (
IN USB_MOUSE_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad,
IN HID_ITEM *HidItem
)
{
switch (HidItem->Type) {
case HID_ITEM_TYPE_MAIN:
//
// For Main Item, parse main item
//
ParseMainItem (UsbMouseSimulateTouchPad, HidItem);
break;
case HID_ITEM_TYPE_GLOBAL:
//
// For global Item, parse global item
//
ParseGlobalItem (UsbMouseSimulateTouchPad, HidItem);
break;
case HID_ITEM_TYPE_LOCAL:
//
// For Local Item, parse local item
//
ParseLocalItem (UsbMouseSimulateTouchPad, 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_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad,
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 (UsbMouseSimulateTouchPad, &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;
return EFI_SUCCESS;
}

View File

@ -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 "UsbMouseSimulateTouchPad.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_SIMULATE_TOUCHPAD_DEV *UsbMouseSimulateTouchPad,
IN UINT8 *ReportDescriptor,
IN UINTN ReportSize
);
#endif

View File

@ -300,6 +300,7 @@
MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
MdeModulePkg/Bus/Usb/UsbMouseSimulateTouchPadDxe/UsbMouseSimulateTouchPadDxe.inf
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
MdeModulePkg/Universal/Variable/Application/VariableInfo.inf

View File

@ -56,6 +56,23 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePoi
"en"
};
//
// EFI Component Name Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName = {
ConSplitterComponentNameGetDriverName,
ConSplitterAbsolutePointerComponentNameGetControllerName,
"eng"
};
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterAbsolutePointerComponentNameGetControllerName,
"en"
};
//
// EFI Component Name Protocol
@ -128,6 +145,17 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterSimplePointer
}
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterAbsolutePointerControllerNameTable[] = {
{
"eng;en",
(CHAR16 *)L"Primary Absolute Pointer Device"
},
{
NULL,
NULL
}
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable[] = {
{
"eng;en",
@ -422,6 +450,91 @@ ConSplitterSimplePointerComponentNameGetControllerName (
);
}
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
/*++
Routine Description:
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
Arguments:
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
ControllerHandle - The handle of a controller that the driver specified by
This is managing. This handle specifies the controller
whose name is to be returned.
ChildHandle - 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.
Language - A pointer to RFC3066 language identifier.
This is the language of the controller name
that 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.
ControllerName - 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.
Returns:
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.
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
EFI_HANDLE.
EFI_INVALID_PARAMETER - Language is NULL.
EFI_INVALID_PARAMETER - ControllerName is NULL.
EFI_UNSUPPORTED - The driver specified by This is not currently
managing the controller specified by
ControllerHandle and ChildHandle.
EFI_UNSUPPORTED - The driver specified by This does not support the
language specified by Language.
--*/
{
EFI_STATUS Status;
EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer;
//
// here ChildHandle is not an Optional parameter.
//
if (ChildHandle == NULL) {
return EFI_UNSUPPORTED;
}
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiAbsolutePointerProtocolGuid,
(VOID **) &AbsolutePointer,
NULL,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mConSplitterAbsolutePointerControllerNameTable,
ControllerName,
(BOOLEAN)(This == &gConSplitterAbsolutePointerComponentName)
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.

View File

@ -76,6 +76,27 @@ STATIC TEXT_IN_SPLITTER_PRIVATE_DATA mConIn = {
(EFI_SIMPLE_POINTER_PROTOCOL **) NULL,
0,
{
ConSplitterAbsolutePointerReset,
ConSplitterAbsolutePointerGetState,
(EFI_EVENT) NULL,
(EFI_ABSOLUTE_POINTER_MODE *) NULL
},
{
0, //AbsoluteMinX
0, //AbsoluteMinY
0, //AbsoluteMinZ
0x10000, //AbsoluteMaxX
0x10000, //AbsoluteMaxY
0x10000, //AbsoluteMaxZ
0 //Attributes
},
0,
(EFI_ABSOLUTE_POINTER_PROTOCOL **) NULL,
0,
FALSE,
FALSE,
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -240,6 +261,18 @@ EFI_DRIVER_BINDING_PROTOCOL gConSplitterSimplePointerDriverBinding = {
NULL
};
//
// Driver binding instance for Absolute Pointer protocol
//
EFI_DRIVER_BINDING_PROTOCOL gConSplitterAbsolutePointerDriverBinding = {
ConSplitterAbsolutePointerDriverBindingSupported,
ConSplitterAbsolutePointerDriverBindingStart,
ConSplitterAbsolutePointerDriverBindingStop,
0xa,
NULL,
NULL
};
EFI_DRIVER_BINDING_PROTOCOL gConSplitterConOutDriverBinding = {
ConSplitterConOutDriverBindingSupported,
ConSplitterConOutDriverBindingStart,
@ -300,6 +333,16 @@ InitializeConSplitter(
);
ASSERT_EFI_ERROR (Status);
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gConSplitterAbsolutePointerDriverBinding,
NULL,
&gConSplitterAbsolutePointerComponentName,
&gConSplitterAbsolutePointerComponentName2
);
ASSERT_EFI_ERROR (Status);
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
@ -386,6 +429,8 @@ Returns:
&mConIn.TextInEx,
&gEfiSimplePointerProtocolGuid,
&mConIn.SimplePointer,
&gEfiAbsolutePointerProtocolGuid,
&mConIn.AbsolutePointer,
&gEfiPrimaryConsoleInDeviceGuid,
NULL,
NULL
@ -554,6 +599,28 @@ Returns:
InitializeListHead (&ConInPrivate->NotifyList);
//
// Allocate Buffer and Create Event for Absolute Pointer and Simple Pointer Protocols
//
ConInPrivate->AbsolutePointer.Mode = &ConInPrivate->AbsolutePointerMode;
Status = ConSplitterGrowBuffer (
sizeof (EFI_ABSOLUTE_POINTER_PROTOCOL *),
&ConInPrivate->AbsolutePointerListCount,
(VOID **) &ConInPrivate->AbsolutePointerList
);
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
Status = gBS->CreateEvent (
EVT_NOTIFY_WAIT,
TPL_NOTIFY,
ConSplitterAbsolutePointerWaitForInput,
ConInPrivate,
&ConInPrivate->AbsolutePointer.WaitForInput
);
ASSERT_EFI_ERROR (Status);
ConInPrivate->SimplePointer.Mode = &ConInPrivate->SimplePointerMode;
@ -787,6 +854,36 @@ Returns:
);
}
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
/*++
Routine Description:
Absolute Pointer Supported Check
Arguments:
This - Pointer to protocol.
ControllerHandle - Controller handle.
RemainingDevicePath - Remaining device path.
Returns:
EFI_STATUS
--*/
{
return ConSplitterSupported (
This,
ControllerHandle,
&gEfiAbsolutePointerProtocolGuid
);
}
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingSupported (
@ -1021,6 +1118,49 @@ Returns:
return ConSplitterSimplePointerAddDevice (&mConIn, SimplePointer);
}
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
/*++
Routine Description:
Start ConSplitter on ControllerHandle, and create the virtual
agrogated console device on first call Start for a ConIn handle.
Arguments:
This - Pointer to protocol.
ControllerHandle - Controller handle.
RemainingDevicePath - Remaining device path.
Returns:
EFI_ERROR if a AbsolutePointer protocol is not started.
--*/
{
EFI_STATUS Status;
EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer;
Status = ConSplitterStart (
This,
ControllerHandle,
mConIn.VirtualHandle,
&gEfiAbsolutePointerProtocolGuid,
&gEfiAbsolutePointerProtocolGuid,
(VOID **) &AbsolutePointer
);
if (EFI_ERROR (Status)) {
return Status;
}
return ConSplitterAbsolutePointerAddDevice (&mConIn, AbsolutePointer);
}
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingStart (
@ -1341,6 +1481,51 @@ Returns:
return ConSplitterSimplePointerDeleteDevice (&mConIn, SimplePointer);
}
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
/*++
Routine Description:
Arguments:
(Standard DriverBinding Protocol Stop() function)
Returns:
None
--*/
{
EFI_STATUS Status;
EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer;
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
}
Status = ConSplitterStop (
This,
ControllerHandle,
mConIn.VirtualHandle,
&gEfiAbsolutePointerProtocolGuid,
&gEfiAbsolutePointerProtocolGuid,
(VOID **) &AbsolutePointer
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Delete this console input device's data structures.
//
return ConSplitterAbsolutePointerDeleteDevice (&mConIn, AbsolutePointer);
}
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingStop (
@ -1729,6 +1914,83 @@ Returns:
return EFI_NOT_FOUND;
}
EFI_STATUS
ConSplitterAbsolutePointerAddDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer
)
/*++
Routine Description:
Arguments:
Returns:
EFI_OUT_OF_RESOURCES
EFI_SUCCESS
--*/
{
EFI_STATUS Status;
//
// If the Absolute Pointer List is full, enlarge it by calling growbuffer().
//
if (Private->CurrentNumberOfAbsolutePointers >= Private->AbsolutePointerListCount) {
Status = ConSplitterGrowBuffer (
sizeof (EFI_ABSOLUTE_POINTER_PROTOCOL *),
&Private->AbsolutePointerListCount,
(VOID **) &Private->AbsolutePointerList
);
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
}
//
// Add the new text-in device data structure into the Text In List.
//
Private->AbsolutePointerList[Private->CurrentNumberOfAbsolutePointers] = AbsolutePointer;
Private->CurrentNumberOfAbsolutePointers++;
return EFI_SUCCESS;
}
EFI_STATUS
ConSplitterAbsolutePointerDeleteDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer
)
/*++
Routine Description:
Arguments:
Returns:
None
--*/
{
UINTN Index;
//
// Remove the specified text-in device data structure from the Text In List,
// and rearrange the remaining data structures in the Text In List.
//
for (Index = 0; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {
if (Private->AbsolutePointerList[Index] == AbsolutePointer) {
for (Index = Index; Index < Private->CurrentNumberOfAbsolutePointers - 1; Index++) {
Private->AbsolutePointerList[Index] = Private->AbsolutePointerList[Index + 1];
}
Private->CurrentNumberOfAbsolutePointers--;
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
STATIC
EFI_STATUS
ConSplitterGrowMapTable (
@ -3325,8 +3587,6 @@ ConSplitterTextInUnregisterKeyNotify (
}
EFI_STATUS
EFIAPI
ConSplitterSimplePointerReset (
@ -3552,6 +3812,198 @@ Returns:
}
}
//
// Absolute Pointer Protocol functions
//
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerReset (
IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
)
/*++
Routine Description:
Resets the pointer device hardware.
Arguments:
This - Protocol instance pointer.
ExtendedVerification - Driver may perform diagnostics on reset.
Returns:
EFI_SUCCESS - The device was reset.
EFI_DEVICE_ERROR - The device is not functioning correctly and could
not be reset.
--*/
{
EFI_STATUS Status;
EFI_STATUS ReturnStatus;
TEXT_IN_SPLITTER_PRIVATE_DATA *Private;
UINTN Index;
Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This);
Private->AbsoluteInputEventSignalState = FALSE;
if (Private->CurrentNumberOfAbsolutePointers == 0) {
return EFI_SUCCESS;
}
//
// return the worst status met
//
for (Index = 0, ReturnStatus = EFI_SUCCESS; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {
Status = Private->AbsolutePointerList[Index]->Reset (
Private->AbsolutePointerList[Index],
ExtendedVerification
);
if (EFI_ERROR (Status)) {
ReturnStatus = Status;
}
}
return ReturnStatus;
}
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerGetState (
IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN OUT EFI_ABSOLUTE_POINTER_STATE *State
)
/*++
Routine Description:
Retrieves the current state of a pointer device.
Arguments:
This - Protocol instance pointer.
State - A pointer to the state information on the pointer device.
Returns:
EFI_SUCCESS - The state of the pointer device was returned in State..
EFI_NOT_READY - The state of the pointer device has not changed since the last call to
GetState().
EFI_DEVICE_ERROR - A device error occurred while attempting to retrieve the pointer
device's current state.
--*/
{
TEXT_IN_SPLITTER_PRIVATE_DATA *Private;
EFI_STATUS Status;
EFI_STATUS ReturnStatus;
UINTN Index;
EFI_ABSOLUTE_POINTER_STATE CurrentState;
Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS (This);
if (Private->PasswordEnabled) {
//
// If StdIn Locked return not ready
//
return EFI_NOT_READY;
}
Private->AbsoluteInputEventSignalState = FALSE;
State->CurrentX = 0;
State->CurrentY = 0;
State->CurrentZ = 0;
State->ActiveButtons = 0;
//
// if no physical pointer device exists, return EFI_NOT_READY;
// if any physical pointer device has changed state,
// return the state and EFI_SUCCESS.
//
ReturnStatus = EFI_NOT_READY;
for (Index = 0; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {
Status = Private->AbsolutePointerList[Index]->GetState (
Private->AbsolutePointerList[Index],
&CurrentState
);
if (!EFI_ERROR (Status)) {
if (ReturnStatus == EFI_NOT_READY) {
ReturnStatus = EFI_SUCCESS;
}
State->ActiveButtons = CurrentState.ActiveButtons;
if (!(Private->AbsolutePointerMode.AbsoluteMinX == 0 && Private->AbsolutePointerMode.AbsoluteMaxX == 0)) {
State->CurrentX = CurrentState.CurrentX;
}
if (!(Private->AbsolutePointerMode.AbsoluteMinY == 0 && Private->AbsolutePointerMode.AbsoluteMaxY == 0)) {
State->CurrentY = CurrentState.CurrentY;
}
if (!(Private->AbsolutePointerMode.AbsoluteMinZ == 0 && Private->AbsolutePointerMode.AbsoluteMaxZ == 0)) {
State->CurrentZ = CurrentState.CurrentZ;
}
} else if (Status == EFI_DEVICE_ERROR) {
ReturnStatus = EFI_DEVICE_ERROR;
}
}
return ReturnStatus;
}
VOID
EFIAPI
ConSplitterAbsolutePointerWaitForInput (
IN EFI_EVENT Event,
IN VOID *Context
)
/*++
Routine Description:
This event agregates all the events of the pointer devices in the splitter.
If the ConIn is password locked then return.
If any events of physical pointer devices are signaled, signal the pointer
splitter event. This will cause the calling code to call
ConSplitterAbsolutePointerGetState ().
Arguments:
Event - The Event assoicated with callback.
Context - Context registered when Event was created.
Returns:
None
--*/
{
EFI_STATUS Status;
TEXT_IN_SPLITTER_PRIVATE_DATA *Private;
UINTN Index;
Private = (TEXT_IN_SPLITTER_PRIVATE_DATA *) Context;
if (Private->PasswordEnabled) {
//
// If StdIn Locked return not ready
//
return ;
}
//
// if AbsoluteInputEventSignalState is flagged before,
// and not cleared by Reset() or GetState(), signal it
//
if (Private->AbsoluteInputEventSignalState) {
gBS->SignalEvent (Event);
return ;
}
//
// if any physical console input device has key input, signal the event.
//
for (Index = 0; Index < Private->CurrentNumberOfAbsolutePointers; Index++) {
Status = gBS->CheckEvent (Private->AbsolutePointerList[Index]->WaitForInput);
if (!EFI_ERROR (Status)) {
gBS->SignalEvent (Event);
Private->AbsoluteInputEventSignalState = TRUE;
}
}
}
EFI_STATUS
EFIAPI
ConSplitterTextOutReset (

View File

@ -21,6 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/GraphicsOutput.h>
#include <Guid/PrimaryConsoleInDevice.h>
#include <Protocol/SimplePointer.h>
#include <Protocol/AbsolutePointer.h>
#include <Protocol/SimpleTextOut.h>
#include <Guid/ConsoleInDevice.h>
#include <Protocol/SimpleTextIn.h>
@ -47,6 +48,8 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConInComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterSimplePointerDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePointerComponentName2;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterConOutDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2;
@ -89,6 +92,7 @@ typedef struct _TEXT_IN_EX_SPLITTER_NOTIFY {
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
LIST_ENTRY NotifyEntry;
} TEXT_IN_EX_SPLITTER_NOTIFY;
typedef struct {
UINT64 Signature;
EFI_HANDLE VirtualHandle;
@ -111,6 +115,13 @@ typedef struct {
EFI_SIMPLE_POINTER_PROTOCOL **PointerList;
UINTN PointerListCount;
EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointer;
EFI_ABSOLUTE_POINTER_MODE AbsolutePointerMode;
UINTN CurrentNumberOfAbsolutePointers;
EFI_ABSOLUTE_POINTER_PROTOCOL **AbsolutePointerList;
UINTN AbsolutePointerListCount;
BOOLEAN AbsoluteInputEventSignalState;
BOOLEAN PasswordEnabled;
CHAR16 Password[MAX_STD_IN_PASSWORD];
UINTN PwdIndex;
@ -368,6 +379,111 @@ ConSplitterStdErrDriverBindingStop (
)
;
//
// Driver binding functions
//
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
;
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
;
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
;
EFI_STATUS
ConSplitterAbsolutePointerAddDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer
)
;
EFI_STATUS
ConSplitterAbsolutePointerDeleteDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer
)
;
//
// Absolute Pointer protocol interfaces
//
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerReset (
IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
)
/*++
Routine Description:
Resets the pointer device hardware.
Arguments:
This - Protocol instance pointer.
ExtendedVerification - Driver may perform diagnostics on reset.
Returns:
EFI_SUCCESS - The device was reset.
EFI_DEVICE_ERROR - The device is not functioning correctly and could
not be reset.
--*/
;
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerGetState (
IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN OUT EFI_ABSOLUTE_POINTER_STATE *State
)
/*++
Routine Description:
Retrieves the current state of a pointer device.
Arguments:
This - Protocol instance pointer.
State - A pointer to the state information on the pointer device.
Returns:
EFI_SUCCESS - The state of the pointer device was returned in State..
EFI_NOT_READY - The state of the pointer device has not changed since the last call to
GetState().
EFI_DEVICE_ERROR - A device error occurred while attempting to retrieve the pointer
device's current state.
--*/
;
VOID
EFIAPI
ConSplitterAbsolutePointerWaitForInput (
IN EFI_EVENT Event,
IN VOID *Context
)
;
/**
Retrieves a Unicode string that is the user readable name of the driver.
@ -573,6 +689,16 @@ ConSplitterSimplePointerComponentNameGetControllerName (
OUT CHAR16 **ControllerName
);
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
;
/**
Retrieves a Unicode string that is the user readable name of the controller

View File

@ -77,6 +77,7 @@
gEfiSimpleTextOutProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiGraphicsOutputProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiUgaDrawProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiAbsolutePointerProtocolGuid # PROTOCOL ALWAYS_PRODUCED
[FeaturePcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport

View File

@ -113,8 +113,8 @@ typedef struct {
typedef
EFI_STATUS
(EFIAPI *EFI_ABSOLUTE_POINTER_RESET) (
IN CONST EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN CONST BOOLEAN ExtendedVerification
IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
@ -204,7 +204,7 @@ typedef struct {
typedef
EFI_STATUS
(EFIAPI *EFI_ABSOLUTE_POINTER_GET_STATE) (
IN CONST EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN OUT EFI_ABSOLUTE_POINTER_STATE *State
);