Skip to content

Commit

Permalink
efi-stdio: implement getting the cursor position
Browse files Browse the repository at this point in the history
the 'sedit' command uses "\e[6n" to retrieve the screen size. Implement
this in the efi-stdio driver to make this work.

Signed-off-by: Sascha Hauer <[email protected]>
  • Loading branch information
saschahauer committed Dec 13, 2021
1 parent d4cb645 commit f21bd0e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions drivers/serial/efi-stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,11 @@ static void set_fg_bg_colors(struct efi_console_priv *priv)
static int efi_process_square_bracket(struct efi_console_priv *priv, const char *inp)
{
char *endp;
int retlen;
int n, retlen;
int arg0 = -1, arg1 = -1, arg2 = -1;
char *buf;

endp = strpbrk(inp, "ABCDEFGHJKmr");
endp = strpbrk(inp, "ABCDEFGHJKmrn");
if (!endp)
return 0;

Expand Down Expand Up @@ -232,6 +233,15 @@ static int efi_process_square_bracket(struct efi_console_priv *priv, const char
break;
}
break;
case 'n':
switch (arg0) {
case 6:
n = asprintf(&buf, "\033[%d;%dR", priv->out->mode->cursor_row + 1,
priv->out->mode->cursor_column + 1);
kfifo_put(priv->inputbuffer, buf, n);
free(buf);
break;
}
}

return retlen;
Expand Down

0 comments on commit f21bd0e

Please sign in to comment.