video: Allow console output to be silenced

When using expo we want to be able to control the information on the
display and avoid other messages (such as USB scanning) appearing.

Add a 'quiet' flag for the console, to help with this.

The test is a little messy since stdio is still using the original
vidconsole create on start-up. So take care to use the same.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-04-02 06:29:42 +13:00
parent b8839adacd
commit 4fbd842e56
3 changed files with 60 additions and 0 deletions

View File

@@ -532,8 +532,11 @@ int vidconsole_put_string(struct udevice *dev, const char *str)
static void vidconsole_putc(struct stdio_dev *sdev, const char ch)
{
struct udevice *dev = sdev->priv;
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
int ret;
if (priv->quiet)
return;
ret = vidconsole_put_char(dev, ch);
if (ret) {
#ifdef DEBUG
@@ -551,8 +554,11 @@ static void vidconsole_putc(struct stdio_dev *sdev, const char ch)
static void vidconsole_puts(struct stdio_dev *sdev, const char *s)
{
struct udevice *dev = sdev->priv;
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
int ret;
if (priv->quiet)
return;
ret = vidconsole_put_string(dev, s);
if (ret) {
#ifdef DEBUG
@@ -794,3 +800,10 @@ void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row)
y = min_t(short, row * priv->y_charsize, vid_priv->ysize - 1);
vidconsole_set_cursor_pos(dev, x, y);
}
void vidconsole_set_quiet(struct udevice *dev, bool quiet)
{
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
priv->quiet = quiet;
}