[PATCH 5/6] video: use int for character in putc_xy()
Heinrich Schuchardt
xypron.glpk at gmx.de
Sat Feb 27 14:08:39 CET 2021
The truetype console expects the character to be a Unicode code point. This
value cannot be passed as char. Use int instead.
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
drivers/video/console_normal.c | 2 +-
drivers/video/console_rotate.c | 6 +++---
drivers/video/console_truetype.c | 2 +-
drivers/video/vidconsole-uclass.c | 9 +++++++++
include/video_console.h | 2 +-
5 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 04f022491e..9cfd11ae41 100644
--- a/drivers/video/console_normal.c
+++ b/drivers/video/console_normal.c
@@ -80,7 +80,7 @@ static int console_normal_move_rows(struct udevice *dev, uint rowdst,
}
static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y,
- char ch)
+ int ch)
{
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct udevice *vid = dev->parent;
diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c
index 36c8d0609d..78ca36431f 100644
--- a/drivers/video/console_rotate.c
+++ b/drivers/video/console_rotate.c
@@ -86,7 +86,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc,
return 0;
}
-static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch)
+static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, int ch)
{
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct udevice *vid = dev->parent;
@@ -221,7 +221,7 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc,
return 0;
}
-static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch)
+static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, int ch)
{
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct udevice *vid = dev->parent;
@@ -362,7 +362,7 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc,
return 0;
}
-static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch)
+static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, int ch)
{
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct udevice *vid = dev->parent;
diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index fa11b3bbef..293b3a5ef4 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -198,7 +198,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst,
}
static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y,
- char ch)
+ int ch)
{
struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
struct udevice *vid = dev->parent;
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 81b65f5aae..a355328851 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
+#include <charset.h>
#include <command.h>
#include <console.h>
#include <log.h>
@@ -509,6 +510,14 @@ int vidconsole_put_char(struct udevice *dev, char ch)
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
int ret;
+ if (IS_ENABLED(CONFIG_EFI_LOADER)) {
+ static char buffer[5];
+
+ ch = utf8_to_cp437_stream(ch, buffer);
+ if (!ch)
+ return 0;
+ }
+
if (priv->escape) {
vidconsole_escape_char(dev, ch);
return 0;
diff --git a/include/video_console.h b/include/video_console.h
index 06b798ef10..5e6eb3cc81 100644
--- a/include/video_console.h
+++ b/include/video_console.h
@@ -106,7 +106,7 @@ struct vidconsole_ops {
* if all is OK, -EAGAIN if we ran out of space on this line, other -ve
* on error
*/
- int (*putc_xy)(struct udevice *dev, uint x_frac, uint y, char ch);
+ int (*putc_xy)(struct udevice *dev, uint x_frac, uint y, int ch);
/**
* move_rows() - Move text rows from one place to another
--
2.30.0
More information about the U-Boot
mailing list