[PATCH 18/25] efi-stdio: Implement setting cursor visibility

Sascha Hauer s.hauer at pengutronix.de
Mon Dec 13 13:08:58 PST 2021


The sequence "\b[?25h" makes the cursor visible and "\b[?25l" makes it
invisible. Implement support for this sequence.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/serial/efi-stdio.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index 5364d02034..3f99ef5d97 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -210,7 +210,7 @@ static int efi_process_square_bracket(struct efi_console_priv *priv, const char
 	int arg0 = -1, arg1 = -1, arg2 = -1;
 	char *buf;
 
-	endp = strpbrk(inp, "ABCDEFGHJKmrn");
+	endp = strpbrk(inp, "ABCDEFGHJKmrnhl");
 	if (!endp)
 		return 0;
 
@@ -226,6 +226,8 @@ static int efi_process_square_bracket(struct efi_console_priv *priv, const char
 			if (*e == ';')
 				arg2 = simple_strtoul(e + 1, &e, 10);
 		}
+	} else if (*inp == '?') {
+		arg0 = simple_strtoul(inp + 1, NULL, 10);
 	}
 
 	switch (*endp) {
@@ -283,6 +285,15 @@ static int efi_process_square_bracket(struct efi_console_priv *priv, const char
 			free(buf);
 			break;
 		}
+		break;
+	case 'h':
+		if (*inp == '?' && arg0 == 25)
+			priv->out->enable_cursor(priv->out, true);
+		break;
+	case 'l':
+		if (*inp == '?' && arg0 == 25)
+			priv->out->enable_cursor(priv->out, false);
+		break;
 	}
 
 	return retlen;
-- 
2.30.2




More information about the barebox mailing list