summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-12-22 21:28:08 +0100
committerKay Sievers <kay@vrfy.org>2013-12-22 21:43:56 +0100
commit0f4945c4aca5586063ba85fb0be32cf7c123ea6f (patch)
tree8691bb43b6f814d6c63ac6e4ac69e12489e8f76e
parent723b02dc706ff2eb15e4bfed71ed04f60fe5339a (diff)
disable cursor when switching text/graphics mode
-rw-r--r--src/efi/graphics.c24
-rw-r--r--src/efi/gummiboot.c1
2 files changed, 14 insertions, 11 deletions
diff --git a/src/efi/graphics.c b/src/efi/graphics.c
index d903ba1..d3f674b 100644
--- a/src/efi/graphics.c
+++ b/src/efi/graphics.c
@@ -70,18 +70,22 @@ EFI_STATUS graphics_mode(BOOLEAN on) {
if (EFI_ERROR(err))
return err;
+ /* check current mode */
err = uefi_call_wrapper(ConsoleControl->GetMode, 4, ConsoleControl, &current, &uga_exists, &stdin_locked);
- if (err == EFI_SUCCESS) {
- if (on)
- new = EfiConsoleControlScreenGraphics;
- else
- new = EfiConsoleControlScreenText;
-
- if (new == current)
- return EFI_SUCCESS;
- }
+ if (EFI_ERROR(err))
+ return err;
+
+ /* do not touch the mode */
+ new = on ? EfiConsoleControlScreenGraphics : EfiConsoleControlScreenText;
+ if (new == current)
+ return EFI_SUCCESS;
- return uefi_call_wrapper(ConsoleControl->SetMode, 2, ConsoleControl, new);
+ err = uefi_call_wrapper(ConsoleControl->SetMode, 2, ConsoleControl, new);
+
+ /* some firmware enables the cursor when switching modes */
+ uefi_call_wrapper(ST->ConOut->EnableCursor, 2, ST->ConOut, FALSE);
+
+ return err;
}
struct bmp_file {
diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c
index 1571da3..e018ffd 100644
--- a/src/efi/gummiboot.c
+++ b/src/efi/gummiboot.c
@@ -410,7 +410,6 @@ static VOID print_status(Config *config, EFI_FILE *root_dir, CHAR16 *loaded_imag
}
graphics_mode(FALSE);
- uefi_call_wrapper(ST->ConOut->EnableCursor, 2, ST->ConOut, FALSE);
break;
}