#include <env.h>
#include <stdio_dev.h>
#include <video_console.h>
+#include <linux/delay.h>
#define EFI_COUT_MODE_2 2
#define EFI_MAX_COUT_MODE 3
if (timer_get_us() > timeout)
return 1;
- *c = getc();
+ *c = getchar();
return 0;
}
/* Empty input buffer */
while (tstc())
- getc();
+ getchar();
/*
* Not all terminals understand CSI [18t for querying the console size.
{
int c, mod = 0, ret = 0;
- c = getc();
+ c = getchar();
if (c != ';') {
ret = c;
if (c == '~')
goto out;
- c = getc();
+ c = getchar();
}
for (;;) {
switch (c) {
mod += c - '0';
/* fall through */
case ';':
- c = getc();
+ c = getchar();
break;
default:
goto out;
switch (ch) {
case 0x1b:
/*
+ * If a second key is received within 10 ms, assume that we are
+ * dealing with an escape sequence. Otherwise consider this the
+ * escape key being hit. 10 ms is long enough to work fine at
+ * 1200 baud and above.
+ */
+ udelay(10000);
+ if (!tstc()) {
+ pressed_key.scan_code = 23;
+ break;
+ }
+ /*
* Xterm Control Sequences
* https://www.xfree86.org/4.8.0/ctlseqs.html
*/
- ch = getc();
+ ch = getchar();
switch (ch) {
case cESC: /* ESC */
pressed_key.scan_code = 23;
break;
case 'O': /* F1 - F4, End */
- ch = getc();
+ ch = getchar();
/* consider modifiers */
if (ch == 'F') { /* End */
pressed_key.scan_code = 6;
break;
} else if (ch < 'P') {
set_shift_mask(ch - '0', &key->key_state);
- ch = getc();
+ ch = getchar();
}
pressed_key.scan_code = ch - 'P' + 11;
break;
case '[':
- ch = getc();
+ ch = getchar();
switch (ch) {
case 'A'...'D': /* up, down right, left */
pressed_key.scan_code = ch - 'A' + 1;
static void efi_cin_empty_buffer(void)
{
while (tstc())
- getc();
+ getchar();
key_available = false;
}