diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-09-14 18:49:26 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2018-09-23 21:55:30 +0200 |
commit | aaace4b0860fbe22b2b08f761b3c6ea12af94d5e (patch) | |
tree | d5732fcd908d70d04e1b3f8c80cb133f825da52f /lib | |
parent | 008fb489fa51607dcde1d291aa3442809920ffb2 (diff) | |
download | u-boot-aaace4b0860fbe22b2b08f761b3c6ea12af94d5e.tar.gz |
efi_loader: terminal left upper corner is [1, 1]
For the VT102 and the Linux console the left upper corner is [1, 1].
EFI uses [0, 0] as left upper corner.
Check parameters of the SetCursorPosition() service.
Use CSI H like EDK2 for positioning.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efi_loader/efi_console.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 73f7ecf919..41e0a49361 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -359,13 +359,31 @@ static efi_status_t EFIAPI efi_cout_set_cursor_position( struct efi_simple_text_output_protocol *this, unsigned long column, unsigned long row) { + efi_status_t ret = EFI_SUCCESS; + struct simple_text_output_mode *con = &efi_con_mode; + struct cout_mode *mode = &efi_cout_modes[con->mode]; + EFI_ENTRY("%p, %ld, %ld", this, column, row); - printf(ESC"[%d;%df", (int)row, (int)column); + /* Check parameters */ + if (!this) { + ret = EFI_INVALID_PARAMETER; + goto out; + } + if (row >= mode->rows || column >= mode->columns) { + ret = EFI_UNSUPPORTED; + goto out; + } + + /* + * Set cursor position by sending CSI H. + * EFI origin is [0, 0], terminal origin is [1, 1]. + */ + printf(ESC "[%d;%dH", (int)row + 1, (int)column + 1); efi_con_mode.cursor_column = column; efi_con_mode.cursor_row = row; - - return EFI_EXIT(EFI_SUCCESS); +out: + return EFI_EXIT(ret); } static efi_status_t EFIAPI efi_cout_enable_cursor( |