|
|
e22087 |
From 8a1dfbe91c1b309d361b4053e05bd5e01056fd41 Mon Sep 17 00:00:00 2001
|
|
|
e22087 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
e22087 |
Date: Mon, 3 Mar 2014 17:55:59 -0500
|
|
|
e22087 |
Subject: [PATCH 1/4] device-manager: ignore udev if only console is serial
|
|
|
e22087 |
console
|
|
|
e22087 |
|
|
|
e22087 |
Right now we use the heuristic, "more than one entry in
|
|
|
e22087 |
/sys/class/tty/console/active" to mean "has serial consoles".
|
|
|
e22087 |
|
|
|
e22087 |
We used to use the heuristic "file has more than tty0 in it".
|
|
|
e22087 |
The older heuristic is more accurate because a user may have
|
|
|
e22087 |
console=ttyS0 without console=tty0 on the kernel command line.
|
|
|
e22087 |
---
|
|
|
e22087 |
src/libply-splash-core/ply-device-manager.c | 27 +++++++++++++--------------
|
|
|
e22087 |
1 file changed, 13 insertions(+), 14 deletions(-)
|
|
|
e22087 |
|
|
|
e22087 |
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
|
|
|
e22087 |
index d06e1b5..098fd85 100644
|
|
|
e22087 |
--- a/src/libply-splash-core/ply-device-manager.c
|
|
|
e22087 |
+++ b/src/libply-splash-core/ply-device-manager.c
|
|
|
e22087 |
@@ -514,204 +514,203 @@ ply_device_manager_new (const char *default_tty,
|
|
|
e22087 |
return manager;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
void
|
|
|
e22087 |
ply_device_manager_free (ply_device_manager_t *manager)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_trace ("freeing device manager");
|
|
|
e22087 |
|
|
|
e22087 |
if (manager == NULL)
|
|
|
e22087 |
return;
|
|
|
e22087 |
|
|
|
e22087 |
ply_event_loop_stop_watching_for_exit (manager->loop,
|
|
|
e22087 |
(ply_event_loop_exit_handler_t)
|
|
|
e22087 |
detach_from_event_loop,
|
|
|
e22087 |
manager);
|
|
|
e22087 |
free_seats (manager);
|
|
|
e22087 |
ply_list_free (manager->seats);
|
|
|
e22087 |
|
|
|
e22087 |
free_terminals (manager);
|
|
|
e22087 |
ply_hashtable_free (manager->terminals);
|
|
|
e22087 |
|
|
|
e22087 |
if (manager->udev_monitor != NULL)
|
|
|
e22087 |
udev_monitor_unref (manager->udev_monitor);
|
|
|
e22087 |
|
|
|
e22087 |
if (manager->udev_context != NULL)
|
|
|
e22087 |
udev_unref (manager->udev_context);
|
|
|
e22087 |
|
|
|
e22087 |
free (manager);
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
-static int
|
|
|
e22087 |
+static bool
|
|
|
e22087 |
add_consoles_from_file (ply_device_manager_t *manager,
|
|
|
e22087 |
const char *path)
|
|
|
e22087 |
{
|
|
|
e22087 |
int fd;
|
|
|
e22087 |
char contents[512] = "";
|
|
|
e22087 |
ssize_t contents_length;
|
|
|
e22087 |
- int num_consoles;
|
|
|
e22087 |
+ bool has_serial_consoles;
|
|
|
e22087 |
const char *remaining_file_contents;
|
|
|
e22087 |
|
|
|
e22087 |
ply_trace ("opening %s", path);
|
|
|
e22087 |
fd = open (path, O_RDONLY);
|
|
|
e22087 |
|
|
|
e22087 |
if (fd < 0)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_trace ("couldn't open it: %m");
|
|
|
e22087 |
- return 0;
|
|
|
e22087 |
+ return false;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
ply_trace ("reading file");
|
|
|
e22087 |
contents_length = read (fd, contents, sizeof (contents) - 1);
|
|
|
e22087 |
|
|
|
e22087 |
if (contents_length <= 0)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_trace ("couldn't read it: %m");
|
|
|
e22087 |
close (fd);
|
|
|
e22087 |
- return 0;
|
|
|
e22087 |
+ return false;
|
|
|
e22087 |
}
|
|
|
e22087 |
close (fd);
|
|
|
e22087 |
|
|
|
e22087 |
remaining_file_contents = contents;
|
|
|
e22087 |
- num_consoles = 0;
|
|
|
e22087 |
+ has_serial_consoles = false;
|
|
|
e22087 |
|
|
|
e22087 |
while (remaining_file_contents < contents + contents_length)
|
|
|
e22087 |
{
|
|
|
e22087 |
char *console;
|
|
|
e22087 |
size_t console_length;
|
|
|
e22087 |
const char *console_device;
|
|
|
e22087 |
ply_terminal_t *terminal;
|
|
|
e22087 |
|
|
|
e22087 |
/* Advance past any leading whitespace */
|
|
|
e22087 |
remaining_file_contents += strspn (remaining_file_contents, " \n\t\v");
|
|
|
e22087 |
|
|
|
e22087 |
if (*remaining_file_contents == '\0')
|
|
|
e22087 |
{
|
|
|
e22087 |
/* There's nothing left after the whitespace, we're done */
|
|
|
e22087 |
break;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
/* Find trailing whitespace and NUL terminate. If strcspn
|
|
|
e22087 |
* doesn't find whitespace, it gives us the length of the string
|
|
|
e22087 |
* until the next NUL byte, which we'll just overwrite with
|
|
|
e22087 |
* another NUL byte anyway. */
|
|
|
e22087 |
console_length = strcspn (remaining_file_contents, " \n\t\v");
|
|
|
e22087 |
console = strndup (remaining_file_contents, console_length);
|
|
|
e22087 |
|
|
|
e22087 |
terminal = get_terminal (manager, console);
|
|
|
e22087 |
console_device = ply_terminal_get_name (terminal);
|
|
|
e22087 |
|
|
|
e22087 |
free (console);
|
|
|
e22087 |
|
|
|
e22087 |
ply_trace ("console %s found!", console_device);
|
|
|
e22087 |
- num_consoles++;
|
|
|
e22087 |
+
|
|
|
e22087 |
+ if (terminal != manager->local_console_terminal)
|
|
|
e22087 |
+ has_serial_consoles = true;
|
|
|
e22087 |
|
|
|
e22087 |
/* Move past the parsed console string, and the whitespace we
|
|
|
e22087 |
* may have found above. If we found a NUL above and not whitespace,
|
|
|
e22087 |
* then we're going to jump past the end of the buffer and the loop
|
|
|
e22087 |
* will terminate
|
|
|
e22087 |
*/
|
|
|
e22087 |
remaining_file_contents += console_length + 1;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
- return num_consoles;
|
|
|
e22087 |
+ return has_serial_consoles;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
static void
|
|
|
e22087 |
create_seat_for_terminal_and_renderer_type (ply_device_manager_t *manager,
|
|
|
e22087 |
const char *device_path,
|
|
|
e22087 |
ply_terminal_t *terminal,
|
|
|
e22087 |
ply_renderer_type_t renderer_type)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_seat_t *seat;
|
|
|
e22087 |
bool is_local_terminal = false;
|
|
|
e22087 |
|
|
|
e22087 |
if (terminal != NULL && manager->local_console_terminal == terminal)
|
|
|
e22087 |
is_local_terminal = true;
|
|
|
e22087 |
|
|
|
e22087 |
if (is_local_terminal && manager->local_console_seat != NULL)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_trace ("trying to create seat for local console when one already exists");
|
|
|
e22087 |
return;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
ply_trace ("creating seat for %s (renderer type: %u) (terminal: %s)",
|
|
|
e22087 |
device_path? : "", renderer_type, terminal? ply_terminal_get_name (terminal): "none");
|
|
|
e22087 |
seat = ply_seat_new (terminal);
|
|
|
e22087 |
|
|
|
e22087 |
if (!ply_seat_open (seat, renderer_type, device_path))
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_trace ("could not create seat");
|
|
|
e22087 |
ply_seat_free (seat);
|
|
|
e22087 |
return;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
ply_list_append_data (manager->seats, seat);
|
|
|
e22087 |
|
|
|
e22087 |
if (is_local_terminal)
|
|
|
e22087 |
manager->local_console_seat = seat;
|
|
|
e22087 |
|
|
|
e22087 |
if (manager->seat_added_handler != NULL)
|
|
|
e22087 |
manager->seat_added_handler (manager->seat_event_handler_data, seat);
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
static void
|
|
|
e22087 |
create_seat_for_terminal (const char *device_path,
|
|
|
e22087 |
ply_terminal_t *terminal,
|
|
|
e22087 |
ply_device_manager_t *manager)
|
|
|
e22087 |
{
|
|
|
e22087 |
create_seat_for_terminal_and_renderer_type (manager,
|
|
|
e22087 |
device_path,
|
|
|
e22087 |
terminal,
|
|
|
e22087 |
PLY_RENDERER_TYPE_NONE);
|
|
|
e22087 |
}
|
|
|
e22087 |
static bool
|
|
|
e22087 |
create_seats_from_terminals (ply_device_manager_t *manager)
|
|
|
e22087 |
{
|
|
|
e22087 |
- int num_consoles;
|
|
|
e22087 |
+ bool has_serial_consoles;
|
|
|
e22087 |
|
|
|
e22087 |
ply_trace ("checking for consoles");
|
|
|
e22087 |
|
|
|
e22087 |
if (manager->flags & PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES)
|
|
|
e22087 |
{
|
|
|
e22087 |
- num_consoles = 0;
|
|
|
e22087 |
+ has_serial_consoles = false;
|
|
|
e22087 |
ply_trace ("ignoring all consoles but default console because explicitly told to.");
|
|
|
e22087 |
}
|
|
|
e22087 |
else
|
|
|
e22087 |
{
|
|
|
e22087 |
- num_consoles = add_consoles_from_file (manager, "/sys/class/tty/console/active");
|
|
|
e22087 |
-
|
|
|
e22087 |
- if (num_consoles == 0)
|
|
|
e22087 |
- ply_trace ("ignoring all consoles but default console because /sys/class/tty/console/active could not be read");
|
|
|
e22087 |
+ has_serial_consoles = add_consoles_from_file (manager, "/sys/class/tty/console/active");
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
- if (num_consoles > 1)
|
|
|
e22087 |
+ if (has_serial_consoles)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_trace ("serial consoles detected, managing them with details forced");
|
|
|
e22087 |
ply_hashtable_foreach (manager->terminals,
|
|
|
e22087 |
(ply_hashtable_foreach_func_t *)
|
|
|
e22087 |
create_seat_for_terminal,
|
|
|
e22087 |
manager);
|
|
|
e22087 |
return true;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
return false;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
static void
|
|
|
e22087 |
create_seats_from_udev (ply_device_manager_t *manager)
|
|
|
e22087 |
{
|
|
|
e22087 |
bool found_drm_device, found_fb_device;
|
|
|
e22087 |
|
|
|
e22087 |
ply_trace ("Looking for devices from udev");
|
|
|
e22087 |
|
|
|
e22087 |
found_drm_device = create_seats_for_subsystem (manager, SUBSYSTEM_DRM);
|
|
|
e22087 |
found_fb_device = create_seats_for_subsystem (manager, SUBSYSTEM_FRAME_BUFFER);
|
|
|
e22087 |
|
|
|
e22087 |
if (found_drm_device || found_fb_device)
|
|
|
e22087 |
return;
|
|
|
e22087 |
|
|
|
e22087 |
ply_trace ("Creating non-graphical seat, since there's no suitable graphics hardware");
|
|
|
e22087 |
create_seat_for_terminal_and_renderer_type (manager,
|
|
|
e22087 |
ply_terminal_get_name (manager->local_console_terminal),
|
|
|
e22087 |
manager->local_console_terminal,
|
|
|
e22087 |
PLY_RENDERER_TYPE_NONE);
|
|
|
e22087 |
--
|
|
|
e22087 |
1.8.3.1
|
|
|
e22087 |
|
|
|
e22087 |
|
|
|
e22087 |
From 5fbfc8d1ec9da9060ebeaf0938afe8e2e0102b3d Mon Sep 17 00:00:00 2001
|
|
|
e22087 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
e22087 |
Date: Mon, 3 Mar 2014 18:00:19 -0500
|
|
|
e22087 |
Subject: [PATCH 2/4] device-manager: be more tolerant of tty active console
|
|
|
e22087 |
value
|
|
|
e22087 |
|
|
|
e22087 |
Some kernels mistakenly put tty1 instead of tty0 in the file,
|
|
|
e22087 |
so try to cope with them for maximium compatibility.
|
|
|
e22087 |
---
|
|
|
e22087 |
src/libply-splash-core/ply-device-manager.c | 3 ++-
|
|
|
e22087 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
e22087 |
|
|
|
e22087 |
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
|
|
|
e22087 |
index 098fd85..dbc203d 100644
|
|
|
e22087 |
--- a/src/libply-splash-core/ply-device-manager.c
|
|
|
e22087 |
+++ b/src/libply-splash-core/ply-device-manager.c
|
|
|
e22087 |
@@ -441,61 +441,62 @@ free_terminal (char *device,
|
|
|
e22087 |
ply_device_manager_t *manager)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_hashtable_remove (manager->terminals, device);
|
|
|
e22087 |
|
|
|
e22087 |
ply_terminal_close (terminal);
|
|
|
e22087 |
ply_terminal_free (terminal);
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
static void
|
|
|
e22087 |
free_terminals (ply_device_manager_t *manager)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_hashtable_foreach (manager->terminals,
|
|
|
e22087 |
(ply_hashtable_foreach_func_t *)
|
|
|
e22087 |
free_terminal,
|
|
|
e22087 |
manager);
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
static ply_terminal_t *
|
|
|
e22087 |
get_terminal (ply_device_manager_t *manager,
|
|
|
e22087 |
const char *device_name)
|
|
|
e22087 |
{
|
|
|
e22087 |
char *full_name = NULL;
|
|
|
e22087 |
ply_terminal_t *terminal;
|
|
|
e22087 |
|
|
|
e22087 |
if (strncmp (device_name, "/dev/", strlen ("/dev/")) == 0)
|
|
|
e22087 |
full_name = strdup (device_name);
|
|
|
e22087 |
else
|
|
|
e22087 |
asprintf (&full_name, "/dev/%s", device_name);
|
|
|
e22087 |
|
|
|
e22087 |
if (strcmp (full_name, "/dev/tty0") == 0 ||
|
|
|
e22087 |
- strcmp (full_name, "/dev/tty") == 0)
|
|
|
e22087 |
+ strcmp (full_name, "/dev/tty") == 0 ||
|
|
|
e22087 |
+ strcmp (full_name, ply_terminal_get_name (manager->local_console_terminal)) == 0)
|
|
|
e22087 |
{
|
|
|
e22087 |
terminal = manager->local_console_terminal;
|
|
|
e22087 |
goto done;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
terminal = ply_hashtable_lookup (manager->terminals, full_name);
|
|
|
e22087 |
|
|
|
e22087 |
if (terminal == NULL)
|
|
|
e22087 |
{
|
|
|
e22087 |
terminal = ply_terminal_new (full_name);
|
|
|
e22087 |
|
|
|
e22087 |
ply_hashtable_insert (manager->terminals,
|
|
|
e22087 |
(void *) ply_terminal_get_name (terminal),
|
|
|
e22087 |
terminal);
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
done:
|
|
|
e22087 |
free (full_name);
|
|
|
e22087 |
return terminal;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
ply_device_manager_t *
|
|
|
e22087 |
ply_device_manager_new (const char *default_tty,
|
|
|
e22087 |
ply_device_manager_flags_t flags)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_device_manager_t *manager;
|
|
|
e22087 |
|
|
|
e22087 |
manager = calloc (1, sizeof (ply_device_manager_t));
|
|
|
e22087 |
manager->loop = NULL;
|
|
|
e22087 |
manager->terminals = ply_hashtable_new (ply_hashtable_string_hash, ply_hashtable_string_compare);
|
|
|
e22087 |
--
|
|
|
e22087 |
1.8.3.1
|
|
|
e22087 |
|
|
|
e22087 |
|
|
|
e22087 |
From 0d5fae7feb3c2fb462f124940e91fea16298eb1f Mon Sep 17 00:00:00 2001
|
|
|
e22087 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
e22087 |
Date: Thu, 6 Mar 2014 14:42:16 -0500
|
|
|
e22087 |
Subject: [PATCH 3/4] seat: make sure to open terminal when adding text
|
|
|
e22087 |
displays
|
|
|
e22087 |
|
|
|
e22087 |
If we have a pixel display, the renderer will handle opening the
|
|
|
e22087 |
associated terminal. but if we don't have a pixel display, something
|
|
|
e22087 |
needs to open the terminal.
|
|
|
e22087 |
|
|
|
e22087 |
This commit adds code to do that.
|
|
|
e22087 |
---
|
|
|
e22087 |
src/libply-splash-core/ply-seat.c | 13 +++++++++++++
|
|
|
e22087 |
1 file changed, 13 insertions(+)
|
|
|
e22087 |
|
|
|
e22087 |
diff --git a/src/libply-splash-core/ply-seat.c b/src/libply-splash-core/ply-seat.c
|
|
|
e22087 |
index 541b29e..2ac8bf7 100644
|
|
|
e22087 |
--- a/src/libply-splash-core/ply-seat.c
|
|
|
e22087 |
+++ b/src/libply-splash-core/ply-seat.c
|
|
|
e22087 |
@@ -75,60 +75,73 @@ add_pixel_displays (ply_seat_t *seat)
|
|
|
e22087 |
ply_list_node_t *node;
|
|
|
e22087 |
|
|
|
e22087 |
heads = ply_renderer_get_heads (seat->renderer);
|
|
|
e22087 |
|
|
|
e22087 |
ply_trace ("Adding displays for %d heads",
|
|
|
e22087 |
ply_list_get_length (heads));
|
|
|
e22087 |
|
|
|
e22087 |
node = ply_list_get_first_node (heads);
|
|
|
e22087 |
while (node != NULL)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_list_node_t *next_node;
|
|
|
e22087 |
ply_renderer_head_t *head;
|
|
|
e22087 |
ply_pixel_display_t *display;
|
|
|
e22087 |
|
|
|
e22087 |
head = ply_list_node_get_data (node);
|
|
|
e22087 |
next_node = ply_list_get_next_node (heads, node);
|
|
|
e22087 |
|
|
|
e22087 |
display = ply_pixel_display_new (seat->renderer, head);
|
|
|
e22087 |
|
|
|
e22087 |
ply_list_append_data (seat->pixel_displays, display);
|
|
|
e22087 |
|
|
|
e22087 |
node = next_node;
|
|
|
e22087 |
}
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
static void
|
|
|
e22087 |
add_text_displays (ply_seat_t *seat)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_text_display_t *display;
|
|
|
e22087 |
|
|
|
e22087 |
+ if (!ply_terminal_is_open (seat->terminal))
|
|
|
e22087 |
+ {
|
|
|
e22087 |
+ if (!ply_terminal_open (seat->terminal))
|
|
|
e22087 |
+ {
|
|
|
e22087 |
+ ply_trace ("could not add terminal %s: %m",
|
|
|
e22087 |
+ ply_terminal_get_name (seat->terminal));
|
|
|
e22087 |
+ return;
|
|
|
e22087 |
+ }
|
|
|
e22087 |
+ }
|
|
|
e22087 |
+
|
|
|
e22087 |
+ ply_trace ("adding text display for terminal %s",
|
|
|
e22087 |
+ ply_terminal_get_name (seat->terminal));
|
|
|
e22087 |
+
|
|
|
e22087 |
display = ply_text_display_new (seat->terminal);
|
|
|
e22087 |
ply_list_append_data (seat->text_displays, display);
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
bool
|
|
|
e22087 |
ply_seat_open (ply_seat_t *seat,
|
|
|
e22087 |
ply_renderer_type_t renderer_type,
|
|
|
e22087 |
const char *device)
|
|
|
e22087 |
{
|
|
|
e22087 |
if (renderer_type != PLY_RENDERER_TYPE_NONE)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_renderer_t *renderer;
|
|
|
e22087 |
|
|
|
e22087 |
renderer = ply_renderer_new (renderer_type, device, seat->terminal);
|
|
|
e22087 |
|
|
|
e22087 |
if (!ply_renderer_open (renderer))
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_trace ("could not open renderer for %s", device);
|
|
|
e22087 |
ply_renderer_free (renderer);
|
|
|
e22087 |
|
|
|
e22087 |
seat->renderer = NULL;
|
|
|
e22087 |
seat->renderer_active = false;
|
|
|
e22087 |
|
|
|
e22087 |
if (renderer_type != PLY_RENDERER_TYPE_AUTO)
|
|
|
e22087 |
return false;
|
|
|
e22087 |
}
|
|
|
e22087 |
else
|
|
|
e22087 |
{
|
|
|
e22087 |
seat->renderer = renderer;
|
|
|
e22087 |
seat->renderer_active = true;
|
|
|
e22087 |
--
|
|
|
e22087 |
1.8.3.1
|
|
|
e22087 |
|
|
|
e22087 |
|
|
|
e22087 |
From aa2f5ac95c7cc0f4eb5f61465ecaf22247c7047c Mon Sep 17 00:00:00 2001
|
|
|
e22087 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
e22087 |
Date: Thu, 6 Mar 2014 15:31:20 -0500
|
|
|
e22087 |
Subject: [PATCH 4/4] device-manager: Don't add local console to terminals hash
|
|
|
e22087 |
table unless passed on cmdline
|
|
|
e22087 |
|
|
|
e22087 |
it's unexpected for plymouth to show boot messages on the local console
|
|
|
e22087 |
if there is not console=tty0 on the kernel command line.
|
|
|
e22087 |
|
|
|
e22087 |
This commit fixes that.
|
|
|
e22087 |
---
|
|
|
e22087 |
src/libply-splash-core/ply-device-manager.c | 7 ++++---
|
|
|
e22087 |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
e22087 |
|
|
|
e22087 |
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
|
|
|
e22087 |
index dbc203d..8f5360c 100644
|
|
|
e22087 |
--- a/src/libply-splash-core/ply-device-manager.c
|
|
|
e22087 |
+++ b/src/libply-splash-core/ply-device-manager.c
|
|
|
e22087 |
@@ -445,92 +445,93 @@ free_terminal (char *device,
|
|
|
e22087 |
ply_terminal_close (terminal);
|
|
|
e22087 |
ply_terminal_free (terminal);
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
static void
|
|
|
e22087 |
free_terminals (ply_device_manager_t *manager)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_hashtable_foreach (manager->terminals,
|
|
|
e22087 |
(ply_hashtable_foreach_func_t *)
|
|
|
e22087 |
free_terminal,
|
|
|
e22087 |
manager);
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
static ply_terminal_t *
|
|
|
e22087 |
get_terminal (ply_device_manager_t *manager,
|
|
|
e22087 |
const char *device_name)
|
|
|
e22087 |
{
|
|
|
e22087 |
char *full_name = NULL;
|
|
|
e22087 |
ply_terminal_t *terminal;
|
|
|
e22087 |
|
|
|
e22087 |
if (strncmp (device_name, "/dev/", strlen ("/dev/")) == 0)
|
|
|
e22087 |
full_name = strdup (device_name);
|
|
|
e22087 |
else
|
|
|
e22087 |
asprintf (&full_name, "/dev/%s", device_name);
|
|
|
e22087 |
|
|
|
e22087 |
if (strcmp (full_name, "/dev/tty0") == 0 ||
|
|
|
e22087 |
strcmp (full_name, "/dev/tty") == 0 ||
|
|
|
e22087 |
strcmp (full_name, ply_terminal_get_name (manager->local_console_terminal)) == 0)
|
|
|
e22087 |
{
|
|
|
e22087 |
terminal = manager->local_console_terminal;
|
|
|
e22087 |
+
|
|
|
e22087 |
+ ply_hashtable_insert (manager->terminals,
|
|
|
e22087 |
+ (void *) ply_terminal_get_name (terminal),
|
|
|
e22087 |
+ terminal);
|
|
|
e22087 |
goto done;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
terminal = ply_hashtable_lookup (manager->terminals, full_name);
|
|
|
e22087 |
|
|
|
e22087 |
if (terminal == NULL)
|
|
|
e22087 |
{
|
|
|
e22087 |
terminal = ply_terminal_new (full_name);
|
|
|
e22087 |
|
|
|
e22087 |
ply_hashtable_insert (manager->terminals,
|
|
|
e22087 |
(void *) ply_terminal_get_name (terminal),
|
|
|
e22087 |
terminal);
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
done:
|
|
|
e22087 |
free (full_name);
|
|
|
e22087 |
return terminal;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
ply_device_manager_t *
|
|
|
e22087 |
ply_device_manager_new (const char *default_tty,
|
|
|
e22087 |
ply_device_manager_flags_t flags)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_device_manager_t *manager;
|
|
|
e22087 |
|
|
|
e22087 |
manager = calloc (1, sizeof (ply_device_manager_t));
|
|
|
e22087 |
manager->loop = NULL;
|
|
|
e22087 |
manager->terminals = ply_hashtable_new (ply_hashtable_string_hash, ply_hashtable_string_compare);
|
|
|
e22087 |
manager->local_console_terminal = ply_terminal_new (default_tty);
|
|
|
e22087 |
- ply_hashtable_insert (manager->terminals,
|
|
|
e22087 |
- (void *) ply_terminal_get_name (manager->local_console_terminal),
|
|
|
e22087 |
- manager->local_console_terminal);
|
|
|
e22087 |
manager->seats = ply_list_new ();
|
|
|
e22087 |
manager->flags = flags;
|
|
|
e22087 |
|
|
|
e22087 |
if (!(flags & PLY_DEVICE_MANAGER_FLAGS_IGNORE_UDEV))
|
|
|
e22087 |
manager->udev_context = udev_new ();
|
|
|
e22087 |
|
|
|
e22087 |
attach_to_event_loop (manager, ply_event_loop_get_default ());
|
|
|
e22087 |
|
|
|
e22087 |
return manager;
|
|
|
e22087 |
}
|
|
|
e22087 |
|
|
|
e22087 |
void
|
|
|
e22087 |
ply_device_manager_free (ply_device_manager_t *manager)
|
|
|
e22087 |
{
|
|
|
e22087 |
ply_trace ("freeing device manager");
|
|
|
e22087 |
|
|
|
e22087 |
if (manager == NULL)
|
|
|
e22087 |
return;
|
|
|
e22087 |
|
|
|
e22087 |
ply_event_loop_stop_watching_for_exit (manager->loop,
|
|
|
e22087 |
(ply_event_loop_exit_handler_t)
|
|
|
e22087 |
detach_from_event_loop,
|
|
|
e22087 |
manager);
|
|
|
e22087 |
free_seats (manager);
|
|
|
e22087 |
ply_list_free (manager->seats);
|
|
|
e22087 |
|
|
|
e22087 |
free_terminals (manager);
|
|
|
e22087 |
ply_hashtable_free (manager->terminals);
|
|
|
e22087 |
|
|
|
e22087 |
if (manager->udev_monitor != NULL)
|
|
|
e22087 |
--
|
|
|
e22087 |
1.8.3.1
|
|
|
e22087 |
|