mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jules Maselbas <jmaselbas@kalray.eu>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 21/25] edit: Improve behaviour on efi-stdio console
Date: Thu, 16 Dec 2021 13:41:34 +0100	[thread overview]
Message-ID: <20211216124134.GG3394@tellis.lin.mbt.kalray.eu> (raw)
In-Reply-To: <20211213210905.3399551-22-s.hauer@pengutronix.de>

Hi,

On Mon, Dec 13, 2021 at 10:09:01PM +0100, Sascha Hauer wrote:
> Our console driver for the EFI simple text protocol does not support
> the "\e[1S" escape sequence to scroll the window which means sedit
> doesn't work properly. Disable smartscroll when the efi-stdio console
> is active. While at it put the screen height reduction into the same
> dynamic test.

FYI

>From the terminfo manpage:
In order to scroll text up, a program will go to the bottom left corner
of the screen and send the ind (index) string. [...] Parameterized
versions of the scrolling sequences are indn and rin which have the same
semantics as ind and ri except that they take one parameter, and scroll
that many lines. [...]

>From infocmp on my system: ind=\n and indn=\e[%p1$pS

So the smart scroll could be replaced by a move to the last line plus \n


> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  commands/edit.c | 46 ++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 36 insertions(+), 10 deletions(-)
> 
> diff --git a/commands/edit.c b/commands/edit.c
> index 30448cbc04..592cf4aa3d 100644
> --- a/commands/edit.c
> +++ b/commands/edit.c
> @@ -522,6 +522,25 @@ static int read_modal_key(bool is_modal)
>  	return -EAGAIN;
>  }
>  
> +static bool is_efi_console_active(void)
> +{
> +	struct console_device *cdev;
> +
> +	if (!IS_ENABLED(CONFIG_DRIVER_SERIAL_EFI_STDIO))
> +		return false;
> +
> +	for_each_console(cdev) {
> +		if (!(cdev->f_active & CONSOLE_STDIN))
> +			continue;
> +		if (!(cdev->f_active & CONSOLE_STDOUT))
> +			continue;
> +		if (!strcmp(dev_name(cdev->dev), "efi-stdio"))
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>  static int do_edit(int argc, char *argv[])
>  {
>  	bool is_vi = false;
> @@ -539,16 +558,7 @@ static int do_edit(int argc, char *argv[])
>  		return 1;
>  
>  	screenwidth = 80;
> -
> -	/*
> -	 * The EFI simple text output protocol wraps to the next line and scrolls
> -	 * down when we write to the right bottom screen position. Reduce the number
> -	 * of rows by one to work around this.
> -	 */
> -	if (IS_ENABLED(CONFIG_EFI_BOOTUP))
> -		screenheight = 24;
> -	else
> -		screenheight = 25;
> +	screenheight = 25;
>  
>  	/* check if we are not called as "edit" */
>  	if (*argv[0] != 'e') {
> @@ -560,6 +570,22 @@ static int do_edit(int argc, char *argv[])
>  			is_vi = true;
>  	}
>  
> +	if (is_efi_console_active()) {
> +		/*
> +		 * The EFI simple text output protocol wraps to the next line and
> +		 * scrolls down when we write to the right bottom screen position.
> +		 * Reduce the number of rows by one to work around this.
> +		 */
> +		screenheight--;
> +
> +		/*
> +		 * Our console driver for the EFI simple text output protocol does
> +		 * not implement the "\e[1S" sequence we use for scrolling the
> +		 * screen.
> +		 */
> +		smartscroll = 0;
> +	}
> +
>  	cursx  = 0;
>  	cursy  = 0;
>  	textx  = 0;
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 
> 
> To declare a filtering error, please use the following link : https://www.security-mail.net/reporter.php?mid=51ef.61b7b6ff.b5dfd.0&r=jmaselbas%40kalray.eu&s=barebox-bounces%2Bjmaselbas%3Dkalray.eu%40lists.infradead.org&o=%5BPATCH+21%2F25%5D+edit%3A+Improve+behaviour+on+efi-stdio+console&verdict=C&c=7aca3328f2dac1c6571b69dba9c6a9e04f98dc81
> 





_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2021-12-16 13:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 21:08 [PATCH 00/25] EFI improvements Sascha Hauer
2021-12-13 21:08 ` [PATCH 01/25] efi-devicepath: Make efi_device_path argument const Sascha Hauer
2021-12-13 21:08 ` [PATCH 02/25] efi: move device-path defines and types to header file Sascha Hauer
2021-12-13 21:08 ` [PATCH 03/25] efi: Implement device_path_to_subtype() Sascha Hauer
2021-12-13 21:08 ` [PATCH 04/25] efi: Do not register IPv[46] devices Sascha Hauer
2021-12-13 21:08 ` [PATCH 05/25] console: Fix message colours Sascha Hauer
2021-12-16 12:21   ` Jules Maselbas
2021-12-17 13:23     ` Sascha Hauer
2021-12-17 13:24       ` Jules Maselbas
2021-12-13 21:08 ` [PATCH 06/25] efi-stdio: remove unnecessary check Sascha Hauer
2021-12-13 21:08 ` [PATCH 07/25] efi-stdio: rename to efi_process_escape Sascha Hauer
2021-12-13 21:08 ` [PATCH 08/25] efi-stdio: return bytes actually consumed Sascha Hauer
2021-12-13 21:08 ` [PATCH 09/25] efi-stdio: fix escape sequence end detection Sascha Hauer
2021-12-13 21:08 ` [PATCH 10/25] efi-stdio: improve escape sequence parsing Sascha Hauer
2021-12-13 21:08 ` [PATCH 11/25] efi-stdio: Fix out of bounds error in puts Sascha Hauer
2021-12-13 21:08 ` [PATCH 12/25] efi-stdio: Fix tab printing Sascha Hauer
2021-12-13 21:08 ` [PATCH 13/25] efi-stdio: Implement efi_console_putc() using efi_console_puts() Sascha Hauer
2021-12-15 11:04   ` Ahmad Fatoum
2021-12-13 21:08 ` [PATCH 14/25] efi-stdio: Fix '\b' handling Sascha Hauer
2021-12-13 21:08 ` [PATCH 15/25] efi-stdio: implement input buffering with a kfifo Sascha Hauer
2021-12-13 21:08 ` [PATCH 16/25] efi-stdio: limit set_cursor to screen size boundaries Sascha Hauer
2021-12-13 21:08 ` [PATCH 17/25] efi-stdio: implement getting the cursor position Sascha Hauer
2021-12-13 21:08 ` [PATCH 18/25] efi-stdio: Implement setting cursor visibility Sascha Hauer
2021-12-13 21:08 ` [PATCH 19/25] efi-stdio: Support different text modes Sascha Hauer
2021-12-13 21:09 ` [PATCH 20/25] edit: improve screen size detection Sascha Hauer
2021-12-13 21:09 ` [PATCH 21/25] edit: Improve behaviour on efi-stdio console Sascha Hauer
2021-12-16 12:41   ` Jules Maselbas [this message]
2021-12-17 13:29     ` Sascha Hauer
2021-12-13 21:09 ` [PATCH 22/25] edit: send escape sequence only for smartscroll Sascha Hauer
2021-12-13 21:09 ` [PATCH 23/25] net: efi-snp: Check for carrier before sending Sascha Hauer
2021-12-13 21:09 ` [PATCH 24/25] efi: add efi_device hook to be called before an image is started Sascha Hauer
2021-12-13 21:09 ` [PATCH 25/25] net: efi-snp: Open protocol exclusively Sascha Hauer
2021-12-15 11:07 ` [PATCH 00/25] EFI improvements Ahmad Fatoum
2021-12-18 12:07   ` Michael Graichen
2021-12-18 13:55     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211216124134.GG3394@tellis.lin.mbt.kalray.eu \
    --to=jmaselbas@kalray.eu \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox