summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_console.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/efi_loader/efi_console.c')
-rw-r--r--lib/efi_loader/efi_console.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 3b7578f3aa..6c8229da42 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -316,23 +316,6 @@ static efi_status_t EFIAPI efi_cout_query_mode(
return EFI_EXIT(EFI_SUCCESS);
}
-static efi_status_t EFIAPI efi_cout_set_mode(
- struct efi_simple_text_output_protocol *this,
- unsigned long mode_number)
-{
- EFI_ENTRY("%p, %ld", this, mode_number);
-
-
- if (mode_number > efi_con_mode.max_mode)
- return EFI_EXIT(EFI_UNSUPPORTED);
-
- efi_con_mode.mode = mode_number;
- efi_con_mode.cursor_column = 0;
- efi_con_mode.cursor_row = 0;
-
- return EFI_EXIT(EFI_SUCCESS);
-}
-
static const struct {
unsigned int fg;
unsigned int bg;
@@ -358,6 +341,7 @@ static efi_status_t EFIAPI efi_cout_set_attribute(
EFI_ENTRY("%p, %lx", this, attribute);
+ efi_con_mode.attribute = attribute;
if (attribute)
printf(ESC"[%u;%u;%um", bold, color[fg].fg, color[bg].bg);
else
@@ -378,6 +362,20 @@ static efi_status_t EFIAPI efi_cout_clear_screen(
return EFI_EXIT(EFI_SUCCESS);
}
+static efi_status_t EFIAPI efi_cout_set_mode(
+ struct efi_simple_text_output_protocol *this,
+ unsigned long mode_number)
+{
+ EFI_ENTRY("%p, %ld", this, mode_number);
+
+ if (mode_number >= efi_con_mode.max_mode)
+ return EFI_EXIT(EFI_UNSUPPORTED);
+ efi_con_mode.mode = mode_number;
+ EFI_CALL(efi_cout_clear_screen(this));
+
+ return EFI_EXIT(EFI_SUCCESS);
+}
+
static efi_status_t EFIAPI efi_cout_reset(
struct efi_simple_text_output_protocol *this,
char extended_verification)
@@ -387,6 +385,7 @@ static efi_status_t EFIAPI efi_cout_reset(
/* Clear screen */
EFI_CALL(efi_cout_clear_screen(this));
/* Set default colors */
+ efi_con_mode.attribute = 0x07;
printf(ESC "[0;37;40m");
return EFI_EXIT(EFI_SUCCESS);
@@ -482,10 +481,8 @@ void set_shift_mask(int mod, struct efi_key_state *key_state)
key_state->key_shift_state |= EFI_LEFT_ALT_PRESSED;
if (mod & 4)
key_state->key_shift_state |= EFI_LEFT_CONTROL_PRESSED;
- if (mod & 8)
+ if (!mod || (mod & 8))
key_state->key_shift_state |= EFI_LEFT_LOGO_PRESSED;
- } else {
- key_state->key_shift_state |= EFI_LEFT_LOGO_PRESSED;
}
}
@@ -564,10 +561,13 @@ static efi_status_t efi_cin_read_key(struct efi_key_data *key)
case cESC: /* ESC */
pressed_key.scan_code = 23;
break;
- case 'O': /* F1 - F4 */
+ case 'O': /* F1 - F4, End */
ch = getc();
/* consider modifiers */
- if (ch < 'P') {
+ if (ch == 'F') { /* End */
+ pressed_key.scan_code = 6;
+ break;
+ } else if (ch < 'P') {
set_shift_mask(ch - '0', &key->key_state);
ch = getc();
}
@@ -591,17 +591,20 @@ static efi_status_t efi_cin_read_key(struct efi_key_data *key)
case '1'...'5': /* F1 - F5 */
pressed_key.scan_code = ch - '1' + 11;
break;
- case '7'...'9': /* F6 - F8 */
- pressed_key.scan_code = ch - '7' + 16;
+ case '6'...'9': /* F5 - F8 */
+ pressed_key.scan_code = ch - '6' + 15;
break;
case 'A'...'D': /* up, down right, left */
pressed_key.scan_code = ch - 'A' + 1;
break;
- case 'F':
- pressed_key.scan_code = 6; /* End */
+ case 'F': /* End */
+ pressed_key.scan_code = 6;
+ break;
+ case 'H': /* Home */
+ pressed_key.scan_code = 5;
break;
- case 'H':
- pressed_key.scan_code = 5; /* Home */
+ case '~': /* Home */
+ pressed_key.scan_code = 5;
break;
}
break;
@@ -704,7 +707,7 @@ static void efi_cin_check(void)
efi_status_t ret;
if (key_available) {
- efi_signal_event(efi_con_in.wait_for_key, true);
+ efi_signal_event(efi_con_in.wait_for_key);
return;
}
@@ -718,7 +721,7 @@ static void efi_cin_check(void)
/* Queue the wait for key event */
if (key_available)
- efi_signal_event(efi_con_in.wait_for_key, true);
+ efi_signal_event(efi_con_in.wait_for_key);
}
}
}