Message ID | 20220110005638.21599-8-andre.przywara@arm.com |
---|---|
State | New |
Delegated to: | Anatolij Gustschin |
Headers | show |
Series | video: improve UEFI experience on DM_VIDEO | expand |
On 1/10/22 01:56, Andre Przywara wrote: > UEFI applications rely on Unicode output capability, and might use that > for drawing pseudo-graphical interfaces using Unicode defined box > drawing characters. > > Add a simple test to display the most basic box characters, which would > need to be checked manually on the screen for correctness. > To facilitate this, add a three second delay after the output at this > point. > > Signed-off-by: Andre Przywara <andre.przywara@arm.com> > --- > lib/efi_selftest/efi_selftest_textoutput.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c > index a437732496b..1542c187de7 100644 > --- a/lib/efi_selftest/efi_selftest_textoutput.c > +++ b/lib/efi_selftest/efi_selftest_textoutput.c > @@ -123,6 +123,17 @@ static int execute(void) > efi_st_error("OutputString failed for international chars\n"); > return EFI_ST_FAILURE; > } > + ret = con_out->output_string(con_out, L"┌─┬─┐\n"); > + ret |= con_out->output_string(con_out, L"│ │ │\n"); > + ret |= con_out->output_string(con_out, L"├─┼─┤\n"); > + ret |= con_out->output_string(con_out, L"│ │ │\n"); > + ret |= con_out->output_string(con_out, L"└─┴─┘\n"); %s/L"/u"/ Unicode characters in code are not supported by all tools. The interpretation may further depend on the users locale. Please, use \u escape sequences. A single output_string() call is enough. A notice for the user might be helpful. So I suggest: This should render as four boxes with text ┌─────────────┬───────────────┐ │ left top │ right top │ ├─────────────┼───────────────┤ │ left bottom │ right bottom │ └─────────────┴───────────────┘ const u16 text[] = u"This should render as four boxes with text\n" u"\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" u"\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500" u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502" u" left top \u2502 right top \u2502\n\u251c\u2500" u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" u"\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" u"\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 " u"left bottom \u2502 right bottom \u2502\n\u2514\u2500\u2500\u2500" u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534" u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" u"\u2500\u2500\u2500\u2500\u2518\n"; Best regards Heinrich > + if (ret != EFI_ST_SUCCESS) { > + efi_st_error("OutputString failed for box drawing chars\n"); > + return EFI_ST_FAILURE; > + } > + con_out->output_string(con_out, L"waiting for admiration...\n"); > + EFI_CALL(systab.boottime->stall(3000000)); > efi_st_printf("\n"); > > return EFI_ST_SUCCESS;
On Mon, 10 Jan 2022 10:23:20 +0100 Heinrich Schuchardt <heinrich.schuchardt@canonical.com> wrote: Hi Heinrich, > On 1/10/22 01:56, Andre Przywara wrote: > > UEFI applications rely on Unicode output capability, and might use that > > for drawing pseudo-graphical interfaces using Unicode defined box > > drawing characters. > > > > Add a simple test to display the most basic box characters, which would > > need to be checked manually on the screen for correctness. > > To facilitate this, add a three second delay after the output at this > > point. > > > > Signed-off-by: Andre Przywara <andre.przywara@arm.com> > > --- > > lib/efi_selftest/efi_selftest_textoutput.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c > > index a437732496b..1542c187de7 100644 > > --- a/lib/efi_selftest/efi_selftest_textoutput.c > > +++ b/lib/efi_selftest/efi_selftest_textoutput.c > > @@ -123,6 +123,17 @@ static int execute(void) > > efi_st_error("OutputString failed for international chars\n"); > > return EFI_ST_FAILURE; > > } > > + ret = con_out->output_string(con_out, L"┌─┬─┐\n"); > > + ret |= con_out->output_string(con_out, L"│ │ │\n"); > > + ret |= con_out->output_string(con_out, L"├─┼─┤\n"); > > + ret |= con_out->output_string(con_out, L"│ │ │\n"); > > + ret |= con_out->output_string(con_out, L"└─┴─┘\n"); > > %s/L"/u"/ > > Unicode characters in code are not supported by all tools. The > interpretation may further depend on the users locale. Please, use \u > escape sequences. A single output_string() call is enough. A notice for > the user might be helpful. So I suggest: > > This should render as four boxes with text > ┌─────────────┬───────────────┐ > │ left top │ right top │ > ├─────────────┼───────────────┤ > │ left bottom │ right bottom │ > └─────────────┴───────────────┘ > > const u16 text[] = > u"This should render as four boxes with text\n" > u"\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" > u"\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500" > u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502" > u" left top \u2502 right top \u2502\n\u251c\u2500" > u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" > u"\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" > u"\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 " > u"left bottom \u2502 right bottom \u2502\n\u2514\u2500\u2500\u2500" > u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534" > u"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" > u"\u2500\u2500\u2500\u2500\u2518\n"; Ha, very good, thanks for the hints! And for typing all those numbers! I was wondering about UTF-8 in source, but since my ancient Slackware could deal with it, I deemed it safe ;-) Will fix it accordingly! Cheers, Andre > > + if (ret != EFI_ST_SUCCESS) { > > + efi_st_error("OutputString failed for box drawing chars\n"); > > + return EFI_ST_FAILURE; > > + } > > + con_out->output_string(con_out, L"waiting for admiration...\n"); > > + EFI_CALL(systab.boottime->stall(3000000)); > > efi_st_printf("\n"); > > > > return EFI_ST_SUCCESS; >
diff --git a/lib/efi_selftest/efi_selftest_textoutput.c b/lib/efi_selftest/efi_selftest_textoutput.c index a437732496b..1542c187de7 100644 --- a/lib/efi_selftest/efi_selftest_textoutput.c +++ b/lib/efi_selftest/efi_selftest_textoutput.c @@ -123,6 +123,17 @@ static int execute(void) efi_st_error("OutputString failed for international chars\n"); return EFI_ST_FAILURE; } + ret = con_out->output_string(con_out, L"┌─┬─┐\n"); + ret |= con_out->output_string(con_out, L"│ │ │\n"); + ret |= con_out->output_string(con_out, L"├─┼─┤\n"); + ret |= con_out->output_string(con_out, L"│ │ │\n"); + ret |= con_out->output_string(con_out, L"└─┴─┘\n"); + if (ret != EFI_ST_SUCCESS) { + efi_st_error("OutputString failed for box drawing chars\n"); + return EFI_ST_FAILURE; + } + con_out->output_string(con_out, L"waiting for admiration...\n"); + EFI_CALL(systab.boottime->stall(3000000)); efi_st_printf("\n"); return EFI_ST_SUCCESS;
UEFI applications rely on Unicode output capability, and might use that for drawing pseudo-graphical interfaces using Unicode defined box drawing characters. Add a simple test to display the most basic box characters, which would need to be checked manually on the screen for correctness. To facilitate this, add a three second delay after the output at this point. Signed-off-by: Andre Przywara <andre.przywara@arm.com> --- lib/efi_selftest/efi_selftest_textoutput.c | 11 +++++++++++ 1 file changed, 11 insertions(+)