static ply_buffer_t *debug_buffer;
static char *debug_buffer_path = NULL;
static void check_for_consoles (state_t *state,
- const char *default_tty);
+ const char *default_tty,
+ bool should_add_displays);
static void
on_session_output (state_t *state,
return;
}
- check_for_consoles (state, state->default_tty);
+ check_for_consoles (state, state->default_tty, true);
has_display = ply_list_get_length (state->pixel_displays) > 0 ||
ply_list_get_length (state->text_displays) > 0;
static void
check_for_consoles (state_t *state,
- const char *default_tty)
+ const char *default_tty,
+ bool should_add_displays)
{
char *console_key;
char *remaining_command_line;
state->kernel_console_tty = strdup (default_tty);
}
- add_display_and_keyboard_for_terminal (state, state->kernel_console_tty);
+ if (should_add_displays)
+ add_display_and_keyboard_for_terminal (state, state->kernel_console_tty);
}
- if (ply_list_get_length (state->text_displays) == 0)
+ if (should_add_displays && ply_list_get_length (state->text_displays) == 0)
add_default_displays_and_keyboard (state);
}
else
state->default_tty = "tty1";
- check_for_consoles (state, state->default_tty);
+ check_for_consoles (state, state->default_tty, false);
if (state->kernel_console_tty != NULL)
redirect_standard_io_to_device (state->kernel_console_tty);
close (fd);
}
+ #include <termios.h>
+ #include <unistd.h>
static void
on_crash (int signum)
{
+ struct termios term_attributes;
int fd;
fd = open ("/dev/tty1", O_RDWR | O_NOCTTY);
+ if (fd < 0) fd = open ("/dev/hvc0", O_RDWR | O_NOCTTY);
ioctl (fd, KDSETMODE, KD_TEXT);
+ tcgetattr (fd, &term_attributes);
+
+ term_attributes.c_iflag |= IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON;
+ term_attributes.c_oflag |= OPOST;
+ term_attributes.c_lflag |= ECHO | ECHONL | ICANON | ISIG | IEXTEN;
+
+ tcsetattr (fd, TCSAFLUSH, &term_attributes);
+
close (fd);
if (debug_buffer != NULL)
return 0;
}
+ debug = 1;
if (debug && !ply_is_tracing ())
ply_toggle_tracing ();