[PATCH 14/25] efi-stdio: Fix '\b' handling

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


In vt100 a '\b' moves the cursor left, but without deleting the
character under the cursor. In UEFI the character under the cursor is
removed instead. Catch '\b' and manually move the cursor left without
deleting the character.

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

diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index d512cc3e01..beef911a16 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -329,6 +329,13 @@ static int efi_console_puts(struct console_device *cdev, const char *s,
 				efi_console_add_char(priv, ' ');
 			pos++;
 			break;
+		case '\b':
+			n = priv->out->mode->cursor_column;
+			if (n > 0)
+				priv->out->set_cursor_position(priv->out,
+					n - 1, priv->out->mode->cursor_row);
+			pos++;
+			break;
 		default:
 			efi_console_add_char(priv, s[pos]);
 			pos++;
-- 
2.30.2




More information about the barebox mailing list