Skip to contentSkip to conversation

Disable EFI cursor when switching to another terminal output

PATCH In review Colin Watson 2 participants 2 messages Jul 20, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Disable EFI cursor when switching to another terminal output

On my test hardware, the EFI cursor stays up when switching to gfxterm, which looks pretty odd. We should disable it when the EFI console stops being active.

2010-07-20 Colin Watson <[email protected]>

Disable EFI cursor when the EFI console becomes inactive.

* term/efi/console.c (grub_efi_console_init): New function. (grub_efi_console_fini): New function. (grub_console_term_output): Register init and fini methods.

=== modified file 'term/efi/console.c'

efi/console.c +16 -0
@@ -311,6 +311,20 @@ grub_console_setcursor (struct grub_term
   efi_call_2 (o->enable_cursor, o, on);
 }
 
+static grub_err_t
+grub_efi_console_init (struct grub_term_output *term)
+{
+  grub_console_setcursor (term, 1);
+  return 0;
+}
+
+static grub_err_t
+grub_efi_console_fini (struct grub_term_output *term)
+{
+  grub_console_setcursor (term, 0);
+  return 0;
+}
+
 static struct grub_term_input grub_console_term_input =
   {
     .name = "console",
@@ -321,6 +335,8 @@ static struct grub_term_input grub_conso
 static struct grub_term_output grub_console_term_output =
   {
     .name = "console",
+    .init = grub_efi_console_init,
+    .fini = grub_efi_console_fini,
     .putchar = grub_console_putchar,
     .getwh = grub_console_getwh,
     .getxy = grub_console_getxy,
Signature · 1 line
Colin Watson                                       [[email protected]]
#1 lore raw
Quoted 4 lines · Colin Watson

On my test hardware, the EFI cursor stays up when switching to gfxterm, which looks pretty odd. We should disable it when the EFI console stops being active.

Quoted 9 lines

2010-07-20 Colin Watson <[email protected]>

Disable EFI cursor when the EFI console becomes inactive.

* term/efi/console.c (grub_efi_console_init): New function. (grub_efi_console_fini): New function. (grub_console_term_output): Register init and fini methods.

Go ahead

Quoted 35 lines

=== modified file 'term/efi/console.c'

efi/console.c +16 -0
@@ -311,6 +311,20 @@ grub_console_setcursor (struct grub_term
   efi_call_2 (o->enable_cursor, o, on);
 }
 
+static grub_err_t
+grub_efi_console_init (struct grub_term_output *term)
+{
+  grub_console_setcursor (term, 1);
+  return 0;
+}
+
+static grub_err_t
+grub_efi_console_fini (struct grub_term_output *term)
+{
+  grub_console_setcursor (term, 0);
+  return 0;
+}
+
 static struct grub_term_input grub_console_term_input =
   {
     .name = "console",
@@ -321,6 +335,8 @@ static struct grub_term_input grub_conso
 static struct grub_term_output grub_console_term_output =
   {
     .name = "console",
+    .init = grub_efi_console_init,
+    .fini = grub_efi_console_fini,
     .putchar = grub_console_putchar,
     .getwh = grub_console_getwh,
     .getxy = grub_console_getxy,
Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko