diff --git a/src/client/plymouth.c b/src/client/plymouth.c index 82f7d920..9b3fbd90 100644 --- a/src/client/plymouth.c +++ b/src/client/plymouth.c @@ -812,6 +812,7 @@ on_change_mode_request (state_t *state, bool system_upgrade = false; bool firmware_upgrade = false; bool system_reset = false; + bool presentation = false; const char *mode = NULL; ply_command_parser_get_command_options (state->command_parser, @@ -823,6 +824,7 @@ on_change_mode_request (state_t *state, "system-upgrade", &system_upgrade, "firmware-upgrade", &firmware_upgrade, "system-reset", &system_reset, + "presentation", &presentation, NULL); if (boot_up) @@ -839,6 +841,8 @@ on_change_mode_request (state_t *state, mode = "firmware-upgrade"; else if (system_reset) mode = "system-reset"; + else if (presentation) + mode = "presentation"; if (mode) { ply_boot_client_change_mode (state->client, mode, @@ -936,6 +940,8 @@ main (int argc, PLY_COMMAND_OPTION_TYPE_FLAG, "system-reset", "Resetting the OS and erasing all user data", PLY_COMMAND_OPTION_TYPE_FLAG, + "presentation", "Display static banner without progress indication", + PLY_COMMAND_OPTION_TYPE_FLAG, NULL); ply_command_parser_add_command (state.command_parser, diff --git a/src/libply-splash-core/ply-boot-splash-plugin.h b/src/libply-splash-core/ply-boot-splash-plugin.h index d5cd05a7..733480e3 100644 --- a/src/libply-splash-core/ply-boot-splash-plugin.h +++ b/src/libply-splash-core/ply-boot-splash-plugin.h @@ -43,8 +43,9 @@ typedef enum PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE, PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE, PLY_BOOT_SPLASH_MODE_SYSTEM_RESET, + PLY_BOOT_SPLASH_MODE_PRESENTATION, PLY_BOOT_SPLASH_MODE_INVALID, - PLY_BOOT_SPLASH_MODE_COUNT = PLY_BOOT_SPLASH_MODE_SYSTEM_RESET + 1, + PLY_BOOT_SPLASH_MODE_COUNT = PLY_BOOT_SPLASH_MODE_INVALID, } ply_boot_splash_mode_t; typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t; diff --git a/src/main.c b/src/main.c index 320fa965..d4de62ef 100644 --- a/src/main.c +++ b/src/main.c @@ -218,6 +218,8 @@ on_change_mode (state_t *state, state->mode = PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE; else if (strcmp (mode, "system-reset") == 0) state->mode = PLY_BOOT_SPLASH_MODE_SYSTEM_RESET; + else if (strcmp (mode, "presentation") == 0) + state->mode = PLY_BOOT_SPLASH_MODE_PRESENTATION; else return; @@ -234,6 +236,9 @@ on_change_mode (state_t *state, ply_trace ("failed to update splash"); return; } + + if (state->mode == PLY_BOOT_SPLASH_MODE_PRESENTATION) + become_idle (state); } static void @@ -724,6 +729,7 @@ get_cache_file_for_mode (ply_boot_splash_mode_t mode) case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: case PLY_BOOT_SPLASH_MODE_SYSTEM_RESET: + case PLY_BOOT_SPLASH_MODE_PRESENTATION: filename = NULL; break; case PLY_BOOT_SPLASH_MODE_INVALID: @@ -759,6 +765,7 @@ get_log_file_for_state (state_t *state) case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: case PLY_BOOT_SPLASH_MODE_SYSTEM_RESET: + case PLY_BOOT_SPLASH_MODE_PRESENTATION: filename = _PATH_DEVNULL; break; case PLY_BOOT_SPLASH_MODE_INVALID: @@ -787,6 +794,7 @@ get_log_spool_file_for_mode (ply_boot_splash_mode_t mode) case PLY_BOOT_SPLASH_MODE_SYSTEM_UPGRADE: case PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE: case PLY_BOOT_SPLASH_MODE_SYSTEM_RESET: + case PLY_BOOT_SPLASH_MODE_PRESENTATION: filename = NULL; break; case PLY_BOOT_SPLASH_MODE_INVALID: @@ -1378,6 +1386,21 @@ on_boot_splash_idle (state_t *state) state->splash_is_becoming_idle = false; } +static void +become_idle (state_t *state) +{ + if (state->splash_is_becoming_idle) + return; + + ply_trace ("becoming idle"); + + ply_boot_splash_become_idle (state->boot_splash, + (ply_boot_splash_on_idle_handler_t) + on_boot_splash_idle, + state); + state->splash_is_becoming_idle = true; +} + static void on_deactivate (state_t *state, ply_trigger_t *deactivate_trigger) @@ -1405,13 +1428,7 @@ on_deactivate (state_t *state, ply_device_manager_deactivate_keyboards (state->device_manager); if (state->boot_splash != NULL) { - if (!state->splash_is_becoming_idle) { - ply_boot_splash_become_idle (state->boot_splash, - (ply_boot_splash_on_idle_handler_t) - on_boot_splash_idle, - state); - state->splash_is_becoming_idle = true; - } + become_idle (state); } else { ply_trace ("deactivating splash"); deactivate_splash (state); @@ -1487,13 +1504,7 @@ on_quit (state_t *state, dump_details_and_quit_splash (state); quit_program (state); } else if (state->boot_splash != NULL) { - if (!state->splash_is_becoming_idle) { - ply_boot_splash_become_idle (state->boot_splash, - (ply_boot_splash_on_idle_handler_t) - on_boot_splash_idle, - state); - state->splash_is_becoming_idle = true; - } + become_idle (state); } else { if (!state->should_retain_splash) { hide_splash (state); @@ -2459,6 +2470,8 @@ main (int argc, state.mode = PLY_BOOT_SPLASH_MODE_FIRMWARE_UPGRADE; else if (strcmp (mode_string, "system-reset") == 0) state.mode = PLY_BOOT_SPLASH_MODE_SYSTEM_RESET; + else if (strcmp (mode_string, "presentation") == 0) + state.mode = PLY_BOOT_SPLASH_MODE_PRESENTATION; else state.mode = PLY_BOOT_SPLASH_MODE_BOOT_UP;