summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--payloads/libpayload/drivers/keyboard.c3
-rw-r--r--payloads/libpayload/drivers/serial/8250.c2
-rw-r--r--payloads/libpayload/libc/console.c3
3 files changed, 4 insertions, 4 deletions
diff --git a/payloads/libpayload/drivers/keyboard.c b/payloads/libpayload/drivers/keyboard.c
index 23c87803a8..056aa24957 100644
--- a/payloads/libpayload/drivers/keyboard.c
+++ b/payloads/libpayload/drivers/keyboard.c
@@ -310,9 +310,6 @@ void keyboard_init(void)
if (inb(0x64) == 0xFF)
return;
- /* Empty keyboard buffer */
- while (keyboard_havechar()) keyboard_getchar();
-
console_add_input_driver(&cons);
}
diff --git a/payloads/libpayload/drivers/serial/8250.c b/payloads/libpayload/drivers/serial/8250.c
index 1fcf36dee6..9327304248 100644
--- a/payloads/libpayload/drivers/serial/8250.c
+++ b/payloads/libpayload/drivers/serial/8250.c
@@ -137,10 +137,10 @@ void serial_console_init(void)
return;
serial_init();
+ serial_hardware_is_present = 1;
console_add_input_driver(&consin);
console_add_output_driver(&consout);
- serial_hardware_is_present = 1;
}
void serial_putchar(unsigned int c)
diff --git a/payloads/libpayload/libc/console.c b/payloads/libpayload/libc/console.c
index caeb582945..b57fc47bf6 100644
--- a/payloads/libpayload/libc/console.c
+++ b/payloads/libpayload/libc/console.c
@@ -76,6 +76,9 @@ void console_add_input_driver(struct console_input_driver *in)
/* Check if this driver was already added to the console list */
if (input_driver_exists(in))
return;
+ /* Flush out the driver input buffer. */
+ while (in->havekey())
+ in->getchar();
in->next = console_in;
console_in = in;
}