[PATCH 12/25] efi-stdio: Fix tab printing

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


Tabs are silently ignored by at least some UEFI instances. Replace them
with spaces in the output.

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

diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index 9cc2ca4196..d99eca9d5e 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -320,7 +320,7 @@ static int efi_console_puts(struct console_device *cdev, const char *s,
 			    size_t nbytes)
 {
 	struct efi_console_priv *priv = to_efi(cdev);
-	int pos = 0;
+	int n, pos = 0;
 
 	while (pos < nbytes) {
 		switch (s[pos]) {
@@ -333,6 +333,13 @@ static int efi_console_puts(struct console_device *cdev, const char *s,
 			efi_console_add_char(priv, '\n');
 			pos++;
 			break;
+		case '\t':
+			efi_console_flush(priv);
+			n = 8 - priv->out->mode->cursor_column % 8;
+			while (n--)
+				efi_console_add_char(priv, ' ');
+			pos++;
+			break;
 		default:
 			efi_console_add_char(priv, s[pos]);
 			pos++;
-- 
2.30.2




More information about the barebox mailing list