[f16-branch 2/5] loader/serial.c: use special serial consoles if present (#752596)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



loader has some magic code to switch its output terminal to a serial
console under certain circumstances. In F15 and earlier it worked
basically like this:

 1. if a 'weird' serial device (xvc0, hvc0, hvsi[0-2]) exists, use that
 2. else if /dev/console is actually a serial device, use that
 3. else if 'serial' was on the boot cmdline, use ttyS0
 4. else just use tty1

Commit 422702a3 refactored the serial handling into its own file, and
accidentally changed this behavior so that the serial devices were
never checked unless 'serial' was on the commandline.

Restoring this behavior means that users of special serial consoles
(e.g. POWER systems and others with /dev/hvc0 and no graphics) don't
see their installs hang after 'Starting Anaconda version XXX..."
---
 loader/serial.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/loader/serial.c b/loader/serial.c
index fa4c9a5..735ee9e 100644
--- a/loader/serial.c
+++ b/loader/serial.c
@@ -73,7 +73,7 @@ static int serial_requested(GHashTable *cmdline) {
         return 0;
 }
 
-static int get_serial_fd() {
+static int get_serial_fd(GHashTable *cmdline) {
     int i, fd = -1;
     int weird = 0;
     char twelve = 12;
@@ -114,15 +114,17 @@ static int get_serial_fd() {
 
     restore_mode(&orig_cmode);
 
+    /* check to see if /dev/console is actually a serial device */
     if (fd < 0 && ioctl(0, TIOCLINUX, &twelve) < 0) {
         console = "/dev/console";
 
         if (ioctl(0, TIOCGSERIAL, &si) == -1)
             console = NULL;
     }
-    else
+    else if (serial_requested(cmdline))
         console = "/dev/ttyS0";
 
+    /* get an fd for the console if we don't already have one */
     if (console && !weird) {
         fd = open(console, O_RDWR, 0);
         if (fd < 0)
@@ -161,7 +163,7 @@ int init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdline
      */
     get_mode_and_flags(orig_cmode, orig_flags);
 
-    if (!serial_requested(cmdline) || (fd = get_serial_fd()) == -1) {
+    if ((fd = get_serial_fd(cmdline)) == -1) {
         /* This is not a serial console install. */
         serial = 0;
         if ((fd = open("/dev/tty1", O_RDWR, 0)) < 0) {
-- 
1.7.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux