#define LOG_CATEGORY LOGC_EFI
#include <ansi.h>
-#include <common.h>
#include <charset.h>
#include <malloc.h>
#include <time.h>
.cursor_visible = 1,
};
+/**
+ * term_get_char() - read a character from the console
+ *
+ * Wait for up to 100 ms to read a character from the console.
+ *
+ * @c: pointer to the buffer to receive the character
+ * Return: 0 on success, 1 otherwise
+ */
static int term_get_char(s32 *c)
{
u64 timeout;
int rows = 25, cols = 80;
int ret = -ENODEV;
- if (IS_ENABLED(CONFIG_DM_VIDEO))
+ if (IS_ENABLED(CONFIG_VIDEO))
ret = query_vidconsole(&rows, &cols);
if (ret)
ret = query_console_serial(&rows, &cols);
}
/**
- * efi_cout_clear_screen() - clear screen
+ * efi_clear_screen() - clear screen
*/
static void efi_clear_screen(void)
{
+ if (CONFIG_IS_ENABLED(EFI_SCROLL_ON_CLEAR_SCREEN)) {
+ unsigned int row, screen_rows, screen_columns;
+
+ /* Avoid overwriting previous outputs on streaming consoles */
+ screen_rows = efi_cout_modes[efi_con_mode.mode].rows;
+ screen_columns = efi_cout_modes[efi_con_mode.mode].columns;
+ printf(ESC "[%u;%uH", screen_rows, screen_columns);
+ for (row = 1; row < screen_rows; row++)
+ printf("\n");
+ }
+
/*
* The Linux console wants both a clear and a home command. The video
* uclass does not support <ESC>[H without coordinates, yet.
{
EFI_ENTRY("%p", this);
+ /* Set default colors if not done yet */
+ if (efi_con_mode.attribute == 0) {
+ efi_con_mode.attribute = 0x07;
+ printf(ESC "[0;37;40m");
+ }
+
efi_clear_screen();
return EFI_EXIT(EFI_SUCCESS);
* @mod: Xterm shift mask
* @key_state: receives the state of the shift, alt, control, and logo keys
*/
-void set_shift_mask(int mod, struct efi_key_state *key_state)
+static void set_shift_mask(int mod, struct efi_key_state *key_state)
{
key_state->key_shift_state = EFI_SHIFT_STATE_VALID;
if (mod) {
ANSI_CLEAR_LINE_TO_END
ANSI_CURSOR_SHOW, row, col);
- ret = EFI_CALL(cin->reset(cin, false));
- if (ret != EFI_SUCCESS)
- return ret;
+ efi_cin_empty_buffer();
for (;;) {
do {