From 45c3a40abda90cc8c6bf7534abd9a3c3e8710e34 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 30 Aug 2022 14:41:36 -0400 Subject: [PATCH] details: Don't replay boot buffer on serial consoles commit 0e59dde8 changed the details plugin to clear the terminal when first opening it. This was done to prevent duplicate messages from showing up when toggling back and forth between details and graphical splashes. That has the negative side effect of purging serial console output too though. Furthermore, it makes little sense to replay the boot buffer on serial consoles, since serial consoles don't aggressively purge scrollback like VTs do. This commit adds a check to make sure the terminal is a VT before trying to clear and replay the scrollback buffer. Closes: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/187 --- src/plugins/splash/details/plugin.c | 37 ++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/plugins/splash/details/plugin.c b/src/plugins/splash/details/plugin.c index 094ee58c..8321456c 100644 --- a/src/plugins/splash/details/plugin.c +++ b/src/plugins/splash/details/plugin.c @@ -202,6 +202,29 @@ view_write (view_t *view, ply_terminal_write (terminal, "%.*s", (int) number_of_bytes, text); } +static void +view_write_boot_buffer (view_t *view) +{ + ply_boot_splash_plugin_t *plugin; + ply_terminal_t *terminal; + + plugin = view->plugin; + + terminal = ply_text_display_get_terminal (view->display); + + ply_text_display_clear_screen (view->display); + ply_terminal_activate_vt (terminal); + + if (plugin->boot_buffer != NULL) { + size_t size; + const char *bytes; + + size = ply_buffer_get_size (plugin->boot_buffer); + bytes = ply_buffer_get_bytes (plugin->boot_buffer); + view_write (view, bytes, size); + } +} + static void write_on_views (ply_boot_splash_plugin_t *plugin, const char *text, @@ -237,20 +260,12 @@ add_text_display (ply_boot_splash_plugin_t *plugin, view = view_new (plugin, display); terminal = ply_text_display_get_terminal (view->display); - if (ply_terminal_open (terminal)) { - ply_text_display_clear_screen (view->display); - ply_terminal_activate_vt (terminal); - } + ply_terminal_open (terminal); ply_list_append_data (plugin->views, view); - if (plugin->boot_buffer != NULL) { - size_t size; - const char *bytes; - - size = ply_buffer_get_size (plugin->boot_buffer); - bytes = ply_buffer_get_bytes (plugin->boot_buffer); - view_write (view, bytes, size); + if (ply_terminal_is_vt (terminal)) { + view_write_boot_buffer (view); } }