video: Allow querying the font size

All the font size to be queried using the 'font size' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2024-01-07 17:14:54 -07:00
parent 8ab2178de0
commit 112eb85c5a
3 changed files with 22 additions and 10 deletions

View File

@@ -55,9 +55,6 @@ static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,
uint size;
int ret;
if (argc != 2)
return CMD_RET_USAGE;
if (uclass_first_device_err(UCLASS_VIDEO_CONSOLE, &dev))
return CMD_RET_FAILURE;
ret = vidconsole_get_font_size(dev, &font_name, &size);
@@ -66,12 +63,16 @@ static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
size = dectoul(argv[1], NULL);
if (argc < 2) {
printf("%d\n", size);
} else {
size = dectoul(argv[1], NULL);
ret = vidconsole_select_font(dev, font_name, size);
if (ret) {
printf("Failed (error %d)\n", ret);
return CMD_RET_FAILURE;
ret = vidconsole_select_font(dev, font_name, size);
if (ret) {
printf("Failed (error %d)\n", ret);
return CMD_RET_FAILURE;
}
}
return 0;