Skip to contentSkip to conversation

grub-emu console-read causing issues with the read command

DISCUSSION Seth Goldberg 1 participant 1 message Jan 13, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

When using the read command under grub-emu, the resulting value read
(present in the environment variable) includes a time-dependent number of 0xff characters + the input that the user made. I tracked it down to grub_ncurses_getkey(), which times out after 100ms and causes grub_ncurses_getkey to return -1 instead of GRUB_TERM_NO_KEY, which causes grub_getkey() to return -1 instead of blocking until it has real input.

My suggestion would be to change grub_ncurses_getkey to return
GRUB_TERM_NO_KEY in the ERR case:

static int
grub_ncurses_getkey (struct grub_term_input *term __attribute__ ((unused))) {
int c;

  wtimeout (stdscr, 100);
  c = getch ();

switch (c)

    {
    case ERR:

< return -1;

Quoted 1 line
     return GRUB_TERM_NO_KEY;

--S