diff options
| author | Adonais Romero Gonzalez <[email protected]> | 2018-03-09 15:53:15 -0800 |
|---|---|---|
| committer | Adonais Romero Gonzalez <[email protected]> | 2018-03-09 15:53:15 -0800 |
| commit | fabcc07d873244daadd2ec7c6d756bd53a8a2af6 (patch) | |
| tree | 3a0cfd2c60b17fa34008207744fb140ff9959404 | |
| parent | ae101f9f54c6f28d7b9e54d037af505ea5bc46c7 (diff) | |
Remove input/hiddigi/SynapticsTouch sample
28 files changed, 0 insertions, 7805 deletions
diff --git a/input/hiddigi/SynapticsTouch/README.md b/input/hiddigi/SynapticsTouch/README.md deleted file mode 100644 index 6fb9b5ee..00000000 --- a/input/hiddigi/SynapticsTouch/README.md +++ /dev/null @@ -1,105 +0,0 @@ -<!--- - name: Synaptics Touch Sample - platform: KMDF - language: cpp - category: HID Touch - description: Demonstrates how to write a HID miniport driver for the Synaptics 3202 touch controller. - samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=620196 ----> - - -Synaptics Touch Sample -====================== - -The Synaptics Touch (KMDF) sample demonstrates how to write a HID miniport driver for the Synaptics 3202 touch controller. - - -## Universal Windows Driver Compliant -This sample builds a Universal Windows Driver. It uses only APIs and DDIs that are included in OneCoreUAP. - -Related technologies --------------------- - -[Kernel-Mode Driver Framework](http://msdn.microsoft.com/en-us/library/windows/hardware/ff544396) - -[Human Interface Devices](http://msdn.microsoft.com/en-us/library/windows/hardware/jj126202) - -[Windows Pointer Device](http://msdn.microsoft.com/en-us/library/windows/hardware/jj151570) - - -File Manifest -------------- - -File - -Description - -driver.h, driver.c - -DriverEntry and Events on the Driver Object. - -device.h, device.c - -Events on the Device Object. - -queue.h, queue.c - -Contains Events on the I/O Queue Objects. - -hid.c, hid.h - -Contains the HID descriptor and functions to handle to HID requests. - -idle.c, idle.h - -Contains the declarations for Power Idle specific callbacks and function definitions. - -internal.h - -Contains common types and defintions used internally by the multi touch screen driver. - -spb.c - -Contains all I2C-specific functionality. - -init.c - -Contains Synaptics initialization code. - -power.c - -Contains Synaptics power-on and power-off functionality. - -registry.c - -This module retrieves platform-specific controller configuration from the registry, or assigns default values if no registry configuration is present. - -report.c - -Contains Synaptics specific code for reporting samples. - -resolutions.c - -Contains resolution translation defines and types. - -rmiinternal.h - -Contains common types and defintions used internally by the multi touch screen driver. - -SynapticsTouch.inx - -File that describes the installation of this driver. The build process converts this into an INF file. - -Makefile.inc - -A makefile that defines custom build actions. This includes the conversion of the .INX file into a .INF file - -Makefile - -This file merely redirects to the real makefile that is shared by all the driver components of the Windows NT DDK. - -Sources - -Generic file that lists source files and all the build options. - - diff --git a/input/hiddigi/SynapticsTouch/SynapticsTouch.inx b/input/hiddigi/SynapticsTouch/SynapticsTouch.inx Binary files differdeleted file mode 100644 index b5479cf8..00000000 --- a/input/hiddigi/SynapticsTouch/SynapticsTouch.inx +++ /dev/null diff --git a/input/hiddigi/SynapticsTouch/SynapticsTouch.sln b/input/hiddigi/SynapticsTouch/SynapticsTouch.sln deleted file mode 100644 index 1a31546c..00000000 --- a/input/hiddigi/SynapticsTouch/SynapticsTouch.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SynapticsTouch", "SynapticsTouch.vcxproj", "{1E12CAAD-D041-4C21-B673-6FF831FC3D70}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1E12CAAD-D041-4C21-B673-6FF831FC3D70}.Debug|Win32.ActiveCfg = Debug|Win32 - {1E12CAAD-D041-4C21-B673-6FF831FC3D70}.Debug|Win32.Build.0 = Debug|Win32 - {1E12CAAD-D041-4C21-B673-6FF831FC3D70}.Release|Win32.ActiveCfg = Release|Win32 - {1E12CAAD-D041-4C21-B673-6FF831FC3D70}.Release|Win32.Build.0 = Release|Win32 - {1E12CAAD-D041-4C21-B673-6FF831FC3D70}.Debug|x64.ActiveCfg = Debug|x64 - {1E12CAAD-D041-4C21-B673-6FF831FC3D70}.Debug|x64.Build.0 = Debug|x64 - {1E12CAAD-D041-4C21-B673-6FF831FC3D70}.Release|x64.ActiveCfg = Release|x64 - {1E12CAAD-D041-4C21-B673-6FF831FC3D70}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/input/hiddigi/SynapticsTouch/SynapticsTouch.vcxproj b/input/hiddigi/SynapticsTouch/SynapticsTouch.vcxproj deleted file mode 100644 index be63e4e3..00000000 --- a/input/hiddigi/SynapticsTouch/SynapticsTouch.vcxproj +++ /dev/null @@ -1,200 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{1E12CAAD-D041-4C21-B673-6FF831FC3D70}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{25B3301B-A9D9-4EE3-8EA5-B1F1FBB3A18C}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>KMDF</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Driver</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>KMDF</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Driver</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>KMDF</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Driver</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>KMDF</DriverType> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Driver</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems"> - <ClCompile Include="device.c; driver.c; hid.c; idle.c; init.c; power.c; queue.c; report.c; resolutions.c; registry.c; spb.c"> - <WppEnabled>true</WppEnabled> - <WppKernelMode>true</WppKernelMode> - <WppTraceFunction>Trace(LEVEL,FLAGS,MSG,...)</WppTraceFunction> - <WppScanConfigurationData>trace.h</WppScanConfigurationData> - </ClCompile> - <Inf Include=".\SynapticsTouch.inx"> - <Architecture>$(InfArch)</Architecture> - <SpecifyArchitecture>true</SpecifyArchitecture> - <CopyOutput>.\$(IntDir)\SynapticsTouch.inf</CopyOutput> - </Inf> - </ItemGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>SynapticsTouch</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>SynapticsTouch</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>SynapticsTouch</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>SynapticsTouch</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - </ResourceCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(DDK_LIB_PATH)\HidClass.lib</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - </ResourceCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(DDK_LIB_PATH)\HidClass.lib</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - </ResourceCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(DDK_LIB_PATH)\HidClass.lib</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);DRIVER;_WIN32_WINNT=0x602;_WINNT_;_SAMPLE_DESCRIPTOR_</PreprocessorDefinitions> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(DDK_INC_PATH);$(DDK_INC_PATH)\wdm\</AdditionalIncludeDirectories> - </ResourceCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(DDK_LIB_PATH)\HidClass.lib</AdditionalDependencies> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> - <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> - <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/input/hiddigi/SynapticsTouch/SynapticsTouch.vcxproj.Filters b/input/hiddigi/SynapticsTouch/SynapticsTouch.vcxproj.Filters deleted file mode 100644 index 5460e3f9..00000000 --- a/input/hiddigi/SynapticsTouch/SynapticsTouch.vcxproj.Filters +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{934070B2-3325-476F-AEBF-5A5FE4E02C36}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{BEACF89E-6800-49FD-A14A-7B53288D5491}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{ABD7DD59-0820-45CB-9D9A-C88549CE43AE}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{A2EA0C74-0B20-4F74-89F4-67DE9E1A7C98}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="device.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="driver.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="hid.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="idle.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="init.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="power.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="queue.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="registry.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="report.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="resolutions.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="spb.c"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <Inf Include=".\SynapticsTouch.inx"> - <Filter>Driver Files</Filter> - </Inf> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/input/hiddigi/SynapticsTouch/controller.h b/input/hiddigi/SynapticsTouch/controller.h deleted file mode 100644 index c3fdde1f..00000000 --- a/input/hiddigi/SynapticsTouch/controller.h +++ /dev/null @@ -1,203 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - controller.h - - Abstract: - - This module contains touch driver public definitions. - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - -#include <wdm.h> -#include <wdf.h> -#include <hidport.h> -#define RESHUB_USE_HELPER_ROUTINES -#include <reshub.h> -#include <kbdmou.h> -#include "trace.h" -#include "spb.h" - -#define TOUCH_POOL_TAG (ULONG)'cuoT' - -// -// Device descriptions -// - -#define OEM_MAX_TOUCHES 10 - -// -// Constants -// -#define MODE_MOUSE 0x00 -#define MODE_SINGLE_TOUCH 0x01 -#define MODE_MULTI_TOUCH 0x02 - -#define MAX_MOUSE_COORD 0x7FFF -#define MAX_TOUCH_COORD 0x0FFF - -#define MOUSE_LEFT_BUTTON_DOWN 0x0001 -#define MOUSE_LEFT_BUTTON_UP 0x0002 -#define MOUSE_MOVE_TOUCH_ABSOLUTE 0x8000 - -#define FINGER_STATUS 0x01 // finger down -#define RANGE_STATUS 0x02 // in range -#define RANGE_FINGER_STATUS 0x03 // finger down (range + finger) - -#define KEY_DOWN_START (1 << 0) -#define KEY_DOWN_SEARCH (1 << 1) -#define KEY_DOWN_BACK (1 << 2) - -#define REPORTID_MTOUCH 1 -#define REPORTID_MOUSE 3 -#define REPORTID_FEATURE 7 -#define REPORTID_MAX_COUNT 8 -#define REPORTID_CAPKEY 9 - -// -// Type defintions -// - -#pragma warning(push) -#pragma warning(disable:4201) // (nameless struct/union) -#include <pshpack1.h> - -typedef struct _HID_TOUCH_REPORT -{ - union - { - struct - { - UCHAR bStatus; - UCHAR ContactId; - USHORT wXData; - USHORT wYData; - UCHAR bStatus2; - UCHAR ContactId2; - USHORT wXData2; - USHORT wYData2; - UCHAR ActualCount; - } InputReport; - UCHAR RawInput[13]; - }; -} HID_TOUCH_REPORT, *PHID_TOUCH_REPORT; - -typedef struct _HID_MOUSE_REPORT { - union - { - struct - { - UCHAR bButtons; - USHORT wXData; - USHORT wYData; - USHORT wReserved; - }InputReport; - UCHAR RawInput[7]; - }; -} HID_MOUSE_REPORT, *PHID_MOUSE_REPORT; - -typedef struct _HID_KEY_REPORT { - union - { - struct - { - UCHAR bKeys; - UCHAR bReserved; - USHORT wReserved; - }InputReport; - UCHAR RawInput[4]; - }; -} HID_KEY_REPORT, *PHID_KEY_REPORT; - - -typedef struct _HID_FEATURE_REPORT -{ - UCHAR ReportID; - UCHAR InputMode; - UCHAR DeviceIndex; -} HID_FEATURE_REPORT, *PHID_FEATURE_REPORT; - -typedef struct _HID_MAX_COUNT_REPORT -{ - UCHAR ReportID; - UCHAR MaxCount; -}HID_MAX_COUNT_REPORT, *PHID_MAX_COUNT_REPORT; - -typedef struct _HID_INPUT_REPORT -{ - UCHAR ReportID; - union - { - HID_TOUCH_REPORT TouchReport; - HID_MOUSE_REPORT MouseReport; - HID_KEY_REPORT KeyReport; - }; -#ifdef _TIMESTAMP_ - LARGE_INTEGER TimeStamp; -#endif -} HID_INPUT_REPORT, *PHID_INPUT_REPORT; - -#include <poppack.h> -#pragma warning(pop) - -NTSTATUS -TchAllocateContext( - OUT VOID **ControllerContext, - IN WDFDEVICE FxDevice - ); - -NTSTATUS -TchFreeContext( - IN VOID *ControllerContext - ); - -NTSTATUS -TchStartDevice( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext - ); - -NTSTATUS -TchStopDevice( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext - ); - -NTSTATUS -TchStandbyDevice( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext - ); - -NTSTATUS -TchWakeDevice( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext - ); - -NTSTATUS -TchRegistryGetControllerSettings( - IN VOID *ControllerContext, - IN WDFDEVICE FxDevice - ); - -NTSTATUS -TchServiceInterrupts( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext, - IN PHID_INPUT_REPORT HidReport, - IN UCHAR InputMode, - OUT BOOLEAN *ServicingComplete - ); - diff --git a/input/hiddigi/SynapticsTouch/device.c b/input/hiddigi/SynapticsTouch/device.c deleted file mode 100644 index dad83df9..00000000 --- a/input/hiddigi/SynapticsTouch/device.c +++ /dev/null @@ -1,480 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - device.c - - Abstract: - - Code for handling WDF device-specific requests - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "internal.h" -#include "controller.h" -#include "device.h" -#include "spb.h" -#include "idle.h" -#include "device.tmh" - -#ifdef ALLOC_PRAGMA - #pragma alloc_text(PAGE, OnD0Exit) -#endif - -BOOLEAN -OnInterruptIsr( - IN WDFINTERRUPT Interrupt, - IN ULONG MessageID - ) -/*++ - - Routine Description: - - This routine responds to interrupts generated by the - controller. If one is recognized, it queues a DPC for - processing. - - This is a PASSIVE_LEVEL ISR. ACPI should specify - level-triggered interrupts when using Synaptics 3202. - - Arguments: - - Interrupt - a handle to a framework interrupt object - MessageID - message number identifying the device's - hardware interrupt message (if using MSI) - - Return Value: - - TRUE if interrupt recognized. - ---*/ -{ - PDEVICE_EXTENSION devContext; - NTSTATUS status; - WDFREQUEST request; - BOOLEAN servicingComplete; - HID_INPUT_REPORT hidReportFromDriver; - PHID_INPUT_REPORT hidReportRequestBuffer; - size_t hidReportRequestBufferLength; - - UNREFERENCED_PARAMETER(MessageID); - - status = STATUS_SUCCESS; - servicingComplete = FALSE; - devContext = GetDeviceContext(WdfInterruptGetDevice(Interrupt)); - request = NULL; - - - // - // If we're in diagnostic mode, let the diagnostic application handle - // interrupt servicing - // - if (devContext->DiagnosticMode != FALSE) - { - goto exit; - } - - - // - // Service the device interrupt - // - while (servicingComplete == FALSE) - { - // - // Service touch interrupts. Success indicates we have a report - // to complete to Hid. ServicingComplete indicates another report - // is required to continue servicing this interrupt. - // - if (!NT_SUCCESS(TchServiceInterrupts( - devContext->TouchContext, - &devContext->I2CContext, - &hidReportFromDriver, - devContext->InputMode, - &servicingComplete))) - { - // - // hidReportFromDriver was not filled - // - continue; - } - - // - // Complete a HIDClass request if one is available - // - status = WdfIoQueueRetrieveNextRequest( - devContext->PingPongQueue, - &request); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_REPORTING, - "No request pending from HIDClass, ignoring report - %!STATUS!", - status); - - continue; - } - - // - // Validate an output buffer was provided - // - status = WdfRequestRetrieveOutputBuffer( - request, - sizeof(HID_INPUT_REPORT), - &hidReportRequestBuffer, - &hidReportRequestBufferLength); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_VERBOSE, - TRACE_FLAG_SAMPLES, - "Error retrieving HID read request output buffer - %!STATUS!", - status); - } - else - { - // - // Validate the size of the output buffer - // - if (hidReportRequestBufferLength < sizeof(HID_INPUT_REPORT)) - { - status = STATUS_BUFFER_TOO_SMALL; - - Trace( - TRACE_LEVEL_VERBOSE, - TRACE_FLAG_SAMPLES, - "Error HID read request buffer is too small (%I64x bytes) - %!STATUS!", - hidReportRequestBufferLength, - status); - } - else - { - RtlCopyMemory( - hidReportRequestBuffer, - &hidReportFromDriver, - sizeof(HID_INPUT_REPORT)); - - WdfRequestSetInformation(request, sizeof(HID_INPUT_REPORT)); - } - } - - WdfRequestComplete(request, status); - } - -exit: - return TRUE; -} - -NTSTATUS -OnD0Entry( - IN WDFDEVICE Device, - IN WDF_POWER_DEVICE_STATE PreviousState - ) -/*++ - -Routine Description: - - This routine will power on the hardware - -Arguments: - - Device - WDF device to power on - PreviousState - Prior power state - -Return Value: - - NTSTATUS indicating success or failure - -*/ -{ - NTSTATUS status; - PDEVICE_EXTENSION devContext; - - devContext = GetDeviceContext(Device); - - UNREFERENCED_PARAMETER(PreviousState); - - status = TchWakeDevice(devContext->TouchContext, &devContext->I2CContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_POWER, - "Error setting device to D0 - %!STATUS!", - status); - } - - // - // N.B. This RMI chip's IRQ is level-triggered, but cannot be enabled in - // ACPI until passive-level interrupt handling is added to the driver. - // Service chip in case we missed an edge during D3 or boot-up. - // - devContext->ServiceInterruptsAfterD0Entry = TRUE; - - // - // Complete any pending Idle IRPs - // - TchCompleteIdleIrp(devContext); - - return status; -} - -NTSTATUS -OnD0Exit( - IN WDFDEVICE Device, - IN WDF_POWER_DEVICE_STATE TargetState - ) -/*++ - -Routine Description: - - This routine will power down the hardware - -Arguments: - - Device - WDF device to power off - - PreviousState - Prior power state - -Return Value: - - NTSTATUS indicating success or failure - -*/ -{ - NTSTATUS status; - PDEVICE_EXTENSION devContext; - - PAGED_CODE(); - - devContext = GetDeviceContext(Device); - - UNREFERENCED_PARAMETER(TargetState); - - status = TchStandbyDevice(devContext->TouchContext, &devContext->I2CContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_POWER, - "Error exiting D0 - %!STATUS!", - status); - } - - return status; -} - -NTSTATUS -OnPrepareHardware( - IN WDFDEVICE FxDevice, - IN WDFCMRESLIST FxResourcesRaw, - IN WDFCMRESLIST FxResourcesTranslated - ) -/*++ - - Routine Description: - - This routine is called by the PnP manager and supplies thie device instance - with it's SPB resources (CmResourceTypeConnection) needed to find the I2C - driver. - - Arguments: - - FxDevice - a handle to the framework device object - FxResourcesRaw - list of translated hardware resources that - the PnP manager has assigned to the device - FxResourcesTranslated - list of raw hardware resources that - the PnP manager has assigned to the device - - Return Value: - - NTSTATUS indicating sucess or failure - ---*/ -{ - NTSTATUS status; - PCM_PARTIAL_RESOURCE_DESCRIPTOR res; - PDEVICE_EXTENSION devContext; - ULONG resourceCount; - ULONG i; - - UNREFERENCED_PARAMETER(FxResourcesRaw); - - status = STATUS_INSUFFICIENT_RESOURCES; - devContext = GetDeviceContext(FxDevice); - - // - // Get the resouce hub connection ID for our I2C driver - // - resourceCount = WdfCmResourceListGetCount(FxResourcesTranslated); - - for (i=0; i < resourceCount; i++) - { - res = WdfCmResourceListGetDescriptor(FxResourcesTranslated, i); - - if (res->Type == CmResourceTypeConnection && - res->u.Connection.Class == CM_RESOURCE_CONNECTION_CLASS_SERIAL && - res->u.Connection.Type == CM_RESOURCE_CONNECTION_TYPE_SERIAL_I2C) - { - devContext->I2CContext.I2cResHubId.LowPart = - res->u.Connection.IdLowPart; - devContext->I2CContext.I2cResHubId.HighPart = - res->u.Connection.IdHighPart; - - status = STATUS_SUCCESS; - } - } - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error finding CmResourceTypeConnection resource - %!STATUS!", - status); - - goto exit; - } - - // - // Initialize Spb so the driver can issue reads/writes - // - status = SpbTargetInitialize(FxDevice, &devContext->I2CContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error in Spb initialization - %!STATUS!", - status); - - goto exit; - } - - // - // Prepare the hardware for touch scanning - // - status = TchAllocateContext(&devContext->TouchContext, FxDevice); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error allocating touch context - %!STATUS!", - status); - - goto exit; - } - - // - // Fetch controller settings from registry - // - status = TchRegistryGetControllerSettings( - devContext->TouchContext, - devContext->FxDevice); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error retrieving controller settings from registry - %!STATUS!", - status); - - goto exit; - } - - // - // Start the controller - // - status = TchStartDevice(devContext->TouchContext, &devContext->I2CContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error starting touch device - %!STATUS!", - status); - - goto exit; - } - -exit: - - return status; -} - -NTSTATUS -OnReleaseHardware( - IN WDFDEVICE FxDevice, - IN WDFCMRESLIST FxResourcesTranslated - ) -/*++ - - Routine Description: - - This routine cleans up any resources provided. - - Arguments: - - FxDevice - a handle to the framework device object - FxResourcesRaw - list of translated hardware resources that - the PnP manager has assigned to the device - FxResourcesTranslated - list of raw hardware resources that - the PnP manager has assigned to the device - - Return Value: - - NTSTATUS indicating sucesss or failure - ---*/ -{ - NTSTATUS status; - PDEVICE_EXTENSION devContext; - - UNREFERENCED_PARAMETER(FxResourcesTranslated); - - devContext = GetDeviceContext(FxDevice); - - status = TchStopDevice(devContext->TouchContext, &devContext->I2CContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_PNP, - "Error stopping device - %!STATUS!", - status); - } - - status = TchFreeContext(devContext->TouchContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_PNP, - "Error freeing touch context - %!STATUS!", - status); - } - - SpbTargetDeinitialize(FxDevice, &GetDeviceContext(FxDevice)->I2CContext); - - return status; -} - diff --git a/input/hiddigi/SynapticsTouch/device.h b/input/hiddigi/SynapticsTouch/device.h deleted file mode 100644 index c21a409a..00000000 --- a/input/hiddigi/SynapticsTouch/device.h +++ /dev/null @@ -1,32 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - device.h - - Abstract: - - Declarations of WDF device specific entry points - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - - -EVT_WDF_DEVICE_D0_ENTRY OnD0Entry; - -EVT_WDF_DEVICE_D0_EXIT OnD0Exit; - -EVT_WDF_INTERRUPT_ISR OnInterruptIsr; - -EVT_WDF_DEVICE_PREPARE_HARDWARE OnPrepareHardware; - -EVT_WDF_DEVICE_RELEASE_HARDWARE OnReleaseHardware;
\ No newline at end of file diff --git a/input/hiddigi/SynapticsTouch/driver.c b/input/hiddigi/SynapticsTouch/driver.c deleted file mode 100644 index 6812fcb3..00000000 --- a/input/hiddigi/SynapticsTouch/driver.c +++ /dev/null @@ -1,319 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - driver.c - - Abstract: - - Contains driver-specific WDF functions - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "internal.h" -#include "controller.h" -#include "driver.h" -#include "device.h" -#include "hid.h" -#include "queue.h" -#include "driver.tmh" - -#ifdef ALLOC_PRAGMA - #pragma alloc_text(PAGE, OnDeviceAdd) - #pragma alloc_text(PAGE, OnContextCleanup) -#endif - -NTSTATUS -DriverEntry ( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPath - ) -/*++ - -Routine Description: - - Installable driver initialization entry point. - This entry point is called directly by the I/O system. - -Arguments: - - DriverObject - pointer to the driver object - RegistryPath - pointer to a unicode string representing the path, - to driver-specific key in the registry. - -Return Value: - - STATUS_SUCCESS if successful, error code otherwise. - ---*/ -{ - WDF_OBJECT_ATTRIBUTES attributes; - WDF_DRIVER_CONFIG config; - NTSTATUS status; - - // - // Initialize tracing via WPP - // - WPP_INIT_TRACING(DriverObject, RegistryPath); - - // - // Create a framework driver object - // - WDF_DRIVER_CONFIG_INIT(&config, OnDeviceAdd); - config.DriverPoolTag = TOUCH_POOL_TAG; - - WDF_OBJECT_ATTRIBUTES_INIT(&attributes); - attributes.EvtCleanupCallback = OnContextCleanup; - - status = WdfDriverCreate( - DriverObject, - RegistryPath, - &attributes, - &config, - WDF_NO_HANDLE - ); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error creating WDF driver object - %!STATUS!", - status); - - WPP_CLEANUP(DriverObject); - - goto exit; - } - -exit: - - return status; -} - -NTSTATUS -OnDeviceAdd( - IN WDFDRIVER Driver, - IN PWDFDEVICE_INIT DeviceInit - ) -/*++ - -Routine Description: - - OnDeviceAdd is called by the framework in response to AddDevice - call from the PnP manager when a device is found. We create and - initialize a WDF device object to represent the new instance of - an touch device. Per-device objects are also instantiated. - -Arguments: - - Driver - Handle to a framework driver object created in DriverEntry - DeviceInit - Pointer to a framework-allocated WDFDEVICE_INIT structure. - -Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - WDF_OBJECT_ATTRIBUTES attributes; - PDEVICE_EXTENSION devContext; - WDFDEVICE fxDevice; - WDF_INTERRUPT_CONFIG interruptConfig; - WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks; - WDF_IO_QUEUE_CONFIG queueConfig; - NTSTATUS status; - - UNREFERENCED_PARAMETER(Driver); - PAGED_CODE(); - - // - // Relinquish power policy ownership because HIDCLASS acts a power - // policy owner for ther HID stack. - // - WdfDeviceInitSetPowerPolicyOwnership(DeviceInit, FALSE); - - // - // This driver handles D0 Entry and Exit to power on and off the - // controller. It also handles prepare/release hardware so that it - // can acquire and free SPB resources needed to communicate with the - // touch controller. - // - WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks); - - pnpPowerCallbacks.EvtDeviceD0Entry = OnD0Entry; - pnpPowerCallbacks.EvtDeviceD0Exit = OnD0Exit; - pnpPowerCallbacks.EvtDevicePrepareHardware = OnPrepareHardware; - pnpPowerCallbacks.EvtDeviceReleaseHardware = OnReleaseHardware; - - WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks); - - // - // Create a framework device object. This call will in turn create - // a WDM device object, attach to the lower stack, and set the - // appropriate flags and attributes. - // - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, DEVICE_EXTENSION); - - status = WdfDeviceCreate(&DeviceInit, &attributes, &fxDevice); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "WdfDeviceCreate failed - %!STATUS!", - status); - - goto exit; - } - - devContext = GetDeviceContext(fxDevice); - devContext->FxDevice = fxDevice; - devContext->InputMode = MODE_MULTI_TOUCH; - - // - // Create a parallel dispatch queue to handle requests from HID Class - // - WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE( - &queueConfig, - WdfIoQueueDispatchParallel); - - queueConfig.EvtIoInternalDeviceControl = OnInternalDeviceControl; - queueConfig.PowerManaged = WdfFalse; - - status = WdfIoQueueCreate( - fxDevice, - &queueConfig, - WDF_NO_OBJECT_ATTRIBUTES, - &devContext->DefaultQueue); - - if (!NT_SUCCESS (status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error creating WDF default queue - %!STATUS!", - status); - - goto exit; - } - - // - // Register a manual I/O queue for Read Requests. This queue will be used - // for storing HID read requests until touch data is available to - // complete them. - // - WDF_IO_QUEUE_CONFIG_INIT(&queueConfig, WdfIoQueueDispatchManual); - - queueConfig.PowerManaged = WdfFalse; - - status = WdfIoQueueCreate( - fxDevice, - &queueConfig, - WDF_NO_OBJECT_ATTRIBUTES, - &devContext->PingPongQueue); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error creating WDF read request queue - %!STATUS!", - status); - - goto exit; - } - - // - // Register one last manual I/O queue for parking HIDClass's idle power - // requests. This queue stores idle requests until they're cancelled, - // and could be used to complete a wait/wake request. - // - - WDF_IO_QUEUE_CONFIG_INIT(&queueConfig, WdfIoQueueDispatchManual); - - queueConfig.PowerManaged = WdfFalse; - - status = WdfIoQueueCreate( - fxDevice, - &queueConfig, - WDF_NO_OBJECT_ATTRIBUTES, - &devContext->IdleQueue - ); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error creating WDF idle request queue - %!STATUS!", - status); - - goto exit; - } - - // - // Create an interrupt object for hardware notifications - // - WDF_INTERRUPT_CONFIG_INIT( - &interruptConfig, - OnInterruptIsr, - NULL); - interruptConfig.PassiveHandling = TRUE; - - status = WdfInterruptCreate( - fxDevice, - &interruptConfig, - WDF_NO_OBJECT_ATTRIBUTES, - &devContext->InterruptObject); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error creating WDF interrupt object - %!STATUS!", - status); - - goto exit; - } - -exit: - - return status; -} - -VOID -OnContextCleanup( - IN WDFOBJECT Driver - ) -/*++ -Routine Description: - - Free resources allocated in DriverEntry that are not automatically - cleaned up framework. - -Arguments: - - Driver - handle to a WDF Driver object. - -Return Value: - - VOID. - ---*/ -{ - PAGED_CODE(); - - WPP_CLEANUP(WdfDriverWdmGetDriverObject(Driver)); -} -
\ No newline at end of file diff --git a/input/hiddigi/SynapticsTouch/driver.h b/input/hiddigi/SynapticsTouch/driver.h deleted file mode 100644 index 66036d93..00000000 --- a/input/hiddigi/SynapticsTouch/driver.h +++ /dev/null @@ -1,29 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - driver.h - - Abstract: - - Contains WDF driver-specific function declarations - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - - -DRIVER_INITIALIZE DriverEntry; - -EVT_WDF_DEVICE_CONTEXT_CLEANUP OnContextCleanup; - -EVT_WDF_DRIVER_DEVICE_ADD OnDeviceAdd; - diff --git a/input/hiddigi/SynapticsTouch/hid.c b/input/hiddigi/SynapticsTouch/hid.c deleted file mode 100644 index 233b6e23..00000000 --- a/input/hiddigi/SynapticsTouch/hid.c +++ /dev/null @@ -1,769 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - hid.c - - Abstract: - - Code for handling HID related requests - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "internal.h" -#include "controller.h" -#include "hid.h" -#include "hid.tmh" - - -// -// HID Report Descriptor for a touch device -// - -#ifndef _SAMPLE_DESCRIPTOR_ -#error This HID descriptor only works for a touch screen with resolution = 768 x 1280 and dimensions = 2.32" x 3.82" -#endif - -const UCHAR gReportDescriptor[] = { - 0x05, 0x0d, // USAGE_PAGE (Digitizers) - 0x09, 0x04, // USAGE (Touch Screen) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORTID_MTOUCH, // REPORT_ID (Touch) - 0x09, 0x22, // USAGE (Finger) - 0xa1, 0x02, // COLLECTION (Logical) - 0x09, 0x42, // USAGE (Tip Switch) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x09, 0x32, // USAGE (In Range) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x95, 0x06, // REPORT_COUNT (6) - 0x81, 0x03, // INPUT (Cnst,Ary,Abs) - 0x75, 0x08, // REPORT_SIZE (8) - 0x09, 0x51, // USAGE (Contact Identifier) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x05, 0x01, // USAGE_PAGE (Generic Desk.. - 0x26, 0x00, 0x03, // LOGICAL_MAXIMUM (768) NOTE: ADJUST LOGICAL MAXIMUM FOR X BASED ON TOUCH SCREEN RESOLUTION! - 0x75, 0x10, // REPORT_SIZE (16) - 0x55, 0x0e, // UNIT_EXPONENT (-2) - 0x65, 0x13, // UNIT (Inch,EngLinear) - 0x09, 0x30, // USAGE (X) - 0x35, 0x00, // PHYSICAL_MINIMUM (0) - 0x46, 0xe8, 0x00, // PHYSICAL_MAXIMUM (232) NOTE: ADJUST PHYSICAL MAXIMUM FOR X BASED ON TOUCH SCREEN DIMENSION (100ths of an inch)! - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x46, 0x7e, 0x01, // PHYSICAL_MAXIMUM (382) NOTE: ADJUST PHYSICAL MAXIMUM FOR Y BASED ON TOUCH SCREEN DIMENSION (100ths of an inch)! - 0x26, 0x00, 0x05, // LOGICAL_MAXIMUM (1280) NOTE: ADJUST LOGICAL MAXIMUM FOR Y BASED ON TOUCH SCREEN RESOLUTION! - 0x09, 0x31, // USAGE (Y) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0xc0, // END_COLLECTION - 0xa1, 0x02, // COLLECTION (Logical) - 0x05, 0x0d, // USAGE_PAGE (Digitizers) - 0x09, 0x42, // USAGE (Tip Switch) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x09, 0x32, // USAGE (In Range) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x95, 0x06, // REPORT_COUNT (6) - 0x81, 0x03, // INPUT (Cnst,Ary,Abs) - 0x75, 0x08, // REPORT_SIZE (8) - 0x09, 0x51, // USAGE (Contact Identifier) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x05, 0x01, // USAGE_PAGE (Generic Desk.. - 0x26, 0x00, 0x03, // LOGICAL_MAXIMUM (768) NOTE: ADJUST LOGICAL MAXIMUM FOR X BASED ON TOUCH SCREEN RESOLUTION! - 0x75, 0x10, // REPORT_SIZE (16) - 0x55, 0x0e, // UNIT_EXPONENT (-2) - 0x65, 0x13, // UNIT (Inch,EngLinear) - 0x09, 0x30, // USAGE (X) - 0x35, 0x00, // PHYSICAL_MINIMUM (0) - 0x46, 0xe8, 0x00, // PHYSICAL_MAXIMUM (232) NOTE: ADJUST PHYSICAL MAXIMUM FOR X BASED ON TOUCH SCREEN DIMENSION (100ths of an inch)! - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x46, 0x7e, 0x01, // PHYSICAL_MAXIMUM (382) NOTE: ADJUST PHYSICAL MAXIMUM FOR Y BASED ON TOUCH SCREEN DIMENSION (100ths of an inch)! - 0x26, 0x00, 0x05, // LOGICAL_MAXIMUM (1280) NOTE: ADJUST LOGICAL MAXIMUM FOR Y BASED ON TOUCH SCREEN RESOLUTION! - 0x09, 0x31, // USAGE (Y) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0xc0, // END_COLLECTION - 0x05, 0x0d, // USAGE_PAGE (Digitizers) - 0x09, 0x54, // USAGE (Actual count) - 0x95, 0x01, // REPORT_COUNT (1) - 0x75, 0x08, // REPORT_SIZE (8) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x85, REPORTID_MAX_COUNT, // REPORT_ID (Feature) - 0x09, 0x55, // USAGE(Maximum Count) - 0x25, 0x02, // LOGICAL_MAXIMUM (2) - 0xb1, 0x02, // FEATURE (Data,Var,Abs) - 0xc0, // END_COLLECTION - 0x09, 0x0E, // USAGE (Configuration) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORTID_FEATURE, // REPORT_ID (Feature) - 0x09, 0x22, // USAGE (Finger) - 0xa1, 0x00, // COLLECTION (physical) - 0x09, 0x52, // USAGE (Input Mode) - 0x09, 0x53, // USAGE (Device Index - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x0a, // LOGICAL_MAXIMUM (10) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x02, // REPORT_COUNT (2) - 0xb1, 0x02, // FEATURE (Data,Var,Abs) - 0xc0, // END_COLLECTION - 0xc0, // END_COLLECTION - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) -#ifdef HID_MOUSE_PATH_SUPPORT - 0x09, 0x02, // USAGE (Mouse) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORTID_MOUSE, // REPORT_ID (Mouse) - 0x09, 0x01, // USAGE (Pointer) - 0xa1, 0x00, // COLLECTION (Physical) - 0x05, 0x09, // USAGE_PAGE (Button) - 0x19, 0x01, // USAGE_MINIMUM (Button 1) - 0x29, 0x02, // USAGE_MAXIMUM (Button 2) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - 0x95, 0x02, // REPORT_COUNT (2) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x95, 0x06, // REPORT_COUNT (6) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x30, // USAGE (X) - 0x09, 0x31, // USAGE (Y) - 0x75, 0x10, // REPORT_SIZE (16) - 0x95, 0x02, // REPORT_COUNT (2) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x26, 0xff, 0x7f, // LOGICAL_MAXIMUM (32767) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0xc0, // END_COLLECTION - 0xc0, // END_COLLECTION -#endif - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0xEE, // USAGE (HID_USAGE_KEYBOARD_MOBILE) - 0xa1, 0x01, // COLLECTION (Application) - 0x85, REPORTID_CAPKEY, // REPORT_ID - 0x05, 0x07, // USAGE_PAGE (Key Codes) - 0x09, 0x3B, // USAGE(F2 Key) - Start/Home - 0x09, 0x3C, // USAGE(F3 Key) - Search - 0x09, 0x29, // USAGE(Esc Key) - Back - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - 0x95, 0x03, // REPORT_COUNT (3) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x95, 0x1d, // REPORT_COUNT (29) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - 0xc0, // END_COLLECTION -}; -const ULONG gdwcbReportDescriptor = sizeof(gReportDescriptor); - -// -// HID Descriptor for a touch device -// -const HID_DESCRIPTOR gHidDescriptor = -{ - sizeof(HID_DESCRIPTOR), //bLength - HID_HID_DESCRIPTOR_TYPE, //bDescriptorType - HID_REVISION, //bcdHID - 0, //bCountry - not localized - 1, //bNumDescriptors - { //DescriptorList[0] - HID_REPORT_DESCRIPTOR_TYPE, //bReportType - sizeof(gReportDescriptor) //wReportLength - } -}; - -NTSTATUS -TchReadReport( - IN WDFDEVICE Device, - IN WDFREQUEST Request, - OUT BOOLEAN *Pending - ) -/*++ - -Routine Description: - - Handles read requests from HIDCLASS, by forwarding the request. - -Arguments: - - Device - Handle to WDF Device Object - - Request - Handle to request object - - Pending - flag to monitor if the request was sent down the stack - -Return Value: - - On success, the function returns STATUS_SUCCESS - On failure it passes the relevant error code to the caller. - ---*/ -{ - PDEVICE_EXTENSION devContext; - NTSTATUS status; - - devContext = GetDeviceContext(Device); - - status = WdfRequestForwardToIoQueue( - Request, - devContext->PingPongQueue); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Failed to forward HID request to I/O queue - %!STATUS!", - status); - - goto exit; - } - - if (NULL != Pending) - { - *Pending = TRUE; - } - - // - // Service any interrupt that may have asserted while the framework had - // interrupts disabled, or occurred before a read request was queued. - // - if (devContext->ServiceInterruptsAfterD0Entry == TRUE) - { - HID_INPUT_REPORT hidReport; - BOOLEAN servicingComplete = FALSE; - - while (servicingComplete == FALSE) - { - TchServiceInterrupts( - devContext->TouchContext, - &devContext->I2CContext, - &hidReport, - devContext->InputMode, - &servicingComplete); - } - - devContext->ServiceInterruptsAfterD0Entry = FALSE; - } - -exit: - - return status; -} - -NTSTATUS -TchGetString( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ) -/*++ - -Routine Description: - - Returns string requested by the HIDCLASS driver - -Arguments: - - Device - Handle to WDF Device Object - - Request - Handle to request object - -Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - PIRP irp; - PIO_STACK_LOCATION irpSp; - ULONG_PTR lenId; - NTSTATUS status; - PWSTR strId; - - UNREFERENCED_PARAMETER(Device); - - status = STATUS_SUCCESS; - - irp = WdfRequestWdmGetIrp(Request); - irpSp = IoGetCurrentIrpStackLocation(irp); - switch ((ULONG_PTR)irpSp->Parameters.DeviceIoControl.Type3InputBuffer & - 0xffff) - { - case HID_STRING_ID_IMANUFACTURER: - strId = gpwstrManufacturerID; - break; - - case HID_STRING_ID_IPRODUCT: - strId = gpwstrProductID; - break; - - case HID_STRING_ID_ISERIALNUMBER: - strId = gpwstrSerialNumber; - break; - - default: - strId = NULL; - break; - } - - lenId = strId ? (wcslen(strId)*sizeof(WCHAR) + sizeof(UNICODE_NULL)) : 0; - if (strId == NULL) - { - status = STATUS_INVALID_PARAMETER; - } - else if (irpSp->Parameters.DeviceIoControl.OutputBufferLength < lenId) - { - status = STATUS_BUFFER_TOO_SMALL; - } - else - { - RtlCopyMemory(irp->UserBuffer, strId, lenId); - irp->IoStatus.Information = lenId; - } - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Error getting device string - %!STATUS!", - status); - } - - return status; -} - -NTSTATUS -TchGetHidDescriptor( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ) -/*++ - -Routine Description: - - Finds the HID descriptor and copies it into the buffer provided by the - Request. - -Arguments: - - Device - Handle to WDF Device Object - - Request - Handle to request object - -Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - WDFMEMORY memory; - NTSTATUS status; - - UNREFERENCED_PARAMETER(Device); - - // - // This IOCTL is METHOD_NEITHER so WdfRequestRetrieveOutputMemory - // will correctly retrieve buffer from Irp->UserBuffer. - // Remember that HIDCLASS provides the buffer in the Irp->UserBuffer - // field irrespective of the ioctl buffer type. However, framework is very - // strict about type checking. You cannot get Irp->UserBuffer by using - // WdfRequestRetrieveOutputMemory if the ioctl is not a METHOD_NEITHER - // internal ioctl. - // - status = WdfRequestRetrieveOutputMemory(Request, &memory); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Error getting HID descriptor request memory - %!STATUS!", - status); - goto exit; - } - - // - // Use hardcoded global HID Descriptor - // - status = WdfMemoryCopyFromBuffer( - memory, - 0, - (PUCHAR) &gHidDescriptor, - sizeof(gHidDescriptor)); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Error copying HID descriptor to request memory - %!STATUS!", - status); - goto exit; - } - - // - // Report how many bytes were copied - // - WdfRequestSetInformation(Request, sizeof(gHidDescriptor)); - -exit: - - return status; -} - -NTSTATUS -TchGetReportDescriptor( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ) -/*++ - -Routine Description: - - Finds the report descriptor and copies it into the buffer provided by the - Request. - -Arguments: - - Device - Handle to WDF Device Object - - Request - Handle to request object - -Return Value: - - NT status code. - success - STATUS_SUCCESS - failure: - STATUS_INVALID_PARAMETER - An invalid parameter was detected. - ---*/ -{ - WDFMEMORY memory; - NTSTATUS status; - - UNREFERENCED_PARAMETER(Device); - - // - // This IOCTL is METHOD_NEITHER so WdfRequestRetrieveOutputMemory - // will correctly retrieve buffer from Irp->UserBuffer. - // Remember that HIDCLASS provides the buffer in the Irp->UserBuffer - // field irrespective of the ioctl buffer type. However, framework is very - // strict about type checking. You cannot get Irp->UserBuffer by using - // WdfRequestRetrieveOutputMemory if the ioctl is not a METHOD_NEITHER - // internal ioctl. - // - status = WdfRequestRetrieveOutputMemory(Request, &memory); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Error getting HID report descriptor request memory - %!STATUS!", - status); - goto exit; - } - - // - // Use hardcoded Report descriptor - // - status = WdfMemoryCopyFromBuffer( - memory, - 0, - (PUCHAR) gReportDescriptor, - gdwcbReportDescriptor); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Error copying HID report descriptor to request memory - %!STATUS!", - status); - goto exit; - } - - // - // Report how many bytes were copied - // - WdfRequestSetInformation(Request, gdwcbReportDescriptor); - -exit: - - return status; -} - -NTSTATUS -TchGetDeviceAttributes( - IN WDFREQUEST Request - ) -/*++ - -Routine Description: - - Fill in the given struct _HID_DEVICE_ATTRIBUTES - -Arguments: - - Request - Pointer to Request object. - -Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - PHID_DEVICE_ATTRIBUTES deviceAttributes; - NTSTATUS status; - - // - // This IOCTL is METHOD_NEITHER so WdfRequestRetrieveOutputMemory - // will correctly retrieve buffer from Irp->UserBuffer. - // Remember that HIDCLASS provides the buffer in the Irp->UserBuffer - // field irrespective of the ioctl buffer type. However, framework is very - // strict about type checking. You cannot get Irp->UserBuffer by using - // WdfRequestRetrieveOutputMemory if the ioctl is not a METHOD_NEITHER - // internal ioctl. - // - status = WdfRequestRetrieveOutputBuffer( - Request, - sizeof (HID_DEVICE_ATTRIBUTES), - &deviceAttributes, - NULL); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Error retrieving device attribute output buffer - %!STATUS!", - status); - goto exit; - } - - deviceAttributes->Size = sizeof (HID_DEVICE_ATTRIBUTES); - deviceAttributes->VendorID = gOEMVendorID; - deviceAttributes->ProductID = gOEMProductID; - deviceAttributes->VersionNumber = gOEMVersionID; - - // - // Report how many bytes were copied - // - WdfRequestSetInformation(Request, sizeof (HID_DEVICE_ATTRIBUTES)); - -exit: - - return status; -} - -NTSTATUS -TchSetFeatureReport( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ) -/*++ - -Routine Description: - - Emulates setting a HID Feature report - -Arguments: - - Device - Framework device object - Request - Framework request object - -Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - PDEVICE_EXTENSION devContext; - PHID_XFER_PACKET featurePacket; - WDF_REQUEST_PARAMETERS params; - NTSTATUS status; - - devContext = GetDeviceContext(Device); - status = STATUS_SUCCESS; - - // - // Validate Request Parameters - // - - WDF_REQUEST_PARAMETERS_INIT(¶ms); - WdfRequestGetParameters(Request, ¶ms); - - if (params.Parameters.DeviceIoControl.InputBufferLength < - sizeof(HID_XFER_PACKET)) - { - status = STATUS_BUFFER_TOO_SMALL; - goto exit; - } - - featurePacket = - (PHID_XFER_PACKET) WdfRequestWdmGetIrp(Request)->UserBuffer; - - if (featurePacket == NULL) - { - status = STATUS_INVALID_DEVICE_REQUEST; - goto exit; - } - - // - // Process Request - // - - switch (*(PUCHAR)featurePacket->reportBuffer) - { - case REPORTID_FEATURE: - { - PHID_FEATURE_REPORT inputModeReport = - (PHID_FEATURE_REPORT) featurePacket->reportBuffer; - - if (featurePacket->reportBufferLen < sizeof(HID_FEATURE_REPORT)) - { - status = STATUS_BUFFER_TOO_SMALL; - goto exit; - } - - if ((inputModeReport->InputMode == MODE_MOUSE) || - (inputModeReport->InputMode == MODE_MULTI_TOUCH)) - { - devContext->InputMode = inputModeReport->InputMode; - } - else - { - status = STATUS_INVALID_PARAMETER; - goto exit; - } - - break; - } - - default: - { - status = STATUS_INVALID_PARAMETER; - goto exit; - } - } - -exit: - - return status; -} - -NTSTATUS -TchGetFeatureReport( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ) -/*++ - -Routine Description: - - Emulates retrieval of a HID Feature report - -Arguments: - - Device - Framework device object - Request - Framework request object - -Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - PDEVICE_EXTENSION devContext; - PHID_XFER_PACKET featurePacket; - WDF_REQUEST_PARAMETERS params; - NTSTATUS status; - - devContext = GetDeviceContext(Device); - status = STATUS_SUCCESS; - - // - // Validate Request Parameters - // - - WDF_REQUEST_PARAMETERS_INIT(¶ms); - WdfRequestGetParameters(Request, ¶ms); - - if (params.Parameters.DeviceIoControl.OutputBufferLength < - sizeof(HID_XFER_PACKET)) - { - status = STATUS_BUFFER_TOO_SMALL; - goto exit; - } - - featurePacket = - (PHID_XFER_PACKET) WdfRequestWdmGetIrp(Request)->UserBuffer; - - if (featurePacket == NULL) - { - status = STATUS_INVALID_DEVICE_REQUEST; - goto exit; - } - - // - // Process Request - // - - switch (*(PUCHAR)featurePacket->reportBuffer) - { - case REPORTID_FEATURE: - { - PHID_FEATURE_REPORT inputModeReport = - (PHID_FEATURE_REPORT) featurePacket->reportBuffer; - - if (featurePacket->reportBufferLen < sizeof(HID_FEATURE_REPORT)) - { - status = STATUS_BUFFER_TOO_SMALL; - goto exit; - } - - inputModeReport->InputMode = devContext->InputMode; - - break; - } - - case REPORTID_MAX_COUNT: - { - PHID_MAX_COUNT_REPORT maxCountReport = - (PHID_MAX_COUNT_REPORT) featurePacket->reportBuffer; - - if (featurePacket->reportBufferLen < sizeof(HID_MAX_COUNT_REPORT)) - { - status = STATUS_BUFFER_TOO_SMALL; - goto exit; - } - - maxCountReport->MaxCount = OEM_MAX_TOUCHES; - - break; - } - - default: - { - status = STATUS_INVALID_PARAMETER; - goto exit; - } - } - -exit: - - return status; -} diff --git a/input/hiddigi/SynapticsTouch/hid.h b/input/hiddigi/SynapticsTouch/hid.h deleted file mode 100644 index 1f0e7912..00000000 --- a/input/hiddigi/SynapticsTouch/hid.h +++ /dev/null @@ -1,85 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - hid.h - - Abstract: - - HID related function declarations, types, and defines - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - -// -// Global Data Declarations -// -extern const PWSTR gpwstrManufacturerID; -extern const PWSTR gpwstrProductID; -extern const PWSTR gpwstrSerialNumber; -extern const USHORT gOEMVendorID; -extern const USHORT gOEMProductID; -extern const USHORT gOEMVersionID; - -// -// Function prototypes -// - -NTSTATUS -TchGetDeviceAttributes( - IN WDFREQUEST Request - ); - -NTSTATUS -TchGetFeatureReport( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ); - -NTSTATUS -TchGetHidDescriptor( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ); - -NTSTATUS -TchGetReportDescriptor( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ); - -NTSTATUS -TchGetString( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ); - -NTSTATUS -TchProcessIdleRequest( - IN WDFDEVICE Device, - IN WDFREQUEST Request, - OUT BOOLEAN *Pending - ); - -NTSTATUS -TchSetFeatureReport( - IN WDFDEVICE Device, - IN WDFREQUEST Request - ); - -NTSTATUS -TchReadReport( - IN WDFDEVICE Device, - IN WDFREQUEST Request, - OUT BOOLEAN *Pending - ); - diff --git a/input/hiddigi/SynapticsTouch/idle.c b/input/hiddigi/SynapticsTouch/idle.c deleted file mode 100644 index d15b0b98..00000000 --- a/input/hiddigi/SynapticsTouch/idle.c +++ /dev/null @@ -1,328 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - idle.c - - Abstract: - - This file contains the declarations for Power Idle specific callbacks - and function definitions - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "internal.h" -#include "controller.h" -#include "idle.h" -#include "idle.tmh" - -NTSTATUS -TchProcessIdleRequest( - IN WDFDEVICE Device, - IN WDFREQUEST Request, - OUT BOOLEAN *Pending - ) -/*++ - -Routine Description: - - Handles HIDClass's idle notification request. - - This request is provided to a HID miniport, and provides a callback - routine typically used by HID miniports to self-manage power. - - The callback routine is invoked by the miniport to indicate that all - peripherals are idle, and in response the HID class driver will: - 1) Queue a wait/wake IRP to the device, and - 2) Set the device to D3 - - In the case of this touch miniport, we are using the HID class driver's - enhanced power management functionality, whereby invoking the callback - results in an immediate exit from D0, powering off touch. - - The Request will be completed when either HIDCLASS cancels it or - there is a device wake signal that will cause us to complete it. - -Arguments: - - Device - Handle to WDF Device Object - - Request - Handle to request object - - Pending - flag to monitor if the request was sent down the stack - -Return Value: - - On success, the function returns STATUS_SUCCESS - On failure it passes the relevant error code to the caller. - ---*/ -{ - PDEVICE_EXTENSION devContext; - PHID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO idleCallbackInfo; - PIRP irp; - PIO_STACK_LOCATION irpSp; - NTSTATUS status; - - devContext = GetDeviceContext(Device); - - NT_ASSERT(Pending != NULL); - *Pending = FALSE; - - // - // Retrieve request parameters and validate - // - irp = WdfRequestWdmGetIrp(Request); - irpSp = IoGetCurrentIrpStackLocation(irp); - - if (irpSp->Parameters.DeviceIoControl.InputBufferLength < - sizeof(HID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO)) - { - status = STATUS_INVALID_BUFFER_SIZE; - - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Error: Input buffer is too small to process idle request - %!STATUS!", - status); - - goto exit; - } - - // - // Grab the callback - // - idleCallbackInfo = (PHID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO) - irpSp->Parameters.DeviceIoControl.Type3InputBuffer; - - NT_ASSERT(idleCallbackInfo != NULL); - - if (idleCallbackInfo == NULL || idleCallbackInfo->IdleCallback == NULL) - { - status = STATUS_NO_CALLBACK_ACTIVE; - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Error: Idle Notification request %p has no idle callback info - %!STATUS!", - Request, - status); - goto exit; - } - - { - // - // Create a workitem for the idle callback - // - WDF_OBJECT_ATTRIBUTES workItemAttributes; - WDF_WORKITEM_CONFIG workitemConfig; - WDFWORKITEM idleWorkItem; - PIDLE_WORKITEM_CONTEXT idleWorkItemContext; - - WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&workItemAttributes, IDLE_WORKITEM_CONTEXT); - workItemAttributes.ParentObject = devContext->FxDevice; - - WDF_WORKITEM_CONFIG_INIT(&workitemConfig, TchIdleIrpWorkitem); - - status = WdfWorkItemCreate( - &workitemConfig, - &workItemAttributes, - &idleWorkItem - ); - - if (!NT_SUCCESS(status)) { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_HID, - "Error creating creating idle work item - %!STATUS!", - status); - goto exit; - } - - // - // Set the workitem context - // - idleWorkItemContext = GetWorkItemContext(idleWorkItem); - idleWorkItemContext->FxDevice = devContext->FxDevice; - idleWorkItemContext->FxRequest = Request; - - // - // Enqueue a workitem for the idle callback - // - WdfWorkItemEnqueue(idleWorkItem); - - // - // Mark the request as pending so that - // we can complete it when we come out of idle - // - *Pending = TRUE; - } - -exit: - - return status; -} - -VOID -TchIdleIrpWorkitem( - IN WDFWORKITEM IdleWorkItem - ) -/*++ - -Routine Description: - - This is a workitem routine that TchProcessIdleRequest queues when - handling the HIDClass's idle notification IRP, so the idle callback can be made in - a different thread context, instead of the Idle Irp's dispatch call. - -Arguments: - - IdleWorkItem - Handle to a WDF workitem object - -Return Value: - - VOID - ---*/ -{ - NTSTATUS status; - PIDLE_WORKITEM_CONTEXT idleWorkItemContext; - PDEVICE_EXTENSION deviceContext; - PHID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO idleCallbackInfo; - - idleWorkItemContext = GetWorkItemContext(IdleWorkItem); - NT_ASSERT(idleWorkItemContext != NULL); - - deviceContext = GetDeviceContext(idleWorkItemContext->FxDevice); - NT_ASSERT(deviceContext != NULL); - - // - // Get the idle callback info from the workitem context - // - idleCallbackInfo = (PHID_SUBMIT_IDLE_NOTIFICATION_CALLBACK_INFO) - IoGetCurrentIrpStackLocation(WdfRequestWdmGetIrp(idleWorkItemContext->FxRequest))->\ - Parameters.DeviceIoControl.Type3InputBuffer; - - // - // idleCallbackInfo is validated already, so invoke idle callback - // - idleCallbackInfo->IdleCallback(idleCallbackInfo->IdleContext); - - // - // Park this request in our IdleQueue and mark it as pending - // This way if the IRP was cancelled, WDF will cancel it for us - // - status = WdfRequestForwardToIoQueue( - idleWorkItemContext->FxRequest, - deviceContext->IdleQueue); - - if (!NT_SUCCESS(status)) - { - // - // IdleQueue is a manual-dispatch, non-power-managed queue. This should - // *never* fail. - // - - NT_ASSERTMSG("WdfRequestForwardToIoQueue to IdleQueue failed!", FALSE); - - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_IDLE, - "Error forwarding idle notification Request:0x%p to IdleQueue:0x%p - %!STATUS!", - idleWorkItemContext->FxRequest, - deviceContext->IdleQueue, - status); - - // - // Complete the request if we couldnt forward to the Idle Queue - // - WdfRequestComplete(idleWorkItemContext->FxRequest, status); - } - else - { - Trace( - TRACE_LEVEL_INFORMATION, - TRACE_FLAG_IDLE, - "Forwarded idle notification Request:0x%p to IdleQueue:0x%p - %!STATUS!", - idleWorkItemContext->FxRequest, - deviceContext->IdleQueue, - status); - } - - // - // Delete the workitem since we're done with it - // - WdfObjectDelete(IdleWorkItem); - - return; -} - - -VOID -TchCompleteIdleIrp( - IN PDEVICE_EXTENSION FxDeviceContext - ) -/*++ - -Routine Description: - - This is invoked when we enter D0. - We simply complete the Idle Irp if it hasn't been cancelled already. - -Arguments: - - FxDeviceContext - Pointer to Device Context for the device - -Return Value: - - - ---*/ -{ - NTSTATUS status; - WDFREQUEST request = NULL; - - // - // Lets try to retrieve the Idle IRP from the Idle queue - // - status = WdfIoQueueRetrieveNextRequest( - FxDeviceContext->IdleQueue, - &request); - - // - // We did not find the Idle IRP, maybe it was cancelled - // - if (!NT_SUCCESS(status) || (request == NULL)) - { - Trace( - TRACE_LEVEL_WARNING, - TRACE_FLAG_IDLE, - "Error finding idle notification request in IdleQueue:0x%p - %!STATUS!", - FxDeviceContext->IdleQueue, - status); - } - else - { - // - // Complete the Idle IRP - // - WdfRequestComplete(request, status); - - Trace( - TRACE_LEVEL_INFORMATION, - TRACE_FLAG_IDLE, - "Completed idle notification Request:0x%p from IdleQueue:0x%p - %!STATUS!", - request, - FxDeviceContext->IdleQueue, - status); - } - - return; -}
\ No newline at end of file diff --git a/input/hiddigi/SynapticsTouch/idle.h b/input/hiddigi/SynapticsTouch/idle.h deleted file mode 100644 index 1539f88c..00000000 --- a/input/hiddigi/SynapticsTouch/idle.h +++ /dev/null @@ -1,54 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - idle.c - - Abstract: - - This file contains the declarations for Power Idle specific callbacks - and function declarations - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - - -// -// Power Idle Workitem context -// -typedef struct _IDLE_WORKITEM_CONTEXT -{ - // Handle to a WDF device object - WDFDEVICE FxDevice; - - // Handle to a WDF request object - WDFREQUEST FxRequest; - -} IDLE_WORKITEM_CONTEXT, *PIDLE_WORKITEM_CONTEXT; - -WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(IDLE_WORKITEM_CONTEXT, GetWorkItemContext) - -NTSTATUS -TchProcessIdleRequest( - IN WDFDEVICE Device, - IN WDFREQUEST Request, - OUT BOOLEAN *Pending - ); - -VOID -TchCompleteIdleIrp( - IN PDEVICE_EXTENSION FxDeviceContext - ); - -EVT_WDF_WORKITEM TchIdleIrpWorkitem; - - diff --git a/input/hiddigi/SynapticsTouch/init.c b/input/hiddigi/SynapticsTouch/init.c deleted file mode 100644 index 9c4aa225..00000000 --- a/input/hiddigi/SynapticsTouch/init.c +++ /dev/null @@ -1,1168 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - init.c - - Abstract: - - Contains Synaptics initialization code - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "rmiinternal.h" -#include "spb.h" -#include "init.tmh" - - -#pragma warning(push) -#pragma warning(disable:4242) // Conversion, possible loss of data - -// -// The logical values come from the registry and are hence DWORDs but the -// physical registers are only 8 bits wide so we use the lower 8 bits of the -// logical value. -// -#define LOGICAL_TO_PHYSICAL(LOGICAL_VALUE) ((LOGICAL_VALUE) & 0xff) - - -NTSTATUS -RmiChangePage( - IN RMI4_CONTROLLER_CONTEXT* ControllerContext, - IN SPB_CONTEXT* SpbContext, - IN int DesiredPage - ) -/*++ - - Routine Description: - - This utility function changes the current register address page. - - Arguments: - - ControllerContext - A pointer to the current touch controller context - SpbContext - A pointer to the current i2c context - DesiredPage - The page the caller expects to be mapped in - - Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - BYTE page; - NTSTATUS status; - - // - // If we're on this page already return success - // - if (ControllerContext->CurrentPage == DesiredPage) - { - status = STATUS_SUCCESS; - } - else - { - page = (BYTE) DesiredPage; - - status = SpbWriteDataSynchronously( - SpbContext, - RMI4_PAGE_SELECT_ADDRESS, - &page, - sizeof(BYTE)); - - if (NT_SUCCESS(status)) - { - ControllerContext->CurrentPage = DesiredPage; - } - } - - return status; -} - -int -RmiGetFunctionIndex( - IN RMI4_FUNCTION_DESCRIPTOR* FunctionDescriptors, - IN int FunctionCount, - IN int FunctionDesired - ) -/*++ - - Routine Description: - - Returns the descriptor table index that corresponds to the - desired RMI function. - - Arguments: - - FunctionDescriptors - A pointer to the touch controllers - full list of function descriptors - - FunctionCount - The count of function descriptors contained - in the above FunctionDescriptors list - - FunctionDesired - The RMI function number (note they are always - in hexadecimal the RMI4 specification) - - Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - UCHAR i; - - for (i=0; i < FunctionCount; i++) - { - // - // Break if we found the index - // - if (FunctionDescriptors[i].Number == FunctionDesired) - { - break; - } - } - - // - // Return the count if the index wasn't found - // - return i; -} - -NTSTATUS -RmiGetFirmwareVersion( - IN RMI4_CONTROLLER_CONTEXT *ControllerContext, - IN SPB_CONTEXT *SpbContext - ) -/*++ - - Routine Description: - - This function queries the firmware version of the current chip for - debugging purposes. - - Arguments: - - ControllerContext - A pointer to the current touch controller context - SpbContext - A pointer to the current i2c context - - Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - int index; - NTSTATUS status; - - // - // Find RMI device control function and configure it - // - index = RmiGetFunctionIndex( - ControllerContext->Descriptors, - ControllerContext->FunctionCount, - RMI4_F01_RMI_DEVICE_CONTROL); - - if (index == ControllerContext->FunctionCount) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Unexpected - RMI Function 01 missing"); - - status = STATUS_INVALID_DEVICE_STATE; - goto exit; - } - - status = RmiChangePage( - ControllerContext, - SpbContext, - ControllerContext->FunctionOnPage[index]); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not change register page"); - - goto exit; - } - - // - // Store all F01 query registers, which contain the product ID - // - // TODO: Fix transfer size when SPB can support larger I2C - // transactions - // - status = SpbReadDataSynchronously( - SpbContext, - ControllerContext->Descriptors[index].QueryBase, - &ControllerContext->F01QueryRegisters, - sizeof(BYTE) * FIELD_OFFSET(RMI4_F01_QUERY_REGISTERS, ProductID10)); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error reading RMI F01 Query registers - %!STATUS!", - status); - - goto exit; - } - -exit: - - return status; -} - -VOID -RmiConvertF01ToPhysical( - IN RMI4_F01_CTRL_REGISTERS_LOGICAL* Logical, - IN RMI4_F01_CTRL_REGISTERS* Physical - ) -/*++ - - Routine Description: - - Registry configuration values for F01 must be specified as - 4-byte REG_DWORD values logically, however the chip interprets these - values as bits or bytes physically. This function converts - the registry parameters into a structure that can be programmed - into the controller's memory. - - Arguments: - - Logical - a pointer to the logical settings - - Physical - a pointer to the controller memory-mapped structure - - Return Value: - - None. Function may print warnings in the future when truncating. - ---*/ -{ - RtlZeroMemory(Physical, sizeof(RMI4_F01_CTRL_REGISTERS)); - - // - // Note that truncation of registry values is possible if - // the data was incorrectly provided by the OEM, we may - // print warning messages in the future. - // - - Physical->DeviceControl.SleepMode = LOGICAL_TO_PHYSICAL(Logical->SleepMode); - Physical->DeviceControl.NoSleep = LOGICAL_TO_PHYSICAL(Logical->NoSleep); - Physical->DeviceControl.ReportRate = LOGICAL_TO_PHYSICAL(Logical->ReportRate); - Physical->DeviceControl.Configured = LOGICAL_TO_PHYSICAL(Logical->Configured); - - Physical->InterruptEnable = LOGICAL_TO_PHYSICAL(Logical->InterruptEnable); - Physical->DozeInterval = LOGICAL_TO_PHYSICAL(Logical->DozeInterval); - Physical->DozeThreshold = LOGICAL_TO_PHYSICAL(Logical->DozeThreshold); - Physical->DozeHoldoff = LOGICAL_TO_PHYSICAL(Logical->DozeHoldoff); -} - -VOID -RmiConvertF11ToPhysical( - IN RMI4_F11_CTRL_REGISTERS_LOGICAL* Logical, - IN RMI4_F11_CTRL_REGISTERS* Physical - ) -/*++ - - Routine Description: - - Registry configuration values for F11 must be specified as - 4-byte REG_DWORD values logically, however the chip interprets these - values as bits or bytes physically. This function converts - the registry parameters into a structure that can be programmed - into the controller's memory. - - Arguments: - - Logical - a pointer to the logical settings - - Physical - a pointer to the controller memory-mapped structure - - Return Value: - - None. Function may print warnings in the future when truncating. - ---*/ -{ - RtlZeroMemory(Physical, sizeof(RMI4_F11_CTRL_REGISTERS)); - - // - // Note that truncation of registry values is possible if - // the data was incorrectly provided by the OEM, we may - // print warning messages in the future. - // - - Physical->ReportingMode = LOGICAL_TO_PHYSICAL(Logical->ReportingMode); - Physical->AbsPosFilt = LOGICAL_TO_PHYSICAL(Logical->AbsPosFilt); - Physical->RelPosFilt = LOGICAL_TO_PHYSICAL(Logical->RelPosFilt); - Physical->RelBallistics = LOGICAL_TO_PHYSICAL(Logical->RelBallistics); - Physical->Dribble = LOGICAL_TO_PHYSICAL(Logical->Dribble); - - Physical->PalmDetectThreshold = LOGICAL_TO_PHYSICAL(Logical->PalmDetectThreshold); - Physical->MotionSensitivity = LOGICAL_TO_PHYSICAL(Logical->MotionSensitivity); - Physical->ManTrackEn = LOGICAL_TO_PHYSICAL(Logical->ManTrackEn); - Physical->ManTrackedFinger = LOGICAL_TO_PHYSICAL(Logical->ManTrackedFinger); - - Physical->DeltaXPosThreshold = LOGICAL_TO_PHYSICAL(Logical->DeltaXPosThreshold); - Physical->DeltaYPosThreshold = LOGICAL_TO_PHYSICAL(Logical->DeltaYPosThreshold); - Physical->Velocity = LOGICAL_TO_PHYSICAL(Logical->Velocity); - Physical->Acceleration = LOGICAL_TO_PHYSICAL(Logical->Acceleration); - - Physical->SensorMaxXPosLo = (Logical->SensorMaxXPos & 0xFF) >> 0; - Physical->SensorMaxXPosHi = (Logical->SensorMaxXPos & 0xF00) >> 8; - - Physical->SensorMaxYPosLo = (Logical->SensorMaxYPos & 0xFF) >> 0; - Physical->SensorMaxYPosHi = (Logical->SensorMaxYPos & 0xF00) >> 8; - - Physical->ZTouchThreshold = LOGICAL_TO_PHYSICAL(Logical->ZTouchThreshold); - Physical->ZHysteresis = LOGICAL_TO_PHYSICAL(Logical->ZHysteresis); - Physical->SmallZThreshold = LOGICAL_TO_PHYSICAL(Logical->SmallZThreshold); - - Physical->SmallZScaleFactor[0] = (Logical->SmallZScaleFactor & 0xFF) >> 0; - Physical->SmallZScaleFactor[1] = (Logical->SmallZScaleFactor & 0xFF00) >> 8; - - Physical->LargeZScaleFactor[0] = (Logical->LargeZScaleFactor & 0xFF) >> 0; - Physical->LargeZScaleFactor[1] = (Logical->LargeZScaleFactor & 0xFF00) >> 8; - - Physical->AlgorithmSelection = LOGICAL_TO_PHYSICAL((Logical->AlgorithmSelection)); - Physical->WxScaleFactor = LOGICAL_TO_PHYSICAL((Logical->WxScaleFactor)); - Physical->WxOffset = LOGICAL_TO_PHYSICAL((Logical->WxOffset)); - Physical->WyScaleFactor = LOGICAL_TO_PHYSICAL((Logical->WyScaleFactor)); - Physical->WyOffset = LOGICAL_TO_PHYSICAL((Logical->WyOffset)); - - Physical->XPitch[0] = (Logical->XPitch & 0xFF) >> 0; - Physical->XPitch[1] = (Logical->XPitch & 0xFF00) >> 8; - - Physical->YPitch[0] = (Logical->YPitch & 0xFF) >> 0; - Physical->YPitch[1] = (Logical->YPitch & 0xFF00) >> 8; - - Physical->FingerWidthX[0] = (Logical->FingerWidthX & 0xFF) >> 0; - Physical->FingerWidthX[1] = (Logical->FingerWidthX & 0xFF00) >> 8; - - Physical->FingerWidthY[0] = (Logical->FingerWidthY & 0xFF) >> 0; - Physical->FingerWidthY[1] = (Logical->FingerWidthY & 0xFF00) >> 8; - - Physical->ReportMeasuredSize = LOGICAL_TO_PHYSICAL(Logical->ReportMeasuredSize); - Physical->SegmentationSensitivity = LOGICAL_TO_PHYSICAL(Logical->SegmentationSensitivity); - Physical->XClipLo = LOGICAL_TO_PHYSICAL(Logical->XClipLo); - Physical->XClipHi = LOGICAL_TO_PHYSICAL(Logical->XClipHi); - Physical->YClipLo = LOGICAL_TO_PHYSICAL(Logical->YClipLo); - Physical->YClipHi = LOGICAL_TO_PHYSICAL(Logical->YClipHi); - Physical->MinFingerSeparation = LOGICAL_TO_PHYSICAL(Logical->MinFingerSeparation); - Physical->MaxFingerMovement = LOGICAL_TO_PHYSICAL(Logical->MaxFingerMovement); -} - -NTSTATUS -RmiConfigureFunctions( - IN RMI4_CONTROLLER_CONTEXT *ControllerContext, - IN SPB_CONTEXT *SpbContext - ) -/*++ - - Routine Description: - - RMI4 devices such as this Synaptics touch controller are organized - as collections of logical functions. Discovered functions must be - configured, which is done in this function (things like sleep - timeouts, interrupt enables, report rates, etc.) - - Arguments: - - ControllerContext - A pointer to the current touch controller - context - - SpbContext - A pointer to the current i2c context - - Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - int index; - NTSTATUS status; - - RMI4_F01_CTRL_REGISTERS controlF01 = {0}; - RMI4_F11_CTRL_REGISTERS controlF11 = {0}; - - // - // Find 2D touch sensor function and configure it - // - index = RmiGetFunctionIndex( - ControllerContext->Descriptors, - ControllerContext->FunctionCount, - RMI4_F11_2D_TOUCHPAD_SENSOR); - - if (index == ControllerContext->FunctionCount) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Unexpected - RMI Function 11 missing"); - - status = STATUS_INVALID_DEVICE_STATE; - goto exit; - } - - status = RmiChangePage( - ControllerContext, - SpbContext, - ControllerContext->FunctionOnPage[index]); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not change register page"); - - goto exit; - } - - RmiConvertF11ToPhysical( - &ControllerContext->Config.TouchSettings, - &controlF11); - - // - // Write settings to controller - // - status = SpbWriteDataSynchronously( - SpbContext, - ControllerContext->Descriptors[index].ControlBase, - &controlF11, - sizeof(controlF11) - ); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error writing RMI F11 Ctrl settings - %!STATUS!", - status); - goto exit; - } - - // - // Find 0D capacitive button sensor function and configure it if it exists - // - index = RmiGetFunctionIndex( - ControllerContext->Descriptors, - ControllerContext->FunctionCount, - RMI4_F1A_0D_CAP_BUTTON_SENSOR); - - if (index != ControllerContext->FunctionCount) - { - ControllerContext->HasButtons = TRUE; - - // - // TODO: Get configuration data from registry once Synaptics - // provides sane default values. Until then, assume the - // object is configured for the desired product scenario - // by default. - // - } - - // - // Find RMI device control function and configure it - // - index = RmiGetFunctionIndex( - ControllerContext->Descriptors, - ControllerContext->FunctionCount, - RMI4_F01_RMI_DEVICE_CONTROL); - - if (index == ControllerContext->FunctionCount) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Unexpected - RMI Function 01 missing"); - - status = STATUS_INVALID_DEVICE_STATE; - goto exit; - } - - status = RmiChangePage( - ControllerContext, - SpbContext, - ControllerContext->FunctionOnPage[index]); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not change register page"); - - goto exit; - } - - RmiConvertF01ToPhysical( - &ControllerContext->Config.DeviceSettings, - &controlF01); - - // - // Write settings to controller - // - status = SpbWriteDataSynchronously( - SpbContext, - ControllerContext->Descriptors[index].ControlBase, - &controlF01, - sizeof(controlF01) - ); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error writing RMI F01 Ctrl settings - %!STATUS!", - status); - goto exit; - } - - // - // Note whether the device configuration settings initialized the - // controller in an operating state, to prevent a double-start from - // the D0 entry dispatch routine (TchWakeDevice) - // - if (RMI4_F11_DEVICE_CONTROL_SLEEP_MODE_OPERATING == - controlF01.DeviceControl.SleepMode) - { - ControllerContext->DevicePowerState = PowerDeviceD0; - } - else - { - ControllerContext->DevicePowerState = PowerDeviceD3; - } - -exit: - - return status; -} - -NTSTATUS -RmiBuildFunctionsTable( - IN RMI4_CONTROLLER_CONTEXT *ControllerContext, - IN SPB_CONTEXT *SpbContext - ) -/*++ - - Routine Description: - - RMI4 devices such as this Synaptics touch controller are organized - as collections of logical functions. When initially communicating - with the chip, a driver must build a table of available functions, - as is done in this routine. - - Arguments: - - ControllerContext - A pointer to the current touch controller context - - SpbContext - A pointer to the current i2c context - - Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - UCHAR address; - int function; - int page; - NTSTATUS status; - - - // - // First function is at a fixed address - // - function = 0; - address = RMI4_FIRST_FUNCTION_ADDRESS; - page = 0; - - // - // Discover chip functions one by one - // - do - { - // - // Read function descriptor - // - status = SpbReadDataSynchronously( - SpbContext, - address, - &ControllerContext->Descriptors[function], - sizeof(RMI4_FUNCTION_DESCRIPTOR)); - - if (!(NT_SUCCESS(status))) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error returned from SPB/I2C read attempt %d - %!STATUS!", - function, - status); - goto exit; - } - - // - // Function number 0 implies "last function" on this register page, - // and if this "last function" is the first function on the page, there - // are no more functions to discover. - // - if (ControllerContext->Descriptors[function].Number == 0 && - address == RMI4_FIRST_FUNCTION_ADDRESS) - { - break; - } - // - // If we've exhausted functions on this page, look for more functoins - // on the next register page - // - else if (ControllerContext->Descriptors[function].Number == 0 && - address != RMI4_FIRST_FUNCTION_ADDRESS) - { - page++; - address = RMI4_FIRST_FUNCTION_ADDRESS; - - status = RmiChangePage( - ControllerContext, - SpbContext, - page); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error attempting to change page - %!STATUS!", - status); - goto exit; - } - } - // - // Descriptor stored, look for next or terminator - // - else - { - Trace( - TRACE_LEVEL_VERBOSE, - TRACE_FLAG_INIT, - "Discovered function $%x", - ControllerContext->Descriptors[function].Number); - - ControllerContext->FunctionOnPage[function] = page; - function++; - address = address - sizeof(RMI4_FUNCTION_DESCRIPTOR); - } - - } while ( - (address > 0) && - (function < RMI4_MAX_FUNCTIONS)); - - // - // If we swept the address space without finding an "end function" - // or maxed-out the total number of functions supported by the - // driver, note the error and exit. - // - if (function >= RMI4_MAX_FUNCTIONS) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error, encountered more than %d functions, must extend driver", - RMI4_MAX_FUNCTIONS); - - status = STATUS_INVALID_DEVICE_STATE; - goto exit; - } - if (address <= 0) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Error, did not find terminator function 0, address down to %d", - address); - - status = STATUS_INVALID_DEVICE_STATE; - goto exit; - } - - // - // Note the total number of functions that exist - // - ControllerContext->FunctionCount = function; - - Trace( - TRACE_LEVEL_VERBOSE, - TRACE_FLAG_INIT, - "Discovered %d RMI functions total", - function); - -exit: - - return status; -} - -NTSTATUS -RmiCheckInterrupts( - IN RMI4_CONTROLLER_CONTEXT *ControllerContext, - IN SPB_CONTEXT *SpbContext, - IN ULONG* InterruptStatus - ) -/*++ - - Routine Description: - - This function handles controller interrupts. It currently only - supports valid touch interrupts. Any other interrupt sources (such as - device losing configuration or being reset) are unhandled, but noted - in the controller context. - - Arguments: - - ControllerContext - A pointer to the current touch controller - context - - SpbContext - A pointer to the current i2c context - - Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - RMI4_F01_DATA_REGISTERS data; - int index; - NTSTATUS status; - - RtlZeroMemory(&data, sizeof(data)); - *InterruptStatus = 0; - - // - // Locate RMI data base address - // - index = RmiGetFunctionIndex( - ControllerContext->Descriptors, - ControllerContext->FunctionCount, - RMI4_F01_RMI_DEVICE_CONTROL); - - if (index == ControllerContext->FunctionCount) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Unexpected - RMI Function 01 missing"); - - status = STATUS_INVALID_DEVICE_STATE; - goto exit; - } - - status = RmiChangePage( - ControllerContext, - SpbContext, - ControllerContext->FunctionOnPage[index]); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not change register page"); - - goto exit; - } - - // - // Read interrupt status registers - // - status = SpbReadDataSynchronously( - SpbContext, - ControllerContext->Descriptors[index].DataBase, - &data, - sizeof(data)); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Error reading interrupt status - %!STATUS!", - status); - - goto exit; - } - - // - // Check for catastrophic failures, simply store in context for - // debugging should these errors occur. - // - switch (data.DeviceStatus.Status) - { - case RMI4_F01_DATA_STATUS_NO_ERROR: - { - break; - } - case RMI4_F01_DATA_STATUS_RESET_OCCURRED: - { - ControllerContext->ResetOccurred = TRUE; - break; - } - case RMI4_F01_DATA_STATUS_INVALID_CONFIG: - { - ControllerContext->InvalidConfiguration = TRUE; - - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Received status code 2 - invalid configuration"); - - break; - } - case RMI4_F01_DATA_STATUS_DEVICE_FAILURE: - { - ControllerContext->DeviceFailure = TRUE; - - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Received status code 4 - device failure"); - - break; - } - default: - { - ControllerContext->UnknownStatus = TRUE; - ControllerContext->UnknownStatusMessage = data.DeviceStatus.Status; - - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Received unknown status code - %d", - ControllerContext->UnknownStatusMessage); - - break; - } - } - - // - // If we're in flash programming mode, report an error - // - if (data.DeviceStatus.FlashProg) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Error, device status indicates chip in programming mode"); - - goto exit; - } - - // - // If the chip has lost it's configuration, reconfigure - // - if (data.DeviceStatus.Unconfigured) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Error, device status indicates chip is unconfigured"); - - status = RmiConfigureFunctions( - ControllerContext, - SpbContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Could not reconfigure chip - %!STATUS!", - status); - - goto exit; - } - - } - - if (data.InterruptStatus[0]) - { - *InterruptStatus = data.InterruptStatus[0] & 0xFF; - } - else - { - Trace( - TRACE_LEVEL_VERBOSE, - TRACE_FLAG_INTERRUPT, - "Unexpected -- no interrupt status bit set"); - } - -exit: - return status; -} - -NTSTATUS -TchStartDevice( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext - ) -/*++ - - Routine Description: - - This routine is called in response to the KMDF prepare hardware call - to initialize the touch controller for use. - - Arguments: - - ControllerContext - A pointer to the current touch controller - context - - SpbContext - A pointer to the current i2c context - - Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - RMI4_CONTROLLER_CONTEXT* controller; - ULONG interruptStatus; - NTSTATUS status; - - controller = (RMI4_CONTROLLER_CONTEXT*) ControllerContext; - interruptStatus = 0; - status = STATUS_SUCCESS; - - // - // Populate context with RMI function descriptors - // - status = RmiBuildFunctionsTable( - ControllerContext, - SpbContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not build table of RMI functions - %!STATUS!", - status); - goto exit; - } - - // - // Initialize RMI function control registers - // - status = RmiConfigureFunctions( - ControllerContext, - SpbContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not configure RMI functions - %!STATUS!", - status); - goto exit; - } - - // - // Read and store the firmware version - // - status = RmiGetFirmwareVersion( - ControllerContext, - SpbContext); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not get RMI firmware version - %!STATUS!", - status); - goto exit; - } - - // - // Clear any pending interrupts - // - status = RmiCheckInterrupts( - ControllerContext, - SpbContext, - &interruptStatus - ); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not get interrupt status - %!STATUS!%", - status); - } - -exit: - - return status; -} - -NTSTATUS -TchStopDevice( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext - ) -/*++ - -Routine Description: - - This routine cleans up the device that is stopped. - -Argument: - - ControllerContext - Touch controller context - - SpbContext - A pointer to the current i2c context - -Return Value: - - NTSTATUS indicating sucess or failure ---*/ -{ - RMI4_CONTROLLER_CONTEXT* controller; - - UNREFERENCED_PARAMETER(SpbContext); - - controller = (RMI4_CONTROLLER_CONTEXT*) ControllerContext; - - return STATUS_SUCCESS; -} - -NTSTATUS -TchAllocateContext( - OUT VOID **ControllerContext, - IN WDFDEVICE FxDevice - ) -/*++ - -Routine Description: - - This routine allocates a controller context. - -Argument: - - ControllerContext - Touch controller context - FxDevice - Framework device object - -Return Value: - - NTSTATUS indicating sucess or failure ---*/ -{ - RMI4_CONTROLLER_CONTEXT* context; - NTSTATUS status; - - context = ExAllocatePoolWithTag( - NonPagedPoolNx, - sizeof(RMI4_CONTROLLER_CONTEXT), - TOUCH_POOL_TAG); - - if (NULL == context) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not allocate controller context!"); - - status = STATUS_UNSUCCESSFUL; - goto exit; - } - - RtlZeroMemory(context, sizeof(RMI4_CONTROLLER_CONTEXT)); - context->FxDevice = FxDevice; - - // - // Get screen properties and populate context - // - TchGetScreenProperties(&context->Props); - - // - // Allocate a WDFWAITLOCK for guarding access to the - // controller HW and driver controller context - // - status = WdfWaitLockCreate( - WDF_NO_OBJECT_ATTRIBUTES, - &context->ControllerLock); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not create lock - %!STATUS!", - status); - - TchFreeContext(context); - goto exit; - - } - - *ControllerContext = context; - -exit: - - return status; -} - -NTSTATUS -TchFreeContext( - IN VOID *ControllerContext - ) -/*++ - -Routine Description: - - This routine frees a controller context. - -Argument: - - ControllerContext - Touch controller context - -Return Value: - - NTSTATUS indicating sucess or failure ---*/ -{ - RMI4_CONTROLLER_CONTEXT* controller; - - controller = (RMI4_CONTROLLER_CONTEXT*) ControllerContext; - - if (controller != NULL) - { - - if (controller->ControllerLock != NULL) - { - WdfObjectDelete(controller->ControllerLock); - } - - ExFreePoolWithTag(controller, TOUCH_POOL_TAG); - } - - return STATUS_SUCCESS; -} - -#pragma warning(pop) diff --git a/input/hiddigi/SynapticsTouch/input-hiddigi-synapticstouch.yaml b/input/hiddigi/SynapticsTouch/input-hiddigi-synapticstouch.yaml deleted file mode 100644 index 160fe55e..00000000 --- a/input/hiddigi/SynapticsTouch/input-hiddigi-synapticstouch.yaml +++ /dev/null @@ -1,10 +0,0 @@ -### YamlMime:Sample -sample: -- name: Synaptics Touch Sample - description: Demonstrates how to write a HID miniport driver for the Synaptics 3202 touch controller. - generateZip: true - author: windows-driver-samples - languages: - - cpp - technologies: - - windows diff --git a/input/hiddigi/SynapticsTouch/internal.h b/input/hiddigi/SynapticsTouch/internal.h deleted file mode 100644 index 39b8bfdc..00000000 --- a/input/hiddigi/SynapticsTouch/internal.h +++ /dev/null @@ -1,73 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - internal.h - - Abstract: - - Contains common types and defintions used internally - by the multi touch screen driver. - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - -#include "controller.h" - -// -// Device context -// - -typedef struct _DEVICE_EXTENSION -{ - // - // HID Touch input mode (touch vs. mouse) - // - UCHAR InputMode; - - // - // Device related - // - WDFDEVICE FxDevice; - WDFQUEUE DefaultQueue; - WDFQUEUE PingPongQueue; - - // - // Interrupt servicing - // - WDFINTERRUPT InterruptObject; - BOOLEAN ServiceInterruptsAfterD0Entry; - - // - // Spb (I2C) related members used for the lifetime of the device - // - SPB_CONTEXT I2CContext; - - // - // Test related - // - WDFQUEUE TestQueue; - volatile LONG TestSessionRefCnt; - BOOLEAN DiagnosticMode; - - // - // Power related - // - WDFQUEUE IdleQueue; - - // - // Touch related members used for the lifetime of the device - // - VOID *TouchContext; -} DEVICE_EXTENSION, *PDEVICE_EXTENSION; - -WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_EXTENSION, GetDeviceContext) diff --git a/input/hiddigi/SynapticsTouch/power.c b/input/hiddigi/SynapticsTouch/power.c deleted file mode 100644 index b234afb8..00000000 --- a/input/hiddigi/SynapticsTouch/power.c +++ /dev/null @@ -1,272 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - power.c - - Abstract: - - Contains Synaptics power-on and power-off functionality - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "controller.h" -#include "rmiinternal.h" -#include "spb.h" -#include "power.tmh" - -NTSTATUS -RmiChangeSleepState( - IN RMI4_CONTROLLER_CONTEXT* ControllerContext, - IN SPB_CONTEXT *SpbContext, - IN UCHAR SleepState - ) -/*++ - -Routine Description: - - Changes the SleepMode bits on the controller as specified - -Arguments: - - ControllerContext - Touch controller context - - SpbContext - A pointer to the current i2c context - - SleepState - Either RMI4_F11_DEVICE_CONTROL_SLEEP_MODE_OPERATING - or RMI4_F11_DEVICE_CONTROL_SLEEP_MODE_SLEEPING - -Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - RMI4_F01_CTRL_REGISTERS* controlF01; - UCHAR deviceControl; - int index; - NTSTATUS status; - - controlF01 = (RMI4_F01_CTRL_REGISTERS*) &deviceControl; - - // - // Find RMI device control function housing sleep settings - // - index = RmiGetFunctionIndex( - ControllerContext->Descriptors, - ControllerContext->FunctionCount, - RMI4_F01_RMI_DEVICE_CONTROL); - - if (index == ControllerContext->FunctionCount) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_POWER, - "Power change failure - RMI Function 01 missing"); - - status = STATUS_INVALID_DEVICE_STATE; - goto exit; - } - - status = RmiChangePage( - ControllerContext, - SpbContext, - ControllerContext->FunctionOnPage[index]); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_POWER, - "Could not change register page"); - - goto exit; - } - - // - // Read Device Control register - // - status = SpbReadDataSynchronously( - SpbContext, - ControllerContext->Descriptors[index].ControlBase, - &deviceControl, - sizeof(deviceControl) - ); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_POWER, - "Could not read sleep register - %!STATUS!", - status); - - goto exit; - } - - // - // Assign new sleep state - // - controlF01->DeviceControl.SleepMode = SleepState; - - // - // Write setting back to the controller - // - status = SpbWriteDataSynchronously( - SpbContext, - ControllerContext->Descriptors[index].ControlBase, - &deviceControl, - sizeof(deviceControl) - ); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_POWER, - "Could not write sleep register - %X", - status); - - goto exit; - } - -exit: - - return status; -} - -NTSTATUS -TchWakeDevice( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext - ) -/*++ - -Routine Description: - - Enables multi-touch scanning - -Arguments: - - ControllerContext - Touch controller context - - SpbContext - A pointer to the current i2c context - -Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - RMI4_CONTROLLER_CONTEXT* controller; - NTSTATUS status; - - controller = (RMI4_CONTROLLER_CONTEXT*) ControllerContext; - - // - // Check if we were already on - // - if (controller->DevicePowerState == PowerDeviceD0) - { - goto exit; - } - - controller->DevicePowerState = PowerDeviceD0; - - // - // Attempt to put the controller into operating mode - // - status = RmiChangeSleepState( - controller, - SpbContext, - RMI4_F11_DEVICE_CONTROL_SLEEP_MODE_OPERATING); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_POWER, - "Error waking touch controller - %!STATUS!", - status); - } - -exit: - - return STATUS_SUCCESS; -} - -NTSTATUS -TchStandbyDevice( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext - ) -/*++ - -Routine Description: - - Disables multi-touch scanning to conserve power - -Arguments: - - ControllerContext - Touch controller context - - SpbContext - A pointer to the current i2c context - -Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - RMI4_CONTROLLER_CONTEXT* controller; - NTSTATUS status; - - controller = (RMI4_CONTROLLER_CONTEXT*) ControllerContext; - - // - // Interrupts are now disabled but the ISR may still be - // executing, so grab the controller lock to ensure ISR - // is finished touching HW and controller state. - // - WdfWaitLockAcquire(controller->ControllerLock, NULL); - - // - // Put the chip in sleep mode - // - status = RmiChangeSleepState( - ControllerContext, - SpbContext, - RMI4_F11_DEVICE_CONTROL_SLEEP_MODE_SLEEPING); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_POWER, - "Error sleeping touch controller - %!STATUS!", - status); - } - - controller->DevicePowerState = PowerDeviceD3; - - // - // Invalidate state - // - controller->TouchesReported = 0; - controller->TouchesTotal = 0; - controller->Cache.FingerSlotValid = 0; - controller->Cache.FingerSlotDirty = 0; - controller->Cache.FingerDownCount = 0; - - WdfWaitLockRelease(controller->ControllerLock); - - return STATUS_SUCCESS; -}
\ No newline at end of file diff --git a/input/hiddigi/SynapticsTouch/queue.c b/input/hiddigi/SynapticsTouch/queue.c deleted file mode 100644 index e765df8b..00000000 --- a/input/hiddigi/SynapticsTouch/queue.c +++ /dev/null @@ -1,180 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - queue.c - - Abstract: - - Contains WDF queue related code, namely the top-level queue - handler for all device IOCTL requests. - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "internal.h" -#include "controller.h" -#include "queue.h" -#include "hid.h" -#include "idle.h" -#include "queue.tmh" - -VOID -OnInternalDeviceControl( - IN WDFQUEUE Queue, - IN WDFREQUEST Request, - IN size_t OutputBufferLength, - IN size_t InputBufferLength, - IN ULONG IoControlCode - ) -/*++ - -Routine Description: - - This event is called when the framework receives - IRP_MJ_INTERNAL DEVICE_CONTROL requests from the system. - -Arguments: - - Queue - Handle to the framework queue object that is associated - with the I/O request. - - Request - Handle to a framework request object. - - OutputBufferLength - length of the request's output buffer, - if an output buffer is available. - - InputBufferLength - length of the request's input buffer, - if an input buffer is available. - - IoControlCode - the driver-defined or system-defined I/O control code - (IOCTL) that is associated with the request. - -Return Value: - - None, status is indicated when completing the request - ---*/ -{ - NTSTATUS status; - PDEVICE_EXTENSION devContext; - WDFDEVICE device; - BOOLEAN requestPending; - - UNREFERENCED_PARAMETER(OutputBufferLength); - UNREFERENCED_PARAMETER(InputBufferLength); - - device = WdfIoQueueGetDevice(Queue); - devContext = GetDeviceContext(device); - requestPending = FALSE; - - // - // Please note that HIDCLASS provides the buffer in the Irp->UserBuffer - // field irrespective of the ioctl buffer type. However, framework is very - // strict about type checking. You cannot get Irp->UserBuffer by using - // WdfRequestRetrieveOutputMemory if the ioctl is not a METHOD_NEITHER - // internal ioctl. So depending on the ioctl code, we will either - // use retreive function or escape to WDM to get the UserBuffer. - // - - switch(IoControlCode) { - - case IOCTL_HID_GET_DEVICE_DESCRIPTOR: - // - // Retrieves master HID descriptor - // - - status = TchGetHidDescriptor(device, Request); - break; - - case IOCTL_HID_GET_DEVICE_ATTRIBUTES: - // - // Retrieves device attributes in a HID_DEVICE_ATTRIBUTES structure - // - - status = TchGetDeviceAttributes(Request); - break; - - case IOCTL_HID_GET_REPORT_DESCRIPTOR: - // - // Obtains the report descriptor for the HID device - // - - status = TchGetReportDescriptor(device, Request); - break; - - case IOCTL_HID_GET_STRING: - // - // Obtains strings associated with the HID device - // - - status = TchGetString(device, Request); - break; - - case IOCTL_HID_READ_REPORT: - // - // Dangling read requests for passing up touch data - // - - status = TchReadReport(device, Request, &requestPending); - break; - - case IOCTL_HID_SET_FEATURE: - // - // This sends a HID class feature report to a top-level collection of - // a HID class device. - // - - status = TchSetFeatureReport(device, Request); - break; - - case IOCTL_HID_GET_FEATURE: - // - // Returns a feature report associated with a top-level collection - // - - status = TchGetFeatureReport(device, Request); - break; - - case IOCTL_HID_SEND_IDLE_NOTIFICATION_REQUEST: - // - // Hidclass sends this IOCTL to notify miniports that it wants - // them to go into idle - // - - status = TchProcessIdleRequest(device, Request, &requestPending); - break; - - case IOCTL_HID_WRITE_REPORT: - // - // Transmits a class driver-supplied report to the device. - // - case IOCTL_HID_ACTIVATE_DEVICE: - // - // Makes the device ready for I/O operations. - // - case IOCTL_HID_DEACTIVATE_DEVICE: - // - // Causes the device to cease operations and terminate all outstanding - // I/O requests. - // - - default: - status = STATUS_NOT_SUPPORTED; - break; - } - - if (!requestPending) - { - WdfRequestComplete(Request, status); - } - - return; -} diff --git a/input/hiddigi/SynapticsTouch/queue.h b/input/hiddigi/SynapticsTouch/queue.h deleted file mode 100644 index 777ee04c..00000000 --- a/input/hiddigi/SynapticsTouch/queue.h +++ /dev/null @@ -1,24 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - queue.h - - Abstract: - - Contains WDF queue related function declarations - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - - -EVT_WDF_IO_QUEUE_IO_INTERNAL_DEVICE_CONTROL OnInternalDeviceControl; diff --git a/input/hiddigi/SynapticsTouch/registry.c b/input/hiddigi/SynapticsTouch/registry.c deleted file mode 100644 index 651f508a..00000000 --- a/input/hiddigi/SynapticsTouch/registry.c +++ /dev/null @@ -1,722 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - registry.c - - Abstract: - - This module retrieves platform-specific controller - configuration from the registry, or assigns default - values if no registry configuration is present. - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "rmiinternal.h" -#include "registry.tmh" - -// -// Default RMI4 configuration values can be changed here. Please refer to the -// RMI4 specification for a full description of the fields and value meanings -// - -static RMI4_CONFIGURATION gDefaultConfiguration = -{ - // - // RMI4 F01 - Device control settings - // - { - 0, // Sleep Mode (normal) - 1, // No Sleep (do sleep) - 0, // Report Rate (standard) - 1, // Configured - 0xf, // Interrupt Enable - RMI4_MILLISECONDS_TO_TENTH_MILLISECONDS(20), // Doze Interval - 10, // Doze Threshold - RMI4_SECONDS_TO_HALF_SECONDS(2) // Doze Holdoff - }, - - // - // RMI4 F11 - 2D Touchpad sensor settings - // - { - 1, // Reporting mode (throttle) - 1, // Abs position filter - 0, // Rel position filter - 0, // Rel ballistics - 0, // Dribble - 0xb, // PalmDetectThreshold - 3, // MotionSensitivity - 0, // ManTrackEn - 0, // ManTrackedFinger - 0, // DeltaXPosThreshold - 0, // DeltaYPosThreshold - 0, // Velocity - 0, // Acceleration - TOUCH_DEVICE_RESOLUTION_X, // Sensor Max X Position - TOUCH_DEVICE_RESOLUTION_Y, // Sensor Max Y Position - 0x1e, // ZTouchThreshold - 0x05, // ZHysteresis - 0x28, // SmallZThreshold - 0x28f5, // SmallZScaleFactor - 0x051e, // LargeZScaleFactor - 0x1, // AlgorithmSelection - 0x30, // WxScaleFactor - 0x0, // WxOffset - 0x30, // WyScaleFactor - 0x0, // WyOffset - 0x4800, // XPitch - 0x4800, // YPitch - 0xea4f, // FingerWidthX - 0xdf6c, // FingerWidthY - 0, // ReportMeasuredSize - 0x70, // SegmentationSensitivity - 0x0, // XClipLo - 0x0, // XClipHi - 0x0, // YClipLo - 0x0, // YClipHi - 0x0a, // MinFingerSeparation - 0x04 // MaxFingerMovement - }, - - // - // Internal driver settings - // - { - 0x0, // Controller stays powered in D3 - }, -}; - -RTL_QUERY_REGISTRY_TABLE gRegistryTable[] = -{ - // - // RMI4 F01 - Device control settings - // - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"SleepMode", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, DeviceSettings) + - FIELD_OFFSET(RMI4_F01_CTRL_REGISTERS_LOGICAL, SleepMode)), - REG_DWORD, - &gDefaultConfiguration.DeviceSettings.SleepMode, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"NoSleep", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, DeviceSettings) + - FIELD_OFFSET(RMI4_F01_CTRL_REGISTERS_LOGICAL, NoSleep)), - REG_DWORD, - &gDefaultConfiguration.DeviceSettings.NoSleep, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"ReportRate", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, DeviceSettings) + - FIELD_OFFSET(RMI4_F01_CTRL_REGISTERS_LOGICAL, ReportRate)), - REG_DWORD, - &gDefaultConfiguration.DeviceSettings.ReportRate, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"Configured", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, DeviceSettings) + - FIELD_OFFSET(RMI4_F01_CTRL_REGISTERS_LOGICAL, Configured)), - REG_DWORD, - &gDefaultConfiguration.DeviceSettings.Configured, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"InterruptEnable", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, DeviceSettings) + - FIELD_OFFSET(RMI4_F01_CTRL_REGISTERS_LOGICAL, InterruptEnable)), - REG_DWORD, - &gDefaultConfiguration.DeviceSettings.InterruptEnable, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DozeInterval", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, DeviceSettings) + - FIELD_OFFSET(RMI4_F01_CTRL_REGISTERS_LOGICAL, DozeInterval)), - REG_DWORD, - &gDefaultConfiguration.DeviceSettings.DozeInterval, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DozeThreshold", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, DeviceSettings) + - FIELD_OFFSET(RMI4_F01_CTRL_REGISTERS_LOGICAL, DozeThreshold)), - REG_DWORD, - &gDefaultConfiguration.DeviceSettings.DozeThreshold, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DozeHoldoff", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, DeviceSettings) + - FIELD_OFFSET(RMI4_F01_CTRL_REGISTERS_LOGICAL, DozeHoldoff)), - REG_DWORD, - &gDefaultConfiguration.DeviceSettings.DozeHoldoff, - sizeof(UINT32) - }, - - // - // RMI4 F11 - 2D Touchpad sensor settings - // - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"ReportingMode", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, ReportingMode)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.ReportingMode, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"AbsPosFilt", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, AbsPosFilt)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.AbsPosFilt, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"RelPosFilt", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, RelPosFilt)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.RelPosFilt, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"RelBallistics", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, RelBallistics)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.RelBallistics, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"Dribble", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, Dribble)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.Dribble, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"PalmDetectThreshold", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, PalmDetectThreshold)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.PalmDetectThreshold, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"MotionSensitivity", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, MotionSensitivity)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.MotionSensitivity, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"ManTrackEn", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, ManTrackEn)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.ManTrackEn, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"ManTrackedFinger", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, ManTrackedFinger)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.ManTrackedFinger, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DeltaXPosThreshold", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, DeltaXPosThreshold)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.DeltaXPosThreshold, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DeltaYPosThreshold", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, DeltaYPosThreshold)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.DeltaYPosThreshold, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"Velocity", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, Velocity)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.Velocity, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"Acceleration", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, Acceleration)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.Acceleration, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"SensorMaxXPos", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, SensorMaxXPos)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.SensorMaxXPos, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"SensorMaxYPos", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, SensorMaxYPos)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.SensorMaxYPos, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"ZTouchThreshold", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, ZTouchThreshold)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.ZTouchThreshold, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"ZHysteresis", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, ZHysteresis)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.ZHysteresis, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"SmallZThreshold", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, SmallZThreshold)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.SmallZThreshold, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"SmallZScaleFactor", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, SmallZScaleFactor)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.SmallZScaleFactor, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"LargeZScaleFactor", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, LargeZScaleFactor)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.LargeZScaleFactor, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"AlgorithmSelection", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, AlgorithmSelection)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.AlgorithmSelection, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"WxScaleFactor", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, WxScaleFactor)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.WxScaleFactor, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"WxOffset", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, WxOffset)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.WxOffset, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"WyScaleFactor", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, WyScaleFactor)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.WyScaleFactor, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"WyOffset", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, WyOffset)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.WyOffset, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"XPitch", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, XPitch)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.XPitch, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"YPitch", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, YPitch)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.YPitch, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"FingerWidthX", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, FingerWidthX)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.FingerWidthX, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"FingerWidthY", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, FingerWidthY)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.FingerWidthY, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"ReportMeasuredSize", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, ReportMeasuredSize)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.ReportMeasuredSize, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"SegmentationSensitivity", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, SegmentationSensitivity)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.SegmentationSensitivity, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"XClipLo", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, XClipLo)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.XClipLo, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"XClipHi", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, XClipHi)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.XClipHi, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"YClipLo", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, YClipLo)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.YClipLo, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"YClipHi", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, YClipHi)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.YClipHi, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"MinFingerSeparation", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, MinFingerSeparation)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.MinFingerSeparation, - sizeof(UINT32) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"MaxFingerMovement", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, TouchSettings) + - FIELD_OFFSET(RMI4_F11_CTRL_REGISTERS_LOGICAL, MaxFingerMovement)), - REG_DWORD, - &gDefaultConfiguration.TouchSettings.MaxFingerMovement, - sizeof(UINT32) - }, - - // - // Add new supported functions here - // - - // - // Internal driver settings - // - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"PepRemovesVoltageInD3", - (PVOID) (FIELD_OFFSET(RMI4_CONFIGURATION, PepRemovesVoltageInD3)), - REG_DWORD, - &gDefaultConfiguration.PepRemovesVoltageInD3, - sizeof(UINT32) - }, - - // - // List Terminator - // - { - NULL, 0, - NULL, - 0, - REG_DWORD, - NULL, - 0 - } -}; -static const ULONG gcbRegistryTable = sizeof(gRegistryTable); -static const ULONG gcRegistryTable = - sizeof(gRegistryTable) / sizeof(gRegistryTable[0]); - - -NTSTATUS -TchRegistryGetControllerSettings( - IN VOID* ControllerContext, - IN WDFDEVICE FxDevice - ) -/*++ - - Routine Description: - - This routine retrieves controller wide settings - from the registry. - - Arguments: - - FxDevice - a handle to the framework device object - Settings - A pointer to the chip settings structure - - Return Value: - - NTSTATUS indicating success or failure - ---*/ -{ - RMI4_CONTROLLER_CONTEXT* controller; - HANDLE hKey; - ULONG i; - WDFKEY key; - PRTL_QUERY_REGISTRY_TABLE regTable; - NTSTATUS status; - WDFKEY subkey; - DECLARE_CONST_UNICODE_STRING(subkeyName, L"Settings"); - - controller = (RMI4_CONTROLLER_CONTEXT*) ControllerContext; - - hKey = NULL; - key = NULL; - regTable = NULL; - subkey = NULL; - - // - // Obtain a WDM hkey for RtlQueryRegistryValues - // - - status = WdfDeviceOpenRegistryKey( - FxDevice, - PLUGPLAY_REGKEY_DEVICE, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - &key); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_REGISTRY, - "Error opening device registry key - %!STATUS!", - status); - - goto exit; - } - - status = WdfRegistryOpenKey( - key, - &subkeyName, - KEY_READ, - WDF_NO_OBJECT_ATTRIBUTES, - &subkey); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_REGISTRY, - "Error opening device registry subkey - %!STATUS!", - status); - - goto exit; - } - - hKey = WdfRegistryWdmGetHandle(subkey); - - if (NULL == hKey) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_REGISTRY, - "Error getting WDM handle to WDF subkey"); - - goto exit; - } - - // - // RtlQueryRegistryValues table must be allocated from NonPagedPoolNx - // - - regTable = ExAllocatePoolWithTag( - NonPagedPoolNx, - gcbRegistryTable, - TOUCH_POOL_TAG); - - RtlCopyMemory( - regTable, - gRegistryTable, - gcbRegistryTable); - - // - // Update offset values with base pointer - // - - for (i=0; i < gcRegistryTable-1; i++) - { - regTable[i].EntryContext = (PVOID) ( - ((SIZE_T) regTable[i].EntryContext) + - ((ULONG_PTR) &controller->Config)); - } - - // - // Populate device context with registry or default configurations - // - - status = RtlQueryRegistryValues( - RTL_REGISTRY_HANDLE, - (PCWSTR) hKey, - regTable, - NULL, - NULL); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_REGISTRY, - "Error retrieving registry configuration - %!STATUS!", - status); - - goto exit; - } - -exit: - - if (!NT_SUCCESS(status)) - { - // - // Revert to default configuration values if there was an - // issue reading configuration data from the registry - // - RtlCopyMemory( - &controller->Config, - &gDefaultConfiguration, - sizeof(RMI4_CONFIGURATION)); - - Trace( - TRACE_LEVEL_WARNING, - TRACE_FLAG_REGISTRY, - "Error reading registry config, using defaults! - %!STATUS!", - status); - - status = STATUS_SUCCESS; - } - - if (subkey != NULL) - { - WdfRegistryClose(subkey); - } - - if (key != NULL) - { - WdfRegistryClose(key); - } - - if (regTable != NULL) - { - ExFreePoolWithTag(regTable, TOUCH_POOL_TAG); - } - - return status; -}
\ No newline at end of file diff --git a/input/hiddigi/SynapticsTouch/report.c b/input/hiddigi/SynapticsTouch/report.c deleted file mode 100644 index e2e58406..00000000 --- a/input/hiddigi/SynapticsTouch/report.c +++ /dev/null @@ -1,864 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - report.c - - Abstract: - - Contains Synaptics specific code for reporting samples - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "controller.h" -#include "rmiinternal.h" -#include "spb.h" -#include "report.tmh" - -const USHORT gOEMVendorID = 0x7379; // "sy" -const USHORT gOEMProductID = 0x726D; // "rm" -const USHORT gOEMVersionID = 3200; - -const PWSTR gpwstrManufacturerID = L"Synaptics"; -const PWSTR gpwstrProductID = L"3200"; -const PWSTR gpwstrSerialNumber = L"4"; - -NTSTATUS -RmiServiceCapacitiveButtonInterrupt( - IN RMI4_CONTROLLER_CONTEXT* ControllerContext, - IN SPB_CONTEXT* SpbContext, - IN PHID_INPUT_REPORT HidReport - ) -/*++ - -Routine Description: - - This routine services capacitive button (F$1A) interrupts, it reads - button data and fills a HID keyboard report with the relevant information - -Arguments: - - ControllerContext - Touch controller context - SpbContext - A pointer to the current i2c context - HidReport- A HID report buffer to be filled with button data - -Return Value: - - NTSTATUS, where success indicates the request memory was updated with - button press information. - ---*/ -{ - RMI4_F1A_DATA_REGISTERS dataF1A; - PHID_KEY_REPORT hidKeys; - int index; - NTSTATUS status; - - // - // If the controller doesn't support buttons, ignore this interrupt - // - if (ControllerContext->HasButtons == FALSE) - { - status = STATUS_NOT_IMPLEMENTED; - goto exit; - } - - // - // Get the the key press/release information from the controller - // - index = RmiGetFunctionIndex( - ControllerContext->Descriptors, - ControllerContext->FunctionCount, - RMI4_F1A_0D_CAP_BUTTON_SENSOR); - - if (index == ControllerContext->FunctionCount) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Unexpected - RMI Function 1A missing"); - - status = STATUS_INVALID_DEVICE_STATE; - goto exit; - } - - status = RmiChangePage( - ControllerContext, - SpbContext, - ControllerContext->FunctionOnPage[index]); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not change register page"); - - goto exit; - } - - // - // Read button press/release data - // - status = SpbReadDataSynchronously( - SpbContext, - ControllerContext->Descriptors[index].DataBase, - &dataF1A, - sizeof(dataF1A)); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Error reading finger status data - %!STATUS!", - status); - - goto exit; - } - - RtlZeroMemory(HidReport, sizeof(HID_INPUT_REPORT)); - - // - // Update button states. This mapping should be made registry configurable - // - HidReport->ReportID = REPORTID_CAPKEY; - hidKeys = &(HidReport->KeyReport); - hidKeys->InputReport.bKeys |= (dataF1A.Button0) ? KEY_DOWN_SEARCH : 0; - hidKeys->InputReport.bKeys |= (dataF1A.Button1) ? KEY_DOWN_START : 0; - hidKeys->InputReport.bKeys |= (dataF1A.Button2) ? KEY_DOWN_BACK : 0; - - // - // On return of success, this request will be completed up the stack - // - -exit: - - return status; -} - -NTSTATUS -RmiGetTouchesFromController( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext, - IN RMI4_F11_DATA_REGISTERS *Data - ) -/*++ - -Routine Description: - - This routine reads raw touch messages from hardware. If there is - no touch data available (if a non-touch interrupt fired), the - function will not return success and no touch data was transferred. - -Arguments: - - ControllerContext - Touch controller context - SpbContext - A pointer to the current i2c context - Data - A pointer to any returned F11 touch data - -Return Value: - - NTSTATUS, where only success indicates data was returned - ---*/ -{ - NTSTATUS status; - RMI4_CONTROLLER_CONTEXT* controller; - int index, i; - int fingerStatus[RMI4_MAX_TOUCHES] = {0}; - int highestSlot; - - controller = (RMI4_CONTROLLER_CONTEXT*) ControllerContext; - - // - // Locate RMI data base address of 2D touch function - // - index = RmiGetFunctionIndex( - controller->Descriptors, - controller->FunctionCount, - RMI4_F11_2D_TOUCHPAD_SENSOR); - - if (index == controller->FunctionCount) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Unexpected - RMI Function 11 missing"); - - status = STATUS_INVALID_DEVICE_STATE; - goto exit; - } - - status = RmiChangePage( - ControllerContext, - SpbContext, - controller->FunctionOnPage[index]); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INIT, - "Could not change register page"); - - goto exit; - } - - // - // Read finger statuses first, to determine how much data we need to read - // - status = SpbReadDataSynchronously( - SpbContext, - controller->Descriptors[index].DataBase, - &Data->Status, - sizeof(RMI4_F11_DATA_REGISTERS_STATUS_BLOCK)); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Error reading finger status data - %!STATUS!", - status); - - goto exit; - } - - fingerStatus[0] = Data->Status.FingerState0; - fingerStatus[1] = Data->Status.FingerState1; - fingerStatus[2] = Data->Status.FingerState2; - fingerStatus[3] = Data->Status.FingerState3; - fingerStatus[4] = Data->Status.FingerState4; - fingerStatus[5] = Data->Status.FingerState5; - fingerStatus[6] = Data->Status.FingerState6; - fingerStatus[7] = Data->Status.FingerState7; - fingerStatus[8] = Data->Status.FingerState8; - fingerStatus[9] = Data->Status.FingerState9; - - // - // Compute the last slot containing data of interest - // - highestSlot = 0; - - for (i=0; i<RMI4_MAX_TOUCHES; i++) - { - // - // Find the highest slot we know has finger data - // - if (controller->Cache.FingerSlotValid & (1 << i)) - { - highestSlot = i; - } - } - - for (i=highestSlot+1; i<RMI4_MAX_TOUCHES; i++) - { - // - // New fingers in higher slots may need to be read - // - if (fingerStatus[i]) - { - highestSlot = i; - } - } - - // - // Read as much finger position data as we need to - // - status = SpbReadDataSynchronously( - SpbContext, - controller->Descriptors[index].DataBase + - sizeof(RMI4_F11_DATA_REGISTERS_STATUS_BLOCK), - &Data->Finger[0], - sizeof(RMI4_F11_DATA_POSITION) * (highestSlot+1)); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Error reading finger status data - %!STATUS!", - status); - - goto exit; - } - -exit: - return status; -} - -VOID -RmiUpdateLocalFingerCache( - IN RMI4_F11_DATA_REGISTERS *Data, - IN RMI4_FINGER_CACHE *Cache - ) -/*++ - -Routine Description: - - This routine takes raw data reported by the Synaptics hardware and - parses it to update a local cache of finger states. This routine manages - removing lifted touches from the cache, and manages a map between the - order of reported touches in hardware, and the order the driver should - use in reporting. - -Arguments: - - Data - A pointer to the new data returned from hardware - Cache - A data structure holding various current finger state info - -Return Value: - - None. - ---*/ -{ - int fingerStatus[RMI4_MAX_TOUCHES] = {0}; - int i, j; - - // - // Unpack the finger statuses into an array to ease dealing with each - // finger uniformly in loops - // - fingerStatus[0] = Data->Status.FingerState0; - fingerStatus[1] = Data->Status.FingerState1; - fingerStatus[2] = Data->Status.FingerState2; - fingerStatus[3] = Data->Status.FingerState3; - fingerStatus[4] = Data->Status.FingerState4; - fingerStatus[5] = Data->Status.FingerState5; - fingerStatus[6] = Data->Status.FingerState6; - fingerStatus[7] = Data->Status.FingerState7; - fingerStatus[8] = Data->Status.FingerState8; - fingerStatus[9] = Data->Status.FingerState9; - - // - // When hardware was last read, if any slots reported as lifted, we - // must clean out the slot and old touch info. There may be new - // finger data using the slot. - // - for (i=0; i<RMI4_MAX_TOUCHES; i++) - { - // - // Sweep for a slot that needs to be cleaned - // - if (!(Cache->FingerSlotDirty & (1 << i))) - { - continue; - } - - NT_ASSERT(Cache->FingerDownCount > 0); - - // - // Find the slot in the reporting list - // - for (j=0; j<RMI4_MAX_TOUCHES; j++) - { - if (Cache->FingerDownOrder[j] == i) - { - break; - } - } - - NT_ASSERT(j != RMI4_MAX_TOUCHES); - - // - // Remove the slot. If the finger lifted was the last in the list, - // we just decrement the list total by one. If it was not last, we - // shift the trailing list items up by one. - // - for (; (j<Cache->FingerDownCount-1) && (j<RMI4_MAX_TOUCHES-1); j++) - { - Cache->FingerDownOrder[j] = Cache->FingerDownOrder[j+1]; - } - Cache->FingerDownCount--; - - // - // Finished, clobber the dirty bit - // - Cache->FingerSlotDirty &= ~(1 << i); - } - - // - // Cache the new set of finger data reported by hardware - // - for (i=0; i<RMI4_MAX_TOUCHES; i++) - { - // - // Take actions when a new contact is first reported as down - // - if ((fingerStatus[i] != RMI4_FINGER_STATE_NOT_PRESENT) && - ((Cache->FingerSlotValid & (1 << i)) == 0) && - (Cache->FingerDownCount < RMI4_MAX_TOUCHES)) - { - Cache->FingerSlotValid |= (1 << i); - Cache->FingerDownOrder[Cache->FingerDownCount++] = i; - } - - // - // Ignore slots with no new information - // - if (!(Cache->FingerSlotValid & (1 << i))) - { - continue; - } - - // - // Update local cache with new information from the controller - // - Cache->FingerSlot[i].fingerStatus = (UCHAR) fingerStatus[i]; - Cache->FingerSlot[i].x = (Data->Finger[i].XPosLo & 0xF) | - ((Data->Finger[i].XPosHi & 0xFF) << 4); - Cache->FingerSlot[i].y = (Data->Finger[i].YPosLo & 0xF) | - ((Data->Finger[i].YPosHi & 0xFF) << 4); - - // - // If a finger lifted, note the slot is now inactive so that any - // cached data is cleaned out before we read hardware again. - // - if (Cache->FingerSlot[i].fingerStatus == RMI4_FINGER_STATE_NOT_PRESENT) - { - Cache->FingerSlotDirty |= (1 << i); - Cache->FingerSlotValid &= ~(1 << i); - } - } -} - -VOID -RmiFillNextHidReportFromCache( - IN PHID_INPUT_REPORT HidReport, - IN RMI4_FINGER_CACHE *Cache, - IN PTOUCH_SCREEN_PROPERTIES Props, - IN int *TouchesReported, - IN int TouchesTotal - ) -/*++ - -Routine Description: - - This routine fills a HID report with the next one or two touch entries in - the local device finger cache. - - The routine also adjusts X/Y coordinates to match the desired display - coordinates. - -Arguments: - - HidReport - pointer to the HID report structure to fill - Cache - pointer to the local device finger cache - Props - information on how to adjust X/Y coordinates to match the display - TouchesReported - On entry, the number of touches (against total) that - have already been reported. As touches are transferred from the local - device cache to a HID report, this number is incremented. - TouchesTotal - total number of touches in the touch cache - -Return Value: - - None. - ---*/ -{ - PHID_TOUCH_REPORT hidTouch = NULL; - int currentlyReporting; - - HidReport->ReportID = REPORTID_MTOUCH; - hidTouch = &(HidReport->TouchReport); - - // - // Report the next available finger - // - currentlyReporting = Cache->FingerDownOrder[*TouchesReported]; - - hidTouch->InputReport.ContactId = (UCHAR) currentlyReporting; - hidTouch->InputReport.wXData = (USHORT) Cache->FingerSlot[currentlyReporting].x; - hidTouch->InputReport.wYData = (USHORT) Cache->FingerSlot[currentlyReporting].y; - - // - // Perform per-platform x/y adjustments to controller coordinates - // - TchTranslateToDisplayCoordinates( - &hidTouch->InputReport.wXData, - &hidTouch->InputReport.wYData, - Props); - - if (Cache->FingerSlot[currentlyReporting].fingerStatus) - { - hidTouch->InputReport.bStatus = RANGE_FINGER_STATUS; - } - - (*TouchesReported)++; - - // - // A single HID report can contain two touches, so see if there's more - // - if (TouchesTotal - *TouchesReported > 0) - { - currentlyReporting = Cache->FingerDownOrder[*TouchesReported]; - - hidTouch->InputReport.ContactId2 = (UCHAR) currentlyReporting; - hidTouch->InputReport.wXData2 = (USHORT) Cache->FingerSlot[currentlyReporting].x; - hidTouch->InputReport.wYData2 = (USHORT) Cache->FingerSlot[currentlyReporting].y; - - // - // Perform per-platform x/y adjustments to controller coordinates - // - TchTranslateToDisplayCoordinates( - &hidTouch->InputReport.wXData2, - &hidTouch->InputReport.wYData2, - Props); - - if (Cache->FingerSlot[currentlyReporting].fingerStatus) - { - hidTouch->InputReport.bStatus2 = RANGE_FINGER_STATUS; - } - - (*TouchesReported)++; - } - - // - // Though a single HID report can contain up to two touches, but more - // can be on the screen, ActualCount reflects the total number - // of touches that will be reported when the first report (of possibly - // many) is sent up - // - if (*TouchesReported == 1 || *TouchesReported == 2) - { - hidTouch->InputReport.ActualCount = (UCHAR) TouchesTotal; - } -} - -NTSTATUS -RmiServiceTouchDataInterrupt( - IN RMI4_CONTROLLER_CONTEXT* ControllerContext, - IN SPB_CONTEXT* SpbContext, - IN PHID_INPUT_REPORT HidReport, - IN UCHAR InputMode, - OUT BOOLEAN* PendingTouches - ) -/*++ - -Routine Description: - - Called when a touch interrupt needs service. Because we fill HID reports - with two touches at a time, if more than two touches were read from - hardware, we may need to complete this request from local cached state. - -Arguments: - - ControllerContext - Touch controller context - SpbContext - A pointer to the current SPB context (I2C, etc) - HidReport- Buffer to fill with a hid report if touch data is available - InputMode - Specifies mouse, single-touch, or multi-touch reporting modes - PendingTouches - Notifies caller if there are more touches to report, to - complete reporting the full state of fingers on the screen - -Return Value: - - NTSTATUS indicating whether or not the current hid report buffer was filled - - PendingTouches also indicates whether the caller should expect more than - one request to be completed to indicate the full state of fingers on - the screen ---*/ -{ - RMI4_F11_DATA_REGISTERS data; - NTSTATUS status; - - status = STATUS_SUCCESS; - RtlZeroMemory(&data, sizeof(data)); - NT_ASSERT(PendingTouches != NULL); - *PendingTouches = FALSE; - - // - // If no touches are unreported in our cache, read the next set of touches - // from hardware. - // - if (ControllerContext->TouchesReported == ControllerContext->TouchesTotal) - { - // - // See if new touch data is available - // - status = RmiGetTouchesFromController( - ControllerContext, - SpbContext, - &data - ); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_VERBOSE, - TRACE_FLAG_SAMPLES, - "No touch data to report - %!STATUS!", - status); - - goto exit; - } - - // - // Process the new touch data by updating our cached state - // - // - RmiUpdateLocalFingerCache( - &data, - &ControllerContext->Cache); - - // - // Prepare to report touches via HID reports - // - ControllerContext->TouchesReported = 0; - ControllerContext->TouchesTotal = - ControllerContext->Cache.FingerDownCount; - - // - // If no touches are present return that no data needed to be reported - // - if (ControllerContext->TouchesTotal == 0) - { - status = STATUS_NO_DATA_DETECTED; - goto exit; - } - } - - RtlZeroMemory(HidReport, sizeof(HID_INPUT_REPORT)); - - // - // Single-finger and HID-mouse input modes not implemented - // - if (MODE_MULTI_TOUCH != InputMode) - { - Trace( - TRACE_LEVEL_VERBOSE, - TRACE_FLAG_SAMPLES, - "Unable to report touches, only multitouch mode is supported"); - - status = STATUS_NOT_IMPLEMENTED; - goto exit; - } - - // - // Fill report with the next (max of two) cached touches - // - RmiFillNextHidReportFromCache( - HidReport, - &ControllerContext->Cache, - &ControllerContext->Props, - &ControllerContext->TouchesReported, - ControllerContext->TouchesTotal - ); - - // - // Update the caller if we still have outstanding touches to report - // - if (ControllerContext->TouchesReported < ControllerContext->TouchesTotal) - { - *PendingTouches = TRUE; - } - else - { - *PendingTouches = FALSE; - } - -exit: - - return status; -} - - -NTSTATUS -TchServiceInterrupts( - IN VOID *ControllerContext, - IN SPB_CONTEXT *SpbContext, - IN PHID_INPUT_REPORT HidReport, - IN UCHAR InputMode, - IN BOOLEAN *ServicingComplete - ) -/*++ - -Routine Description: - - This routine is called in response to an interrupt. The driver will - service chip interrupts, and if data is available to report to HID, - fill the Request object buffer with a HID report. - -Arguments: - - ControllerContext - Touch controller context - SpbContext - A pointer to the current i2c context - HidReport - Pointer to a HID_INPUT_REPORT structure to report to the OS - InputMode - Specifies mouse, single-touch, or multi-touch reporting modes - ServicingComplete - Notifies caller if there are more reports needed to - complete servicing interrupts coming from the hardware. - -Return Value: - - NTSTATUS indicating whether or not the current HidReport has been filled - - ServicingComplete indicates whether or not a new report buffer is required - to complete interrupt processing. ---*/ -{ - NTSTATUS status = STATUS_NO_DATA_DETECTED; - RMI4_CONTROLLER_CONTEXT* controller; - - controller = (RMI4_CONTROLLER_CONTEXT*) ControllerContext; - - NT_ASSERT(ServicingComplete != NULL); - - // - // Grab a waitlock to ensure the ISR executes serially and is - // protected against power state transitions - // - WdfWaitLockAcquire(controller->ControllerLock, NULL); - - // - // Check the interrupt source if no interrupts are pending processing - // - if (controller->InterruptStatus == 0) - { - status = RmiCheckInterrupts( - controller, - SpbContext, - &controller->InterruptStatus); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Error servicing interrupts - %!STATUS!", - status); - - *ServicingComplete = FALSE; - goto exit; - } - } - - // - // Driver only services 0D cap button and 2D touch messages currently - // - if (controller->InterruptStatus & - ~(RMI4_INTERRUPT_BIT_0D_CAP_BUTTON | RMI4_INTERRUPT_BIT_2D_TOUCH)) - { - Trace( - TRACE_LEVEL_WARNING, - TRACE_FLAG_INTERRUPT, - "Ignoring following interrupt flags - %!STATUS!", - controller->InterruptStatus & - ~(RMI4_INTERRUPT_BIT_0D_CAP_BUTTON | - RMI4_INTERRUPT_BIT_2D_TOUCH)); - - // - // Mask away flags we don't service - // - controller->InterruptStatus &= - (RMI4_INTERRUPT_BIT_0D_CAP_BUTTON | - RMI4_INTERRUPT_BIT_2D_TOUCH); - } - - // - // RmiServiceXXX routine will change status to STATUS_SUCCESS if there - // is a HID report to process. - // - status = STATUS_UNSUCCESSFUL; - - // - // Service a capacitive button event if indicated by hardware - // - if (controller->InterruptStatus & RMI4_INTERRUPT_BIT_0D_CAP_BUTTON) - { - status = RmiServiceCapacitiveButtonInterrupt( - ControllerContext, - SpbContext, - HidReport); - - controller->InterruptStatus &= ~RMI4_INTERRUPT_BIT_0D_CAP_BUTTON; - - // - // Success indicates the report is ready to be sent, otherwise, - // continue to service interrupts. - // - if (NT_SUCCESS(status)) - { - goto exit; - } - else - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Error processing cap button event - %!STATUS!", - status); - } - } - - // - // Service a touch data event if indicated by hardware - // - if (controller->InterruptStatus & RMI4_INTERRUPT_BIT_2D_TOUCH) - { - BOOLEAN pendingTouches = FALSE; - - status = RmiServiceTouchDataInterrupt( - ControllerContext, - SpbContext, - HidReport, - InputMode, - &pendingTouches); - - // - // If there are more touches to report, servicing is incomplete - // - if (pendingTouches == FALSE) - { - controller->InterruptStatus &= ~RMI4_INTERRUPT_BIT_2D_TOUCH; - } - - // - // Success indicates the report is ready to be sent, otherwise, - // continue to service interrupts. - // - if (NT_SUCCESS(status)) - { - goto exit; - } - else - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_INTERRUPT, - "Error processing touch event - %!STATUS!", - status); - } - } - - // - // Add servicing for additional touch interrupts here - // - -exit: - - // - // Indicate whether or not we're done servicing interrupts - // - if (controller->InterruptStatus == 0) - { - *ServicingComplete = TRUE; - } - else - { - *ServicingComplete = FALSE; - } - - WdfWaitLockRelease(controller->ControllerLock); - - return status; -} diff --git a/input/hiddigi/SynapticsTouch/resolutions.c b/input/hiddigi/SynapticsTouch/resolutions.c deleted file mode 100644 index c624b264..00000000 --- a/input/hiddigi/SynapticsTouch/resolutions.c +++ /dev/null @@ -1,526 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - resolutions.c - - Abstract: - - This module retrieves platform-specific configuration - parameters from the registry, and translates touch - controller pixel units to display pixel units. - - Environment: - - Kernel Mode - - Revision History: - ---*/ - -#include "rmiinternal.h" -#include "resolutions.tmh" - -// -// Registry values explaining the relationship of the touch -// controller coordinates to the physical LCD, as well as -// any differences between the physical LCD dimensons and -// viewable LCD area, are required. If not provided for whatever -// reason, we will assume everything is 480x800 and perfectly -// aligned. -// - -TOUCH_SCREEN_PROPERTIES gDefaultProperties = -{ - 0, - 0, - 0, - TOUCH_DEFAULT_RESOLUTION_X, - TOUCH_DEFAULT_RESOLUTION_Y, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - TOUCH_DEFAULT_RESOLUTION_X, - TOUCH_DEFAULT_RESOLUTION_Y, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - TOUCH_DEFAULT_RESOLUTION_X, - TOUCH_DEFAULT_RESOLUTION_Y -}; - - -RTL_QUERY_REGISTRY_TABLE gResParamsRegTable[] = -{ - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchSwapAxes", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchSwapAxes), - REG_DWORD, - &gDefaultProperties.TouchSwapAxes, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchInvertXAxis", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchInvertXAxis), - REG_DWORD, - &gDefaultProperties.TouchInvertXAxis, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchInvertYAxis", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchInvertYAxis), - REG_DWORD, - &gDefaultProperties.TouchInvertYAxis, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchPhysicalWidth", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchPhysicalWidth), - REG_DWORD, - &gDefaultProperties.TouchPhysicalWidth, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchPhysicalHeight", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchPhysicalHeight), - REG_DWORD, - &gDefaultProperties.TouchPhysicalHeight, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchPhysicalButtonHeight", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchPhysicalButtonHeight), - REG_DWORD, - &gDefaultProperties.TouchPhysicalButtonHeight, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchPillarBoxWidthLeft", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchPillarBoxWidthLeft), - REG_DWORD, - &gDefaultProperties.TouchPillarBoxWidthLeft, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchPillarBoxWidthRight", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchPillarBoxWidthRight), - REG_DWORD, - &gDefaultProperties.TouchPillarBoxWidthRight, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchLetterBoxHeightTop", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchLetterBoxHeightTop), - REG_DWORD, - &gDefaultProperties.TouchLetterBoxHeightTop, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"TouchLetterBoxHeightBottom", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, TouchLetterBoxHeightBottom), - REG_DWORD, - &gDefaultProperties.TouchLetterBoxHeightBottom, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DisplayPhysicalWidth", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, DisplayPhysicalWidth), - REG_DWORD, - &gDefaultProperties.DisplayPhysicalWidth, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DisplayPhysicalHeight", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, DisplayPhysicalHeight), - REG_DWORD, - &gDefaultProperties.DisplayPhysicalHeight, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DisplayViewableWidth", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, DisplayViewableWidth), - REG_DWORD, - &gDefaultProperties.DisplayViewableWidth, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DisplayViewableHeight", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, DisplayViewableHeight), - REG_DWORD, - &gDefaultProperties.DisplayViewableHeight, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DisplayPillarBoxWidthLeft", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, DisplayPillarBoxWidthLeft), - REG_DWORD, - &gDefaultProperties.DisplayPillarBoxWidthLeft, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DisplayPillarBoxWidthRight", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, DisplayPillarBoxWidthRight), - REG_DWORD, - &gDefaultProperties.DisplayPillarBoxWidthRight, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DisplayLetterBoxHeightTop", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, DisplayLetterBoxHeightTop), - REG_DWORD, - &gDefaultProperties.DisplayLetterBoxHeightTop, - sizeof(ULONG) - }, - { - NULL, RTL_QUERY_REGISTRY_DIRECT, - L"DisplayLetterBoxHeightBottom", - (PVOID) FIELD_OFFSET(TOUCH_SCREEN_PROPERTIES, DisplayLetterBoxHeightBottom), - REG_DWORD, - &gDefaultProperties.DisplayLetterBoxHeightBottom, - sizeof(ULONG) - }, - // - // List Terminator - set to NULL to indicate end of table - // - { - NULL, 0, - NULL, - 0, - REG_DWORD, - NULL, - 0 - } -}; - -static const ULONG gcbRegistryTable = sizeof(gResParamsRegTable); -static const ULONG gcRegistryTable = - sizeof(gResParamsRegTable) / sizeof(gResParamsRegTable[0]); - - -VOID -TchTranslateToDisplayCoordinates( - IN PUSHORT PX, - IN PUSHORT PY, - IN PTOUCH_SCREEN_PROPERTIES Props - ) -/*++ - - Routine Description: - - This routine performs translations on touch coordinates - to ensure points reported to the OS match pixels on the - display. - - Arguments: - - X - pointer to the pre-processed X coordinate - Y - pointer the pre-processed Y coordinate - Props - pointer to screen information - - Return Value: - - None. The X/Y values will be modified by this function. - ---*/ -{ - ULONG X; - ULONG Y; - - // - // Avoid overflow - // - X = (ULONG) *PX; - Y = (ULONG) *PY; - - // - // Swap the axes reported by the touch controller if requested - // - if (Props->TouchSwapAxes) - { - ULONG temp = Y; - Y = X; - X = temp; - } - - // - // Invert the coordinates as requested - // - if (Props->TouchInvertXAxis) - { - if (X >= Props->TouchPhysicalWidth) - { - X = Props->TouchPhysicalWidth - 1u; - } - - X = Props->TouchPhysicalWidth - X - 1u; - } - if (Props->TouchInvertYAxis) - { - if (Y >= Props->TouchPhysicalHeight) - { - Y = Props->TouchPhysicalHeight - 1u; - } - - Y = Props->TouchPhysicalHeight - Y - 1u; - } - - // - // Handle touch clipping boundaries so touch matches - // the physical display - // - if (X <= Props->TouchPillarBoxWidthLeft) - { - X = 0; - } - else - { - X -= Props->TouchPillarBoxWidthLeft; - } - if (Y <= Props->TouchLetterBoxHeightTop) - { - Y = 0; - } - else - { - Y -= Props->TouchLetterBoxHeightTop; - } - if (X >= Props->TouchAdjustedWidth) - { - X = Props->TouchAdjustedWidth - 1u; - } - if (Y >= Props->TouchAdjustedHeight) - { - Y = Props->TouchAdjustedHeight - 1u; - } - - // - // Scale the raw touch pixel units into physical display pixels, - // leaving off the capacitive button region. - // - X = X * Props->DisplayPhysicalWidth / Props->TouchAdjustedWidth; - Y = Y * Props->DisplayPhysicalHeight / - (Props->TouchAdjustedHeight - Props->TouchPhysicalButtonHeight); - - // - // If the display is additionally being letterboxed or pillarboxed, make - // further adjustments to the touch coordinates. - // - if (X <= Props->DisplayPillarBoxWidthLeft) - { - X = 0; - } - else - { - X -= Props->DisplayPillarBoxWidthLeft; - } - if (Y <= Props->DisplayLetterBoxHeightTop) - { - Y = 0; - } - else - { - Y -= Props->DisplayLetterBoxHeightTop; - } - if (X >= Props->DisplayAdjustedWidth) - { - X = Props->DisplayAdjustedWidth - 1u; - } - if (Y >= Props->DisplayAdjustedHeight) - { - Y = Props->DisplayAdjustedHeight - 1u; - } - - X = X * Props->DisplayViewableWidth / Props->DisplayAdjustedWidth; - Y = Y * Props->DisplayViewableHeight / - (Props->DisplayAdjustedHeight - Props->DisplayAdjustedButtonHeight); - - Trace( - TRACE_LEVEL_INFORMATION, - TRACE_FLAG_REPORTING, - "In (%d,%d), Out (%d,%d)", - *PX, *PY, X, Y); - - *PX = (USHORT) X; - *PY = (USHORT) Y; -} - -VOID -TchGetScreenProperties( - IN PTOUCH_SCREEN_PROPERTIES Props - ) -/*++ - - Routine Description: - - This routine retrieves coordinate translation settings - from the registry. - - Arguments: - - Props - receives the Props - - Return Value: - - None. On failure, defaults are returned. - ---*/ -{ - ULONG i; - PRTL_QUERY_REGISTRY_TABLE regTable; - NTSTATUS status; - - regTable = NULL; - - // - // Table passed to RtlQueryRegistryValues must be allocated - // from NonPagedPoolNx - // - regTable = ExAllocatePoolWithTag( - NonPagedPoolNx, - gcbRegistryTable, - TOUCH_POOL_TAG); - - RtlCopyMemory( - regTable, - gResParamsRegTable, - gcbRegistryTable); - - // - // Update offset values with base pointer - // - for (i=0; i < gcRegistryTable-1; i++) - { - regTable[i].EntryContext = (PVOID) ( - ((SIZE_T) regTable[i].EntryContext) + - ((ULONG_PTR) Props)); - } - - // - // Start with default values - // - RtlCopyMemory( - Props, - &gDefaultProperties, - sizeof(TOUCH_SCREEN_PROPERTIES)); - - // - // Populate device context with registry overrides (or defaults) - // - status = RtlQueryRegistryValues( - RTL_REGISTRY_ABSOLUTE, - TOUCH_SCREEN_PROPERTIES_REG_KEY, - regTable, - NULL, - NULL); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_WARNING, - TRACE_FLAG_REGISTRY, - "Error retrieving registry configuration - %!STATUS!", - status); - } - - // - // Sanity check values provided from the registry - // - - if (Props->TouchPillarBoxWidthLeft + - Props->TouchPillarBoxWidthRight >= - Props->TouchPhysicalWidth) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_REGISTRY, - "Invalid pillar box widths provided (%d,%d for %d)", - Props->TouchPillarBoxWidthLeft, - Props->TouchPillarBoxWidthRight, - Props->TouchPhysicalWidth); - - Props->TouchPillarBoxWidthLeft = - gDefaultProperties.TouchPillarBoxWidthLeft; - Props->TouchPillarBoxWidthRight = - gDefaultProperties.TouchPillarBoxWidthRight; - - } - - if (Props->TouchLetterBoxHeightTop + - Props->TouchLetterBoxHeightBottom >= - Props->TouchPhysicalHeight) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_REGISTRY, - "Invalid letter box heights provided (%d,%d for %d)", - Props->TouchLetterBoxHeightTop, - Props->TouchLetterBoxHeightBottom, - Props->TouchPhysicalHeight); - - Props->TouchLetterBoxHeightTop = - gDefaultProperties.TouchLetterBoxHeightTop; - Props->TouchLetterBoxHeightBottom = - gDefaultProperties.TouchLetterBoxHeightBottom; - } - - // - // Calculate a few parameters for later use - // - Props->TouchAdjustedWidth = - Props->TouchPhysicalWidth - - Props->TouchPillarBoxWidthLeft - - Props->TouchPillarBoxWidthRight; - - Props->TouchAdjustedHeight = - Props->TouchPhysicalHeight - - Props->TouchLetterBoxHeightTop - - Props->TouchLetterBoxHeightBottom; - - Props->DisplayAdjustedWidth = - Props->DisplayPhysicalWidth - - Props->DisplayPillarBoxWidthLeft - - Props->DisplayPillarBoxWidthRight; - - Props->DisplayAdjustedButtonHeight = - Props->TouchPhysicalButtonHeight * - Props->DisplayPhysicalHeight / - (Props->TouchAdjustedHeight - Props->TouchPhysicalButtonHeight); - - Props->DisplayAdjustedHeight = - Props->DisplayPhysicalHeight - - Props->DisplayLetterBoxHeightTop - - Props->DisplayLetterBoxHeightBottom + - Props->DisplayAdjustedButtonHeight; - - if (regTable != NULL) - { - ExFreePoolWithTag(regTable, TOUCH_POOL_TAG); - } -}
\ No newline at end of file diff --git a/input/hiddigi/SynapticsTouch/resolutions.h b/input/hiddigi/SynapticsTouch/resolutions.h deleted file mode 100644 index e6de12c4..00000000 --- a/input/hiddigi/SynapticsTouch/resolutions.h +++ /dev/null @@ -1,66 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - resolutions.h - - Abstract: - - Contains resolution translation defines and types - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - -#define TOUCH_SCREEN_PROPERTIES_REG_KEY L"\\Registry\\Machine\\System\\TOUCH\\SCREENPROPERTIES" -#define TOUCH_DEFAULT_RESOLUTION_X 480 -#define TOUCH_DEFAULT_RESOLUTION_Y 800 -#define TOUCH_DEVICE_RESOLUTION_X 816 -#define TOUCH_DEVICE_RESOLUTION_Y 1394 - -typedef struct _TOUCH_SCREEN_PROPERTIES -{ - ULONG TouchSwapAxes; - ULONG TouchInvertXAxis; - ULONG TouchInvertYAxis; - ULONG TouchPhysicalWidth; - ULONG TouchPhysicalHeight; - ULONG TouchPhysicalButtonHeight; - ULONG TouchPillarBoxWidthLeft; - ULONG TouchPillarBoxWidthRight; - ULONG TouchLetterBoxHeightTop; - ULONG TouchLetterBoxHeightBottom; - ULONG TouchAdjustedWidth; - ULONG TouchAdjustedHeight; - ULONG DisplayPhysicalWidth; - ULONG DisplayPhysicalHeight; - ULONG DisplayAdjustedButtonHeight; - ULONG DisplayPillarBoxWidthLeft; - ULONG DisplayPillarBoxWidthRight; - ULONG DisplayLetterBoxHeightTop; - ULONG DisplayLetterBoxHeightBottom; - ULONG DisplayAdjustedWidth; - ULONG DisplayAdjustedHeight; - ULONG DisplayViewableWidth; - ULONG DisplayViewableHeight; -} TOUCH_SCREEN_PROPERTIES, *PTOUCH_SCREEN_PROPERTIES; - -VOID -TchGetScreenProperties( - IN PTOUCH_SCREEN_PROPERTIES Props - ); - -VOID -TchTranslateToDisplayCoordinates( - IN PUSHORT X, - IN PUSHORT Y, - IN PTOUCH_SCREEN_PROPERTIES Props - ); diff --git a/input/hiddigi/SynapticsTouch/rmiinternal.h b/input/hiddigi/SynapticsTouch/rmiinternal.h deleted file mode 100644 index ae767e54..00000000 --- a/input/hiddigi/SynapticsTouch/rmiinternal.h +++ /dev/null @@ -1,579 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - rmiinternal.h - - Abstract: - - Contains common types and defintions used internally - by the multi touch screen driver. - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - -#include <wdm.h> -#include <wdf.h> -#include "controller.h" -#include "resolutions.h" - - -// Ignore warning C4152: nonstandard extension, function/data pointer conversion in expression -#pragma warning (disable : 4152) - -// Ignore warning C4201: nonstandard extension used : nameless struct/union -#pragma warning (disable : 4201) - -// Ignore warning C4201: nonstandard extension used : bit field types other than in -#pragma warning (disable : 4214) - -// Ignore warning C4324: 'xxx' : structure was padded due to __declspec(align()) -#pragma warning (disable : 4324) - - -// -// Defines from Synaptics RMI4 Data Sheet, please refer to -// the spec for details about the fields and values. -// - -#define RMI4_FIRST_FUNCTION_ADDRESS 0xE9 -#define RMI4_PAGE_SELECT_ADDRESS 0xFF - -#define RMI4_F01_RMI_DEVICE_CONTROL 0x01 -#define RMI4_F11_2D_TOUCHPAD_SENSOR 0x11 -#define RMI4_F1A_0D_CAP_BUTTON_SENSOR 0x1A -#define RMI4_F34_FLASH_MEMORY_MANAGEMENT 0x34 -#define RMI4_F54_TEST_REPORTING 0x54 - -#define RMI4_MAX_FUNCTIONS 10 -#define RMI4_MAX_TOUCHES 10 - -typedef struct _RMI4_FUNCTION_DESCRIPTOR -{ - BYTE QueryBase; - BYTE CommandBase; - BYTE ControlBase; - BYTE DataBase; - union - { - BYTE All; - struct - { - BYTE IrqCount : 3; - BYTE Reserved0 : 2; - BYTE FuncVer : 2; - BYTE Reserved1 : 1; - }; - } VersionIrq; - BYTE Number; -} RMI4_FUNCTION_DESCRIPTOR; - -// -// Function $01 - RMI Device Control -// - -typedef struct _RMI4_F01_QUERY_REGISTERS -{ - BYTE ManufacturerID; - union - { - BYTE All; - struct - { - BYTE CustomMap : 1; - BYTE NonCompliant : 1; - BYTE Reserved0 : 1; - BYTE HasSensorID : 1; - BYTE Reserved1 : 1; - BYTE HasAdjDoze : 1; - BYTE HasAdJDozeHold : 1; - BYTE Reserved2 : 1; - }; - } ProductProperties; - BYTE ProductInfo0; - BYTE ProductInfo1; - BYTE Date0; - BYTE Date1; - BYTE WaferLotId0Lo; - BYTE WaferLotId0Hi; - BYTE WaferLotId1Lo; - BYTE WaferLotId1Hi; - BYTE WaferLotId2Lo; - BYTE ProductID1; - BYTE ProductID2; - BYTE ProductID3; - BYTE ProductID4; - BYTE ProductID5; - BYTE ProductID6; - BYTE ProductID7; - BYTE ProductID8; - BYTE ProductID9; - BYTE ProductID10; - BYTE Reserved21; - BYTE SendorID; - BYTE Reserved23; - BYTE Reserved24; - BYTE Reserved25; - BYTE Reserved26; - BYTE Reserved27; - BYTE Reserved28; - BYTE Reserved29; - BYTE Reserved30; - BYTE Reserved31; -} RMI4_F01_QUERY_REGISTERS; - -typedef struct _RMI4_F01_CTRL_REGISTERS -{ - union - { - BYTE All; - struct - { - BYTE SleepMode :2; - BYTE NoSleep :1; - BYTE Reserved0 :3; - BYTE ReportRate :1; - BYTE Configured :1; - }; - } DeviceControl; - BYTE InterruptEnable; - BYTE DozeInterval; - BYTE DozeThreshold; - BYTE DozeHoldoff; -} RMI4_F01_CTRL_REGISTERS; - -#define RMI4_F11_DEVICE_CONTROL_SLEEP_MODE_OPERATING 0 -#define RMI4_F11_DEVICE_CONTROL_SLEEP_MODE_SLEEPING 1 - -// -// Logical structure for getting registry config settings -// -typedef struct _RM4_F01_CTRL_REGISTERS_LOGICAL -{ - UINT32 SleepMode; - UINT32 NoSleep; - UINT32 ReportRate; - UINT32 Configured; - UINT32 InterruptEnable; - UINT32 DozeInterval; - UINT32 DozeThreshold; - UINT32 DozeHoldoff; -} RMI4_F01_CTRL_REGISTERS_LOGICAL; - -#define RMI4_MILLISECONDS_TO_TENTH_MILLISECONDS(n) n/10 -#define RMI4_SECONDS_TO_HALF_SECONDS(n) 2*n - -typedef struct _RMI4_F01_DATA_REGISTERS -{ - union { - BYTE All; - struct - { - BYTE Status : 4; - BYTE Reserved0 : 2; - BYTE FlashProg : 1; - BYTE Unconfigured : 1; - }; - } DeviceStatus; - BYTE InterruptStatus[1]; -} RMI4_F01_DATA_REGISTERS; - -#define RMI4_INTERRUPT_BIT_2D_TOUCH 0x04 -#define RMI4_INTERRUPT_BIT_0D_CAP_BUTTON 0x20 - -#define RMI4_F01_DATA_STATUS_NO_ERROR 0 -#define RMI4_F01_DATA_STATUS_RESET_OCCURRED 1 -#define RMI4_F01_DATA_STATUS_INVALID_CONFIG 2 -#define RMI4_F01_DATA_STATUS_DEVICE_FAILURE 3 -#define RMI4_F01_DATA_STATUS_CONFIG_CRC_FAILURE 4 -#define RMI4_F01_DATA_STATUS_FW_CRC_FAILURE 5 -#define RMI4_F01_DATA_STATUS_CRC_IN_PROGRESS 6 - -typedef struct _RMI4_F01_COMMAND_REGISTERS -{ - BYTE Reset; -} RMI4_F01_COMMAND_REGISTERS; - -// -// Function $11 - 2-D Touch Sensor -// - -typedef struct _RMI4_F11_QUERY_REGISTERS -{ - struct - { - BYTE NumberOfSensors : 3; - BYTE Reserved0 : 1; - BYTE HasQuery11 : 1; - BYTE Reserved1 : 3; - }; - struct - { - BYTE NumberOfFingers : 3; - BYTE HasRelative : 1; - BYTE HasAbsolute : 1; - BYTE HasGestures : 1; - BYTE HasSensitivity : 1; - BYTE Configurable : 1; - }; - BYTE NumXElectrodes; - BYTE NumYElectrodes; - BYTE MaxElectrodes; - struct - { - BYTE AbsDataSize : 2; - BYTE HasAnchoredFin : 1; - BYTE HasAdjHyst : 1; - BYTE HasDribble : 1; - BYTE Reserved2 : 3; - }; - struct - { - BYTE HasZTuning : 1; - BYTE HasAlgoSelect : 1; - BYTE HasWTuning : 1; - BYTE HasPitchInfo : 1; - BYTE HasFingerSize : 1; - BYTE HasObjSensAdj : 1; - BYTE HasXYClip : 1; - BYTE HasDrummingAdj : 1; - }; -} RMI4_F11_QUERY_REGISTERS; - -typedef struct _RMI4_F11_CTRL_REGISTERS -{ - struct - { - BYTE ReportingMode : 3; - BYTE AbsPosFilt : 1; - BYTE RelPosFilt : 1; - BYTE RelBallistics : 1; - BYTE Dribble : 1; - BYTE Reserved0 : 1; - }; - struct - { - BYTE PalmDetectThreshold : 4; - BYTE MotionSensitivity : 2; - BYTE ManTrackEn : 1; - BYTE ManTrackedFinger : 1; - }; - BYTE DeltaXPosThreshold; - BYTE DeltaYPosThreshold; - BYTE Velocity; - BYTE Acceleration; - BYTE SensorMaxXPosLo; - struct - { - BYTE SensorMaxXPosHi : 4; - BYTE Reserved1 : 4; - }; - BYTE SensorMaxYPosLo; - struct - { - BYTE SensorMaxYPosHi : 4; - BYTE Reserved2 : 4; - }; - // - // Note gap in registers on 3200 - // - BYTE ZTouchThreshold; - BYTE ZHysteresis; - BYTE SmallZThreshold; - BYTE SmallZScaleFactor[2]; - BYTE LargeZScaleFactor[2]; - BYTE AlgorithmSelection; - BYTE WxScaleFactor; - BYTE WxOffset; - BYTE WyScaleFactor; - BYTE WyOffset; - BYTE XPitch[2]; - BYTE YPitch[2]; - BYTE FingerWidthX[2]; - BYTE FingerWidthY[2]; - BYTE ReportMeasuredSize; - BYTE SegmentationSensitivity; - BYTE XClipLo; - BYTE XClipHi; - BYTE YClipLo; - BYTE YClipHi; - BYTE MinFingerSeparation; - BYTE MaxFingerMovement; -} RMI4_F11_CTRL_REGISTERS; - -// -// Logical structure for getting registry config settings -// -typedef struct _RMI4_F11_CTRL_REGISTERS_LOGICAL -{ - UINT32 ReportingMode; - UINT32 AbsPosFilt; - UINT32 RelPosFilt; - UINT32 RelBallistics; - UINT32 Dribble; - UINT32 PalmDetectThreshold; - UINT32 MotionSensitivity; - UINT32 ManTrackEn; - UINT32 ManTrackedFinger; - UINT32 DeltaXPosThreshold; - UINT32 DeltaYPosThreshold; - UINT32 Velocity; - UINT32 Acceleration; - UINT32 SensorMaxXPos; - UINT32 SensorMaxYPos; - UINT32 ZTouchThreshold; - UINT32 ZHysteresis; - UINT32 SmallZThreshold; - UINT32 SmallZScaleFactor; - UINT32 LargeZScaleFactor; - UINT32 AlgorithmSelection; - UINT32 WxScaleFactor; - UINT32 WxOffset; - UINT32 WyScaleFactor; - UINT32 WyOffset; - UINT32 XPitch; - UINT32 YPitch; - UINT32 FingerWidthX; - UINT32 FingerWidthY; - UINT32 ReportMeasuredSize; - UINT32 SegmentationSensitivity; - UINT32 XClipLo; - UINT32 XClipHi; - UINT32 YClipLo; - UINT32 YClipHi; - UINT32 MinFingerSeparation; - UINT32 MaxFingerMovement; -} RMI4_F11_CTRL_REGISTERS_LOGICAL; - -typedef struct _RMI4_F11_DATA_POSITION -{ - BYTE XPosHi; - BYTE YPosHi; - struct - { - BYTE XPosLo : 4; - BYTE YPosLo : 4; - }; - struct - { - BYTE XWidth : 4; - BYTE YWidth : 4; - }; - BYTE ZAmplitude; -} RMI4_F11_DATA_POSITION; - -typedef struct _RMI4_F11_DATA_REGISTERS_STATUS_BLOCK -{ - struct - { - BYTE FingerState0 : 2; - BYTE FingerState1 : 2; - BYTE FingerState2 : 2; - BYTE FingerState3 : 2; - }; - struct - { - BYTE FingerState4 : 2; - BYTE FingerState5 : 2; - BYTE FingerState6 : 2; - BYTE FingerState7 : 2; - }; - struct - { - BYTE FingerState8 : 2; - BYTE FingerState9 : 2; - BYTE Reserved0 : 4; - }; -} RMI4_F11_DATA_REGISTERS_STATUS_BLOCK; - -typedef struct _RMI4_F11_DATA_REGISTERS -{ - RMI4_F11_DATA_REGISTERS_STATUS_BLOCK Status; - RMI4_F11_DATA_POSITION Finger[RMI4_MAX_TOUCHES]; -} RMI4_F11_DATA_REGISTERS; - -#define RMI4_FINGER_STATE_NOT_PRESENT 0 -#define RMI4_FINGER_STATE_PRESENT_WITH_ACCURATE_POS 1 -#define RMI4_FINGER_STATE_PRESENT_WITH_INACCURATE_POS 2 -#define RMI4_FINGER_STATE_RESERVED 3 - -// -// Function $1A - 0-D Capacitive Button Sensors -// - -typedef struct _RMI4_F1A_QUERY_REGISTERS -{ - struct - { - BYTE MaxButtonCount : 2; - BYTE Reserved0 : 5; - }; - struct - { - BYTE HasGenControl : 1; - BYTE HasIntEnable : 1; - BYTE HasMultiButSel : 1; - BYTE HasTxRxMapping : 1; - BYTE HasPerButThresh : 1; - BYTE HasRelThresh : 1; - BYTE HasStrongButHyst: 1; - BYTE HasFiltStrength : 1; - }; -} RMI4_F1A_QUERY_REGISTERS; - -typedef struct _RMI4_F1A_CTRL_REGISTERS -{ - struct - { - BYTE MultiButtonRpt : 2; - BYTE FilterMode : 2; - BYTE Reserved0 : 4; - }; - struct - { - BYTE IntEnBtn0 : 1; - BYTE IntEnBtn1 : 1; - BYTE IntEnBtn2 : 1; - BYTE IntEnBtn3 : 1; - BYTE Reserved1 : 4; - }; - struct - { - BYTE MultiBtn0 : 1; - BYTE MultiBtn1 : 1; - BYTE MultiBtn2 : 1; - BYTE MultiBtn3 : 1; - BYTE Reserved2 : 4; - }; - BYTE PhysicalTx0; - BYTE PhysicalRx0; - BYTE PhysicalTx1; - BYTE PhysicalRx1; - BYTE PhysicalTx2; - BYTE PhysicalRx2; - BYTE PhysicalTx3; - BYTE PhysicalRx3; - BYTE Threshold0; - BYTE Threshold1; - BYTE Threshold2; - BYTE Threshold3; - BYTE ReleaseThreshold; - BYTE StrongButtonHyst; - BYTE FilterStrength; -} RMI4_F1A_CTRL_REGISTERS; - -typedef struct _RMI4_F1A_DATA_REGISTERS -{ - struct - { - BYTE Button0 : 1; - BYTE Button1 : 1; - BYTE Button2 : 1; - BYTE Button3 : 1; - BYTE Reserved0 : 4; - }; -} RMI4_F1A_DATA_REGISTERS; - -// -// Function $XX - Add new support functions here -// - - -// -// Driver structures -// - -typedef struct _RMI4_CONFIGURATION -{ - RMI4_F01_CTRL_REGISTERS_LOGICAL DeviceSettings; - RMI4_F11_CTRL_REGISTERS_LOGICAL TouchSettings; - UINT32 PepRemovesVoltageInD3; -} RMI4_CONFIGURATION; - -typedef struct _RMI4_FINGER_INFO -{ - int x; - int y; - UCHAR fingerStatus; -} RMI4_FINGER_INFO; - -typedef struct _RMI4_FINGER_CACHE -{ - RMI4_FINGER_INFO FingerSlot[RMI4_MAX_TOUCHES]; - UINT32 FingerSlotValid; - UINT32 FingerSlotDirty; - int FingerDownOrder[RMI4_MAX_TOUCHES]; - int FingerDownCount; -} RMI4_FINGER_CACHE; - -typedef struct _RMI4_CONTROLLER_CONTEXT -{ - WDFDEVICE FxDevice; - WDFWAITLOCK ControllerLock; - - // - // Controller state - // - int FunctionCount; - RMI4_FUNCTION_DESCRIPTOR Descriptors[RMI4_MAX_FUNCTIONS]; - int FunctionOnPage[RMI4_MAX_FUNCTIONS]; - int CurrentPage; - - ULONG InterruptStatus; - BOOLEAN HasButtons; - BOOLEAN ResetOccurred; - BOOLEAN InvalidConfiguration; - BOOLEAN DeviceFailure; - BOOLEAN UnknownStatus; - BYTE UnknownStatusMessage; - RMI4_F01_QUERY_REGISTERS F01QueryRegisters; - - // - // Power state - // - DEVICE_POWER_STATE DevicePowerState; - - // - // Register configuration programmed to chip - // - TOUCH_SCREEN_PROPERTIES Props; - RMI4_CONFIGURATION Config; - - // - // Current touch state - // - int TouchesReported; - int TouchesTotal; - RMI4_FINGER_CACHE Cache; - -} RMI4_CONTROLLER_CONTEXT; - -NTSTATUS -RmiCheckInterrupts( - IN RMI4_CONTROLLER_CONTEXT *ControllerContext, - IN SPB_CONTEXT *SpbContext, - IN ULONG* InterruptStatus - ); - -int -RmiGetFunctionIndex( - IN RMI4_FUNCTION_DESCRIPTOR* FunctionDescriptors, - IN int FunctionCount, - IN int FunctionDesired - ); - -NTSTATUS -RmiChangePage( - IN RMI4_CONTROLLER_CONTEXT* ControllerContext, - IN SPB_CONTEXT* SpbContext, - IN int DesiredPage - ); diff --git a/input/hiddigi/SynapticsTouch/spb.c b/input/hiddigi/SynapticsTouch/spb.c deleted file mode 100644 index 85207c2a..00000000 --- a/input/hiddigi/SynapticsTouch/spb.c +++ /dev/null @@ -1,512 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - spb.c - - Abstract: - - Contains all I2C-specific functionality - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#include "internal.h" -#include "controller.h" -#include "spb.tmh" - -NTSTATUS -SpbDoWriteDataSynchronously( - IN SPB_CONTEXT *SpbContext, - IN UCHAR Address, - IN PVOID Data, - IN ULONG Length - ) -/*++ - - Routine Description: - - This helper routine abstracts creating and sending an I/O - request (I2C Write) to the Spb I/O target. - - Arguments: - - SpbContext - Pointer to the current device context - Address - The I2C register address to write to - Data - A buffer to receive the data at at the above address - Length - The amount of data to be read from the above address - - Return Value: - - NTSTATUS Status indicating success or failure - ---*/ -{ - PUCHAR buffer; - ULONG length; - WDFMEMORY memory; - WDF_MEMORY_DESCRIPTOR memoryDescriptor; - NTSTATUS status; - - // - // The address pointer and data buffer must be combined - // into one contiguous buffer representing the write transaction. - // - length = Length + 1; - memory = NULL; - - if (length > DEFAULT_SPB_BUFFER_SIZE) - { - status = WdfMemoryCreate( - WDF_NO_OBJECT_ATTRIBUTES, - NonPagedPoolNx, - TOUCH_POOL_TAG, - length, - &memory, - &buffer); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error allocating memory for Spb write - %!STATUS!", - status); - goto exit; - } - - WDF_MEMORY_DESCRIPTOR_INIT_HANDLE( - &memoryDescriptor, - memory, - NULL); - } - else - { - buffer = (PUCHAR) WdfMemoryGetBuffer(SpbContext->WriteMemory, NULL); - - WDF_MEMORY_DESCRIPTOR_INIT_BUFFER( - &memoryDescriptor, - (PVOID) buffer, - length); - } - - // - // Transaction starts by specifying the address bytes - // - RtlCopyMemory(buffer, &Address, sizeof(Address)); - - // - // Address is followed by the data payload - // - RtlCopyMemory((buffer+sizeof(Address)), Data, length-sizeof(Address)); - - status = WdfIoTargetSendWriteSynchronously( - SpbContext->SpbIoTarget, - NULL, - &memoryDescriptor, - NULL, - NULL, - NULL); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error writing to Spb - %!STATUS!", - status); - goto exit; - } - -exit: - - if (NULL != memory) - { - WdfObjectDelete(memory); - } - - return status; -} - -NTSTATUS -SpbWriteDataSynchronously( - IN SPB_CONTEXT *SpbContext, - IN UCHAR Address, - IN PVOID Data, - IN ULONG Length - ) -/*++ - - Routine Description: - - This routine abstracts creating and sending an I/O - request (I2C Write) to the Spb I/O target and utilizes - a helper routine to do work inside of locked code. - - Arguments: - - SpbContext - Pointer to the current device context - Address - The I2C register address to write to - Data - A buffer to receive the data at at the above address - Length - The amount of data to be read from the above address - - Return Value: - - NTSTATUS Status indicating success or failure - ---*/ -{ - NTSTATUS status; - - WdfWaitLockAcquire(SpbContext->SpbLock, NULL); - - status = SpbDoWriteDataSynchronously( - SpbContext, - Address, - Data, - Length); - - WdfWaitLockRelease(SpbContext->SpbLock); - - return status; -} - -NTSTATUS -SpbReadDataSynchronously( - _In_ SPB_CONTEXT *SpbContext, - _In_ UCHAR Address, - _In_reads_bytes_(Length) PVOID Data, - _In_ ULONG Length - ) -/*++ - - Routine Description: - - This helper routine abstracts creating and sending an I/O - request (I2C Read) to the Spb I/O target. - - Arguments: - - SpbContext - Pointer to the current device context - Address - The I2C register address to read from - Data - A buffer to receive the data at at the above address - Length - The amount of data to be read from the above address - - Return Value: - - NTSTATUS Status indicating success or failure - ---*/ -{ - PUCHAR buffer; - WDFMEMORY memory; - WDF_MEMORY_DESCRIPTOR memoryDescriptor; - NTSTATUS status; - ULONG_PTR bytesRead; - - WdfWaitLockAcquire(SpbContext->SpbLock, NULL); - - memory = NULL; - status = STATUS_INVALID_PARAMETER; - bytesRead = 0; - - // - // Read transactions start by writing an address pointer - // - status = SpbDoWriteDataSynchronously( - SpbContext, - Address, - NULL, - 0); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error setting address pointer for Spb read - %!STATUS!", - status); - goto exit; - } - - if (Length > DEFAULT_SPB_BUFFER_SIZE) - { - status = WdfMemoryCreate( - WDF_NO_OBJECT_ATTRIBUTES, - NonPagedPoolNx, - TOUCH_POOL_TAG, - Length, - &memory, - &buffer); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error allocating memory for Spb read - %!STATUS!", - status); - goto exit; - } - - WDF_MEMORY_DESCRIPTOR_INIT_HANDLE( - &memoryDescriptor, - memory, - NULL); - } - else - { - buffer = (PUCHAR) WdfMemoryGetBuffer(SpbContext->ReadMemory, NULL); - - WDF_MEMORY_DESCRIPTOR_INIT_BUFFER( - &memoryDescriptor, - (PVOID) buffer, - Length); - } - - - status = WdfIoTargetSendReadSynchronously( - SpbContext->SpbIoTarget, - NULL, - &memoryDescriptor, - NULL, - NULL, - &bytesRead); - - if (!NT_SUCCESS(status) || - bytesRead != Length) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error reading from Spb - %!STATUS!", - status); - goto exit; - } - - // - // Copy back to the caller's buffer - // - RtlCopyMemory(Data, buffer, Length); - -exit: - if (NULL != memory) - { - WdfObjectDelete(memory); - } - - WdfWaitLockRelease(SpbContext->SpbLock); - - return status; -} - -VOID -SpbTargetDeinitialize( - IN WDFDEVICE FxDevice, - IN SPB_CONTEXT *SpbContext - ) -/*++ - - Routine Description: - - This helper routine is used to free any members added to the SPB_CONTEXT, - note the SPB I/O target is parented to the device and will be - closed and free'd when the device is removed. - - Arguments: - - FxDevice - Handle to the framework device object - SpbContext - Pointer to the current device context - - Return Value: - - NTSTATUS Status indicating success or failure - ---*/ -{ - UNREFERENCED_PARAMETER(FxDevice); - UNREFERENCED_PARAMETER(SpbContext); - - // - // Free any SPB_CONTEXT allocations here - // - if (SpbContext->SpbLock != NULL) - { - WdfObjectDelete(SpbContext->SpbLock); - } - - if (SpbContext->ReadMemory != NULL) - { - WdfObjectDelete(SpbContext->ReadMemory); - } - - if (SpbContext->WriteMemory != NULL) - { - WdfObjectDelete(SpbContext->WriteMemory); - } -} - -NTSTATUS -SpbTargetInitialize( - IN WDFDEVICE FxDevice, - IN SPB_CONTEXT *SpbContext - ) -/*++ - - Routine Description: - - This helper routine opens the Spb I/O target and - initializes a request object used for the lifetime - of communication between this driver and Spb. - - Arguments: - - FxDevice - Handle to the framework device object - SpbContext - Pointer to the current device context - - Return Value: - - NTSTATUS Status indicating success or failure - ---*/ -{ - WDF_OBJECT_ATTRIBUTES objectAttributes; - WDF_IO_TARGET_OPEN_PARAMS openParams; - UNICODE_STRING spbDeviceName; - WCHAR spbDeviceNameBuffer[RESOURCE_HUB_PATH_SIZE]; - NTSTATUS status; - - WDF_OBJECT_ATTRIBUTES_INIT(&objectAttributes); - objectAttributes.ParentObject = FxDevice; - - status = WdfIoTargetCreate( - FxDevice, - &objectAttributes, - &SpbContext->SpbIoTarget); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error creating IoTarget object - %!STATUS!", - status); - - WdfObjectDelete(SpbContext->SpbIoTarget); - goto exit; - } - - RtlInitEmptyUnicodeString( - &spbDeviceName, - spbDeviceNameBuffer, - sizeof(spbDeviceNameBuffer)); - - status = RESOURCE_HUB_CREATE_PATH_FROM_ID( - &spbDeviceName, - SpbContext->I2cResHubId.LowPart, - SpbContext->I2cResHubId.HighPart); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error creating Spb resource hub path string - %!STATUS!", - status); - goto exit; - } - - WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME( - &openParams, - &spbDeviceName, - (GENERIC_READ | GENERIC_WRITE)); - - openParams.ShareAccess = 0; - openParams.CreateDisposition = FILE_OPEN; - openParams.FileAttributes = FILE_ATTRIBUTE_NORMAL; - - status = WdfIoTargetOpen(SpbContext->SpbIoTarget, &openParams); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error opening Spb target for communication - %!STATUS!", - status); - goto exit; - } - - // - // Allocate some fixed-size buffers from NonPagedPoolNx for typical - // Spb transaction sizes to avoid pool fragmentation in most cases - // - status = WdfMemoryCreate( - WDF_NO_OBJECT_ATTRIBUTES, - NonPagedPoolNx, - TOUCH_POOL_TAG, - DEFAULT_SPB_BUFFER_SIZE, - &SpbContext->WriteMemory, - NULL); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error allocating default memory for Spb write - %!STATUS!", - status); - goto exit; - } - - status = WdfMemoryCreate( - WDF_NO_OBJECT_ATTRIBUTES, - NonPagedPoolNx, - TOUCH_POOL_TAG, - DEFAULT_SPB_BUFFER_SIZE, - &SpbContext->ReadMemory, - NULL); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error allocating default memory for Spb read - %!STATUS!", - status); - goto exit; - } - - // - // Allocate a waitlock to guard access to the default buffers - // - status = WdfWaitLockCreate( - WDF_NO_OBJECT_ATTRIBUTES, - &SpbContext->SpbLock); - - if (!NT_SUCCESS(status)) - { - Trace( - TRACE_LEVEL_ERROR, - TRACE_FLAG_SPB, - "Error creating Spb Waitlock - %!STATUS!", - status); - goto exit; - } - -exit: - - if (!NT_SUCCESS(status)) - { - SpbTargetDeinitialize(FxDevice, SpbContext); - } - - return status; -} diff --git a/input/hiddigi/SynapticsTouch/spb.h b/input/hiddigi/SynapticsTouch/spb.h deleted file mode 100644 index 15ba8ae6..00000000 --- a/input/hiddigi/SynapticsTouch/spb.h +++ /dev/null @@ -1,67 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - spb.h - - Abstract: - - This module contains the touch driver I2C helper definitions. - - Environment: - - Kernel Mode - - Revision History: - ---*/ - -#pragma once - -#include <wdm.h> -#include <wdf.h> - -#define DEFAULT_SPB_BUFFER_SIZE 64 - -// -// SPB (I2C) context -// - -typedef struct _SPB_CONTEXT -{ - WDFIOTARGET SpbIoTarget; - LARGE_INTEGER I2cResHubId; - WDFMEMORY WriteMemory; - WDFMEMORY ReadMemory; - WDFWAITLOCK SpbLock; -} SPB_CONTEXT; - -NTSTATUS -SpbReadDataSynchronously( - _In_ SPB_CONTEXT *SpbContext, - _In_ UCHAR Address, - _In_reads_bytes_(Length) PVOID Data, - _In_ ULONG Length - ); - -VOID -SpbTargetDeinitialize( - IN WDFDEVICE FxDevice, - IN SPB_CONTEXT *SpbContext - ); - -NTSTATUS -SpbTargetInitialize( - IN WDFDEVICE FxDevice, - IN SPB_CONTEXT *SpbContext - ); - -NTSTATUS -SpbWriteDataSynchronously( - IN SPB_CONTEXT *SpbContext, - IN UCHAR Address, - IN PVOID Data, - IN ULONG Length - ); diff --git a/input/hiddigi/SynapticsTouch/trace.h b/input/hiddigi/SynapticsTouch/trace.h deleted file mode 100644 index 0af97194..00000000 --- a/input/hiddigi/SynapticsTouch/trace.h +++ /dev/null @@ -1,49 +0,0 @@ -/*++ - Copyright (c) Microsoft Corporation. All Rights Reserved. - Sample code. Dealpoint ID #843729. - - Module Name: - - trace.h - - Abstract: - - Contains prototypes and definitions related to debugging/tracing - - Environment: - - Kernel mode - - Revision History: - ---*/ - -#pragma once - -// -// Control GUID: -// {64BAF936-E94C-4747-91E3-BB4CB8328E5F} -// - -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID( \ - TouchDriverTraceGuid, \ - (64BAF936,E94C,4747,91E3,BB4CB8328E5F), \ - WPP_DEFINE_BIT(TRACE_FLAG_INIT) \ - WPP_DEFINE_BIT(TRACE_FLAG_REGISTRY) \ - WPP_DEFINE_BIT(TRACE_FLAG_HID) \ - WPP_DEFINE_BIT(TRACE_FLAG_PNP) \ - WPP_DEFINE_BIT(TRACE_FLAG_POWER) \ - WPP_DEFINE_BIT(TRACE_FLAG_SPB) \ - WPP_DEFINE_BIT(TRACE_FLAG_CONFIG) \ - WPP_DEFINE_BIT(TRACE_FLAG_REPORTING) \ - WPP_DEFINE_BIT(TRACE_FLAG_INTERRUPT) \ - WPP_DEFINE_BIT(TRACE_FLAG_SAMPLES) \ - WPP_DEFINE_BIT(TRACE_FLAG_OTHER) \ - WPP_DEFINE_BIT(TRACE_FLAG_IDLE) \ - ) - -#define WPP_LEVEL_FLAGS_LOGGER(level,flags) WPP_LEVEL_LOGGER(flags) -#define WPP_LEVEL_FLAGS_ENABLED(level,flags) \ - (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= level) - |
