[PATCH 7/9] video: fbconsole: implement get_size

Ahmad Fatoum a.fatoum at barebox.org
Thu Apr 30 23:54:01 PDT 2026


The fbconsole does not support input and doesn't emulate the control
characters for querying size. The get_size callback allows such consoles
to report their size anyway, so implement it.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 drivers/video/fbconsole.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
index fd220a6c1e05..9fde6cc9c6d7 100644
--- a/drivers/video/fbconsole.c
+++ b/drivers/video/fbconsole.c
@@ -88,6 +88,15 @@ static int fbc_tstc(struct console_device *cdev)
 	return 0;
 }
 
+static int fbc_get_size(struct console_device *cdev, int *width, int *height)
+{
+	struct fbc_priv *priv = container_of(cdev, struct fbc_priv, cdev);
+
+	*width = priv->cols;
+	*height = priv->rows;
+	return 0;
+}
+
 static void cls(struct fbc_priv *priv)
 {
 	void *buf = gui_screen_render_buffer(priv->sc);
@@ -842,6 +851,7 @@ int register_fbconsole(struct fb_info *fb)
 	cdev->tstc = fbc_tstc;
 	cdev->putc = fbc_putc;
 	cdev->getc = fbc_getc;
+	cdev->get_size = fbc_get_size;
 	cdev->devname = basprintf("fbconsole%s", fbname);
 	cdev->devid = DEVICE_ID_SINGLE;
 	cdev->open = fbc_open;
-- 
2.47.3




More information about the barebox mailing list