diff options
author | Ray Strode <rstrode@redhat.com> | 2014-03-03 17:55:59 -0500 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2014-03-03 18:02:25 -0500 |
commit | 4745c344783c8fe69d6aa6190836acc219845be9 (patch) | |
tree | c8cdb162ad91997e90a14f9e78bcbeadb3a6438c | |
parent | 97f02ee959374afb1b8a78dc67116cd880cf2d23 (diff) |
device-manager: ignore udev if only console is serial console
Right now we use the heuristic, "more than one entry in
/sys/class/tty/console/active" to mean "has serial consoles".
We used to use the heuristic "file has more than tty0 in it".
The older heuristic is more accurate because a user may have
console=ttyS0 without console=tty0 on the kernel command line.
-rw-r--r-- | src/libply-splash-core/ply-device-manager.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c index d06e1b5d..098fd852 100644 --- a/src/libply-splash-core/ply-device-manager.c +++ b/src/libply-splash-core/ply-device-manager.c @@ -541,14 +541,14 @@ ply_device_manager_free (ply_device_manager_t *manager) free (manager); } -static int +static bool add_consoles_from_file (ply_device_manager_t *manager, const char *path) { int fd; char contents[512] = ""; ssize_t contents_length; - int num_consoles; + bool has_serial_consoles; const char *remaining_file_contents; ply_trace ("opening %s", path); @@ -557,7 +557,7 @@ add_consoles_from_file (ply_device_manager_t *manager, if (fd < 0) { ply_trace ("couldn't open it: %m"); - return 0; + return false; } ply_trace ("reading file"); @@ -567,12 +567,12 @@ add_consoles_from_file (ply_device_manager_t *manager, { ply_trace ("couldn't read it: %m"); close (fd); - return 0; + return false; } close (fd); remaining_file_contents = contents; - num_consoles = 0; + has_serial_consoles = false; while (remaining_file_contents < contents + contents_length) { @@ -603,7 +603,9 @@ add_consoles_from_file (ply_device_manager_t *manager, free (console); ply_trace ("console %s found!", console_device); - num_consoles++; + + if (terminal != manager->local_console_terminal) + has_serial_consoles = true; /* Move past the parsed console string, and the whitespace we * may have found above. If we found a NUL above and not whitespace, @@ -613,7 +615,7 @@ add_consoles_from_file (ply_device_manager_t *manager, remaining_file_contents += console_length + 1; } - return num_consoles; + return has_serial_consoles; } static void @@ -667,24 +669,21 @@ create_seat_for_terminal (const char *device_path, static bool create_seats_from_terminals (ply_device_manager_t *manager) { - int num_consoles; + bool has_serial_consoles; ply_trace ("checking for consoles"); if (manager->flags & PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES) { - num_consoles = 0; + has_serial_consoles = false; ply_trace ("ignoring all consoles but default console because explicitly told to."); } else { - num_consoles = add_consoles_from_file (manager, "/sys/class/tty/console/active"); - - if (num_consoles == 0) - ply_trace ("ignoring all consoles but default console because /sys/class/tty/console/active could not be read"); + has_serial_consoles = add_consoles_from_file (manager, "/sys/class/tty/console/active"); } - if (num_consoles > 1) + if (has_serial_consoles) { ply_trace ("serial consoles detected, managing them with details forced"); ply_hashtable_foreach (manager->terminals, |