[PATCH 17/25] efi-stdio: implement getting the cursor position

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 drivers/serial/efi-stdio.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index 0ba8d3f6c0..5364d02034 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -206,10 +206,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;
 
@@ -273,6 +274,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;
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux