Protocol : EFI_SIMPLE_POINTER_PROTOCOL
The definition of EFI_SIMPLE_POINTER_PROTOCOL in UEFI spec v2.6
EFI_SIMPLE_POINTER_PROTOCOL.GetState():
First, we define the GUID of SIMPLE PROTOCOL
#include <efi.h> #include <efilib.h> #define EFI_SIMPLE_POINTER_PROTOCOL_GUID \ {0x31878c87, 0xb75,0x11d5,0x9a,0x4f,0x00,0x90,0x27,0x3f,0xc1,0x4d}
Then declare system table, boot service, runtime service
EFI_GUID efi_simple_pointer_protocol_guid = EFI_SIMPLE_POINTER_PROTOCOL_GUID; EFI_SYSTEM_TABLE *my_system_table; EFI_BOOT_SERVICES *my_boot_services; EFI_RUNTIME_SERVICES *my_runtime_services; EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer; EFI_SIMPLE_POINTER_STATE *State;
The entry:
EFI_STATUS Simple_protocol(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *my_system_table) { EFI_STATUS Status; InitializeLib (ImageHandle, my_system_table); my_boot_services=my_system_table->BootServices; my_runtime_services=my_system_table->RuntimeServices; Status = my_boot_services->LocateProtocol( &efi_simple_pointer_protocol_guid, NULL, (VOID**)&SimplePointer); if (EFI_ERROR(Status)) { Print(L"Status: %r\n",Status); return Status; } Status = SimplePointer->GetState(SimplePointer,State); if (EFI_ERROR(Status)) { // Print(L"waiting \n",Status); return Status; } else { Print(L"X: %d\n",State->RelativeMovementX); Print(L"Y %d\n",State->RelativeMovementY); return 0; } } return 0; }
The sample efi application(Google Drive):
http://bit.ly/2WGSNKL
usage:
1.if no parameter, the application will wait until touch the touch pad
fs5:\>Simple_protocol.efi
2. Add time parameter(sec)
fs5:\>Simple_protocol.efi 15
In 15 sec, nobody touch will show nobody touch, otherwise, screen will show the movement.