Description: Switch back to tty1 on exit if started with vt.handoff Author: Steve Langasek Last-Update: 2012-04-10 Bug-Ubuntu: https://bugs.launchpad.net/bugs/913731 Index: trunk/src/main.c =================================================================== --- trunk.orig/src/main.c +++ trunk/src/main.c @@ -1654,6 +1654,20 @@ ply_list_get_length (state->text_displays)); if (should_add_displays && ply_list_get_length (state->text_displays) == 0) add_default_displays_and_keyboard (state); + + if (state->mode == PLY_MODE_BOOT && state->terminal) + { + int vt_handoff = -1; + char *arg; + + arg = strstr (state->kernel_command_line, "vt.handoff="); + if (arg != NULL) + sscanf (arg, "vt.handoff=%d", &vt_handoff); + if (vt_handoff > 0) { + ply_trace ("bootloader handed off on VT%d.", vt_handoff); + ply_terminal_handle_vt_handoff (state->terminal, vt_handoff); + } + } } static bool Index: trunk/src/libply-splash-core/ply-terminal.c =================================================================== --- trunk.orig/src/libply-splash-core/ply-terminal.c +++ trunk/src/libply-splash-core/ply-terminal.c @@ -496,6 +496,14 @@ return true; } +void +ply_terminal_handle_vt_handoff (ply_terminal_t *terminal, int vt) +{ + if (vt == terminal->initial_vt_number) + terminal->initial_vt_number = 1; +} + + int ply_terminal_get_fd (ply_terminal_t *terminal) { Index: trunk/src/libply-splash-core/ply-terminal.h =================================================================== --- trunk.orig/src/libply-splash-core/ply-terminal.h +++ trunk/src/libply-splash-core/ply-terminal.h @@ -59,6 +59,7 @@ void ply_terminal_free (ply_terminal_t *terminal); bool ply_terminal_open (ply_terminal_t *terminal); +void ply_terminal_handle_vt_handoff (ply_terminal_t *, int); int ply_terminal_get_fd (ply_terminal_t *terminal); bool ply_terminal_is_vt (ply_terminal_t *terminal); bool ply_terminal_is_open (ply_terminal_t *terminal);