2008-11-07 17:12:07 +00:00
|
|
|
diff -up plymouth-0.6.0/src/libplybootsplash/ply-window.c.more-debug plymouth-0.6.0/src/libplybootsplash/ply-window.c
|
2008-11-10 05:29:21 +00:00
|
|
|
--- plymouth-0.6.0/src/libplybootsplash/ply-window.c.more-debug 2008-11-05 17:15:29.000000000 -0500
|
|
|
|
+++ plymouth-0.6.0/src/libplybootsplash/ply-window.c 2008-11-07 13:49:47.000000000 -0500
|
2008-11-07 17:12:07 +00:00
|
|
|
@@ -493,7 +493,10 @@ ply_window_open (ply_window_t *window)
|
|
|
|
window->vt_number = get_active_vt ();
|
|
|
|
|
|
|
|
if (readlink ("/proc/self/fd/0", tty_name, sizeof (tty_name) - 1) < 0)
|
|
|
|
- return false;
|
|
|
|
+ {
|
|
|
|
+ ply_trace ("could not read tty name of fd 0");
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
window->tty_name = strdup (tty_name);
|
|
|
|
}
|
|
|
|
@@ -503,7 +506,10 @@ ply_window_open (ply_window_t *window)
|
|
|
|
window->tty_fd = open (window->tty_name, O_RDWR | O_NOCTTY);
|
|
|
|
|
|
|
|
if (window->tty_fd < 0)
|
|
|
|
- return false;
|
|
|
|
+ {
|
|
|
|
+ ply_trace ("could not open %s : %m", window->tty_name);
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (!ply_window_set_unbuffered_input (window))
|
|
|
|
ply_trace ("window '%s' will be line buffered", window->tty_name);
|
|
|
|
diff -up plymouth-0.6.0/src/main.c.more-debug plymouth-0.6.0/src/main.c
|
2008-11-10 05:29:21 +00:00
|
|
|
--- plymouth-0.6.0/src/main.c.more-debug 2008-11-07 13:49:47.000000000 -0500
|
|
|
|
+++ plymouth-0.6.0/src/main.c 2008-11-10 00:27:02.000000000 -0500
|
|
|
|
@@ -64,6 +64,7 @@ typedef struct
|
|
|
|
uint32_t showing_details : 1;
|
|
|
|
uint32_t system_initialized : 1;
|
|
|
|
uint32_t is_redirected : 1;
|
|
|
|
+ uint32_t is_attached : 1;
|
|
|
|
|
|
|
|
char *console;
|
|
|
|
|
|
|
|
@@ -78,6 +79,7 @@ static ply_window_t *create_window (stat
|
2008-11-07 18:50:18 +00:00
|
|
|
|
|
|
|
static bool attach_to_running_session (state_t *state);
|
|
|
|
static void on_escape_pressed (state_t *state);
|
|
|
|
+static bool has_open_window (state_t *state);
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_session_output (state_t *state,
|
2008-11-10 05:29:21 +00:00
|
|
|
@@ -220,6 +222,8 @@ has_open_window (state_t *state)
|
2008-11-07 17:12:07 +00:00
|
|
|
{
|
|
|
|
ply_list_node_t *node;
|
|
|
|
|
|
|
|
+ ply_trace ("checking for open windows");
|
|
|
|
+
|
|
|
|
node = ply_list_get_first_node (state->windows);
|
|
|
|
while (node != NULL)
|
|
|
|
{
|
2008-11-10 05:29:21 +00:00
|
|
|
@@ -231,7 +235,22 @@ has_open_window (state_t *state)
|
2008-11-07 17:12:07 +00:00
|
|
|
window = ply_list_node_get_data (node);
|
|
|
|
|
|
|
|
if (ply_window_is_open (window))
|
|
|
|
- return true;
|
|
|
|
+ {
|
|
|
|
+ int fd;
|
|
|
|
+ const char *name;
|
|
|
|
+
|
|
|
|
+ fd = ply_window_get_tty_fd (window);
|
|
|
|
+
|
|
|
|
+ if (fd >= 0)
|
|
|
|
+ name = ttyname (fd);
|
|
|
|
+ else
|
|
|
|
+ name = NULL;
|
|
|
|
+
|
|
|
|
+ ply_trace ("window %s%sis open",
|
|
|
|
+ name != NULL? name : "",
|
|
|
|
+ name != NULL? " " : "");
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
node = next_node;
|
|
|
|
}
|
2008-11-10 05:29:21 +00:00
|
|
|
@@ -324,10 +343,21 @@ close_windows (state_t *state)
|
2008-11-07 17:12:07 +00:00
|
|
|
static void
|
|
|
|
on_show_splash (state_t *state)
|
|
|
|
{
|
2008-11-07 18:50:18 +00:00
|
|
|
+ bool has_window;
|
2008-11-07 17:12:07 +00:00
|
|
|
+
|
|
|
|
open_windows (state);
|
|
|
|
|
|
|
|
- if (!state->is_redirected && state->ptmx >= 0)
|
2008-11-10 05:29:21 +00:00
|
|
|
- state->is_redirected = attach_to_running_session (state);
|
2008-11-07 18:50:18 +00:00
|
|
|
+ has_window = has_open_window (state);
|
2008-11-07 17:12:07 +00:00
|
|
|
+
|
2008-11-10 05:29:21 +00:00
|
|
|
+ if (!state->is_attached && state->ptmx >= 0 && has_window)
|
|
|
|
+ state->is_attached = attach_to_running_session (state);
|
|
|
|
+
|
|
|
|
+ if (!has_window && state->is_attached)
|
2008-11-07 17:12:07 +00:00
|
|
|
+ {
|
|
|
|
+ ply_trace ("no open windows, detaching session");
|
|
|
|
+ ply_terminal_session_detach (state->session);
|
2008-11-10 05:29:21 +00:00
|
|
|
+ state->is_attached = false;
|
2008-11-07 17:12:07 +00:00
|
|
|
+ }
|
2008-11-10 05:29:21 +00:00
|
|
|
|
2008-11-07 17:12:07 +00:00
|
|
|
if (plymouth_should_show_default_splash (state))
|
|
|
|
show_default_splash (state);
|
2008-11-10 05:29:21 +00:00
|
|
|
@@ -581,10 +611,12 @@ attach_to_running_session (state_t *stat
|
|
|
|
ply_restore_errno ();
|
|
|
|
|
|
|
|
state->is_redirected = false;
|
|
|
|
+ state->is_attached = false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
state->is_redirected = should_be_redirected;
|
|
|
|
+ state->is_attached = true;
|
|
|
|
state->session = session;
|
|
|
|
|
|
|
|
return true;
|