From b87fc6b140772ba3017de311c7063c259424264c Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 15 Aug 2016 17:11:31 +0200 Subject: First public release. Used by VeraCrypt 1.18. --- Library/CommonLib/EfiTouch.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Library/CommonLib/EfiTouch.c (limited to 'Library/CommonLib/EfiTouch.c') diff --git a/Library/CommonLib/EfiTouch.c b/Library/CommonLib/EfiTouch.c new file mode 100644 index 0000000..9009f82 --- /dev/null +++ b/Library/CommonLib/EfiTouch.c @@ -0,0 +1,47 @@ +/** @file +EFI touch/absolute pointer helpers + +Copyright (c) 2016. Disk Cryptography Services for EFI (DCS), Alex Kolotnikov +Copyright (c) 2016. VeraCrypt, Mounir IDRASSI + +This program and the accompanying materials are licensed and made available +under the terms and conditions of the GNU Lesser General Public License, version 3.0 (LGPL-3.0). + +The full text of the license may be found at +https://opensource.org/licenses/LGPL-3.0 +**/ +#include +#include +#include +#include +#include + +EFI_HANDLE* gTouchHandles = NULL; +UINTN gTouchCount = 0; +int gTouchSimulate = 0; +UINT32 gTouchSimulateStep = 1; + +EFI_ABSOLUTE_POINTER_PROTOCOL* gTouchPointer = NULL; + +EFI_STATUS +InitTouch() { + EFI_STATUS res; + res = EfiGetHandles(ByProtocol, &gEfiAbsolutePointerProtocolGuid, 0, &gTouchHandles, &gTouchCount); + if (gTouchCount > 0) { + TouchGetIO(gTouchHandles[gTouchCount - 1], &gTouchPointer); + } + return res; +} + + +EFI_STATUS +TouchGetIO( + IN EFI_HANDLE Handle, + OUT EFI_ABSOLUTE_POINTER_PROTOCOL** io + ) { + if (!io) { + return EFI_INVALID_PARAMETER; + } + return gBS->HandleProtocol(Handle, &gEfiAbsolutePointerProtocolGuid, (VOID**)io); +} + -- cgit v1.2.3