diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-12-10 16:18:24 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-12-13 23:37:32 +0100 |
commit | f21bd0e51330af55b7a796d10c8087530c5cd85c (patch) | |
tree | 7e83127b9d2844d954003ae18bbf72efdcf3e788 /drivers/serial | |
parent | d4cb6456ea1f5e7ba75db5da3fc9df0cee32df2b (diff) | |
download | barebox-f21bd0e51330af55b7a796d10c8087530c5cd85c.tar.gz barebox-f21bd0e51330af55b7a796d10c8087530c5cd85c.tar.xz |
efi-stdio: implement getting the cursor position
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 <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/efi-stdio.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c index 1846469ea9..15d4e2d6c6 100644 --- a/drivers/serial/efi-stdio.c +++ b/drivers/serial/efi-stdio.c @@ -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; @@ -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; |