From 9ce75f49127858d1aa36d455a869137e4d36681b Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Fri, 5 Jan 2024 09:22:08 +0200 Subject: common: console: introduce console_record_isempty helper Add console_record_isempty to check if console record buffer contains any data. Signed-off-by: Ion Agorria Signed-off-by: Svyatoslav Ryhel Reviewed-by: Mattijs Korpershoek Link: https://lore.kernel.org/r/20240105072212.6615-4-clamor95@gmail.com Signed-off-by: Mattijs Korpershoek --- common/console.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'common/console.c') diff --git a/common/console.c b/common/console.c index 1ffda49c87e..6f2089caa00 100644 --- a/common/console.c +++ b/common/console.c @@ -853,6 +853,11 @@ int console_record_avail(void) return membuff_avail((struct membuff *)&gd->console_out); } +bool console_record_isempty(void) +{ + return membuff_isempty((struct membuff *)&gd->console_out); +} + int console_in_puts(const char *str) { return membuff_put((struct membuff *)&gd->console_in, str, strlen(str)); -- cgit v1.2.3 From 90087dd076d42c196de3506b6fa4d052f0869670 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Fri, 5 Jan 2024 09:22:09 +0200 Subject: common: console: record console from the beginning Set flag to enable console record on console_record_init and not only on console_record_reset_enable. This fixes missing start of U-Boot log for fastboot oem console command. Signed-off-by: Ion Agorria Signed-off-by: Svyatoslav Ryhel Reviewed-by: Mattijs Korpershoek Link: https://lore.kernel.org/r/20240105072212.6615-5-clamor95@gmail.com Signed-off-by: Mattijs Korpershoek --- common/console.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'common/console.c') diff --git a/common/console.c b/common/console.c index 6f2089caa00..e6d7ebe935f 100644 --- a/common/console.c +++ b/common/console.c @@ -821,6 +821,9 @@ int console_record_init(void) ret = membuff_new((struct membuff *)&gd->console_in, CONFIG_CONSOLE_RECORD_IN_SIZE); + /* Start recording from the beginning */ + gd->flags |= GD_FLG_RECORD; + return ret; } -- cgit v1.2.3 From e58bafc35fe37491bb3546299593dcc054145adb Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Fri, 5 Jan 2024 09:22:10 +0200 Subject: lib: membuff: fix readline not returning line in case of overflow If line overflows readline it will not be returned, fix this behavior, make it optional and documented properly. Signed-off-by: Ion Agorria Signed-off-by: Svyatoslav Ryhel Reviewed-by: Mattijs Korpershoek Reviewed-by: Simon Glass Link: https://lore.kernel.org/r/20240105072212.6615-6-clamor95@gmail.com Signed-off-by: Mattijs Korpershoek --- common/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/console.c') diff --git a/common/console.c b/common/console.c index e6d7ebe935f..cad65891fc9 100644 --- a/common/console.c +++ b/common/console.c @@ -848,7 +848,7 @@ int console_record_readline(char *str, int maxlen) return -ENOSPC; return membuff_readline((struct membuff *)&gd->console_out, str, - maxlen, '\0'); + maxlen, '\0', false); } int console_record_avail(void) -- cgit v1.2.3