* Copyright (c) 2018, Heinrich Schuchardt <xypron.glpk@gmx.de>
*/
#include <command.h>
+#include <console.h>
#include <linux/delay.h>
static int do_conitrace(struct cmd_tbl *cmdtp, int flag, int argc,
printf("To terminate type 'x'\n");
/* Empty input buffer */
- while (tstc())
- getchar();
+ console_flush_stdin();
for (;;) {
int c = getchar();
*/
#include <ansi.h>
-#include <cli.h>
#include <charset.h>
+#include <cli.h>
+#include <console.h>
#include <efi_device_path.h>
#include <efi_loader.h>
#include <efi_load_initrd.h>
void eficonfig_print_msg(char *msg)
{
/* Flush input */
- while (tstc())
- getchar();
+ console_flush_stdin();
printf(ANSI_CURSOR_HIDE
ANSI_CLEAR_CONSOLE
#include <ansi.h>
#include <charset.h>
+#include <console.h>
#include <hexdump.h>
#include <log.h>
#include <malloc.h>
}
}
- while (tstc())
- getchar();
+ console_flush_stdin();
printf("\n\n Press any key to continue");
getchar();
return abort;
}
-/**
- * flush_stdin() - drops all pending characters from stdin
- */
-static void flush_stdin(void)
-{
- while (tstc())
- (void)getchar();
-}
-
/**
* fallback_to_sha256() - check whether we should fall back to sha256
* password checking
uint64_t etime = endtick(bootdelay);
if (IS_ENABLED(CONFIG_AUTOBOOT_FLUSH_STDIN))
- flush_stdin();
+ console_flush_stdin();
# ifdef CONFIG_AUTOBOOT_PROMPT
/*
* CONFIG_AUTOBOOT_PROMPT includes the %d for all boards.
return serial_tstc();
}
+/**
+ * console_flush_stdin() - drops all pending characters from stdin
+ */
+void console_flush_stdin(void)
+{
+ while (tstc())
+ (void)getchar();
+}
+
#define PRE_CONSOLE_FLUSHPOINT1_SERIAL 0
#define PRE_CONSOLE_FLUSHPOINT2_EVERYTHING_BUT_SERIAL 1
char str_input[5];
/* Flush input */
- while (tstc())
- getchar();
+ console_flush_stdin();
i = 0;
while (i < sizeof(str_input)) {
str_input[i] = getchar();
*/
int console_remove_by_name(const char *name);
+/**
+ * console_flush_stdin() - drops all pending characters from stdin
+ */
+void console_flush_stdin(void);
+
/*
* CONSOLE multiplexing.
*/
#include <ansi.h>
#include <charset.h>
+#include <console.h>
#include <efi_device_path.h>
#include <malloc.h>
#include <time.h>
int n[2];
/* Empty input buffer */
- while (tstc())
- getchar();
+ console_flush_stdin();
/*
* Not all terminals understand CSI [18t for querying the console size.
*/
static void efi_cin_empty_buffer(void)
{
- while (tstc())
- getchar();
+ console_flush_stdin();
key_available = false;
}