aboutsummaryrefslogtreecommitdiffstats
path: root/UefiMonitorTest
diff options
context:
space:
mode:
Diffstat (limited to 'UefiMonitorTest')
-rw-r--r--UefiMonitorTest/UefiMonitorTest.c53
-rw-r--r--UefiMonitorTest/UefiMonitorTest.h8
-rw-r--r--UefiMonitorTest/UefiMonitorTest.inf3
3 files changed, 60 insertions, 4 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c
index 4933f27..92e5799 100644
--- a/UefiMonitorTest/UefiMonitorTest.c
+++ b/UefiMonitorTest/UefiMonitorTest.c
@@ -10,6 +10,7 @@
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Protocol/GraphicsOutput.h>
+#include <Protocol/SimplePointer.h>
#include "UefiMonitorTest.h"
#include "fonts/System-8x16.h"
@@ -130,10 +131,14 @@ PrepareGraphicsInfo (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop
)
{
- CONST EFI_PIXEL_BITMASK *BitMask;
- UINT32 PixelWidth;
- INT8 PixelShl[4];
- INT8 PixelShr[4];
+ EFI_STATUS Status;
+ CONST EFI_PIXEL_BITMASK *BitMask;
+ UINT32 PixelWidth;
+ INT8 PixelShl[4];
+ INT8 PixelShr[4];
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ UINTN Index;
ASSERT (Graphics != NULL);
ASSERT (Gop != NULL);
@@ -188,6 +193,46 @@ PrepareGraphicsInfo (
Graphics->PixelWidth = PixelWidth;
Graphics->Pitch = Gop->Mode->Info->PixelsPerScanLine;
+ // Find mouse in System Table ConsoleInHandle
+ Status = gBS->HandleProtocol (
+ gST->ConsoleInHandle,
+ &gEfiSimplePointerProtocolGuid,
+ (VOID **)&Graphics->MouseInterface
+ );
+ if (EFI_ERROR (Status))
+ {
+ HandleBuffer = NULL;
+ Graphics->MouseInterface = NULL;
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gEfiSimplePointerProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
+ if (!EFI_ERROR (Status)) {
+ for (Index = 0; Index < HandleCount; Index++) {
+ Status = gBS->HandleProtocol (
+ HandleBuffer[Index],
+ &gEfiSimplePointerProtocolGuid,
+ (VOID **)&Graphics->MouseInterface
+ );
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ }
+ }
+
+ if (HandleBuffer != NULL) {
+ FreePool (HandleBuffer);
+ }
+ }
+
+ if (!EFI_ERROR (Status) && (Graphics->MouseInterface != NULL)) {
+ Graphics->MouseSupported = TRUE;
+ }
+
+ DEBUG ((DEBUG_INFO, "Mouse support: %s\n\n", Graphics->MouseSupported ? L"Yes" : L"No"));
return EFI_SUCCESS;
}
diff --git a/UefiMonitorTest/UefiMonitorTest.h b/UefiMonitorTest/UefiMonitorTest.h
index 32214d6..3f82246 100644
--- a/UefiMonitorTest/UefiMonitorTest.h
+++ b/UefiMonitorTest/UefiMonitorTest.h
@@ -56,6 +56,14 @@ typedef struct {
/// Amount of bytes you should skip to go one pixel down.
///
UINT32 Pitch;
+ //
+ // A mouse support.
+ //
+ BOOLEAN MouseSupported;
+ //
+ // The MouseInterface instance.
+ //
+ EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface;
} GRAPHICS_CONTEXT;
#endif /* UEFI_MONITOR_TEST_H */
diff --git a/UefiMonitorTest/UefiMonitorTest.inf b/UefiMonitorTest/UefiMonitorTest.inf
index 36f7971..7eb27cc 100644
--- a/UefiMonitorTest/UefiMonitorTest.inf
+++ b/UefiMonitorTest/UefiMonitorTest.inf
@@ -24,6 +24,9 @@
UefiLib
UefiRuntimeServicesTableLib
+[Protocols]
+ gEfiSimplePointerProtocolGuid
+
[FeaturePcd]
[Pcd]