From ee7588b9d43c18330cd975914a3ec6b996058de5 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 29 Oct 2009 17:11:00 -0400
Subject: [PATCH 1/2] [console] Function in degraded mode when closed
Not all machines will have /dev/tty0. Those that
don't should still work.
---
src/libplybootsplash/ply-console.c | 8 ++++++--
src/main.c | 3 ---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/libplybootsplash/ply-console.c b/src/libplybootsplash/ply-console.c
index fb5a86d..10e8ce4 100644
--- a/src/libplybootsplash/ply-console.c
+++ b/src/libplybootsplash/ply-console.c
@@ -190,10 +190,12 @@ static void
ply_console_watch_for_vt_changes (ply_console_t *console)
{
assert (console != NULL);
- assert (console->fd >= 0);
struct vt_mode mode = { 0 };
+ if (console->fd < 0);
+ return;
+
if (console->is_watching_for_vt_changes)
return;
@@ -349,7 +351,9 @@ ply_console_set_active_vt (ply_console_t *console,
int vt_number)
{
assert (console != NULL);
- assert (vt_number > 0);
+
+ if (vt_number <= 0)
+ return false;
if (vt_number == console->active_vt)
return true;
diff --git a/src/main.c b/src/main.c
index abfd430..548e1f7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1293,9 +1293,6 @@ check_for_consoles (state_t *state,
!ply_console_open (state->console))
{
ply_trace ("could not open /dev/tty0");
- ply_console_free (state->console);
- state->console = NULL;
- return;
}
remaining_command_line = state->kernel_command_line;
--
1.6.5.1
From 5b53999611604fb575519f87c8369c8cb351aa26 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 29 Oct 2009 17:12:28 -0400
Subject: [PATCH 2/2] [main] Don't add duplicate text display
Before we were adding the same text display once at start up
and once on show splash.
---
src/main.c | 28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/src/main.c b/src/main.c
index 548e1f7..daef780 100644
--- a/src/main.c
+++ b/src/main.c
@@ -133,7 +133,8 @@ static void on_error_message (ply_buffer_t *debug_buffer,
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,
@@ -568,7 +569,7 @@ on_show_splash (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;
@@ -1279,7 +1280,8 @@ check_logging (state_t *state)
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;
@@ -1320,10 +1322,11 @@ check_for_consoles (state_t *state,
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);
}
@@ -1379,7 +1382,7 @@ initialize_environment (state_t *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);
@@ -1417,15 +1420,27 @@ dump_debug_buffer_to_file (void)
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)
@@ -1500,6 +1515,7 @@ main (int argc,
return 0;
}
+ debug = 1;
if (debug && !ply_is_tracing ())
ply_toggle_tracing ();
--
1.6.5.1