[f16-branch 1/5] loader: actually set serial flag when using serial console

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

 



In F15 and earlier, if the primary console was a serial port, loader
would set the appropriate flag (LOADER_FLAGS_SERIAL). This got dropped
accidentally in the refactoring work after F15 (see commit 7605892).

This will correctly set the flag (and thus force text mode) if
init_serial() indicates that a serial console is being used.
---
 loader/loader.c |    3 ++-
 loader/serial.c |    8 ++++++--
 loader/serial.h |    2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/loader/loader.c b/loader/loader.c
index cb8b7ab..56c0718 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -2008,7 +2008,8 @@ int main(int argc, char ** argv) {
 
     logMessage(INFO, "anaconda version %s on %s starting", VERSION, getProductArch());
 
-    init_serial(&orig_cmode, &orig_flags, cmdline);
+    if (init_serial(&orig_cmode, &orig_flags, cmdline))
+        flags |= LOADER_FLAGS_SERIAL;
 
     if ((FL_SERIAL(flags) || FL_VIRTPCONSOLE(flags)) && 
         !hasGraphicalOverride()) {
diff --git a/loader/serial.c b/loader/serial.c
index c4b722a..fa4c9a5 100644
--- a/loader/serial.c
+++ b/loader/serial.c
@@ -151,9 +151,9 @@ static void set_term(int fd, GHashTable *cmdline) {
 }
 #endif
 
-void init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdline) {
+int init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdline) {
 #if !defined(__s390__) && !defined(__s390x__)
-    int fd;
+    int fd, serial;
 
     /* We need to get the original mode and flags here (in addition to inside
      * get_serial) so we'll have them for later when we restore the console
@@ -163,6 +163,7 @@ void init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdlin
 
     if (!serial_requested(cmdline) || (fd = get_serial_fd()) == -1) {
         /* This is not a serial console install. */
+        serial = 0;
         if ((fd = open("/dev/tty1", O_RDWR, 0)) < 0) {
             if ((fd = open("/dev/vc/1", O_RDWR, 0)) < 0) {
                 fprintf(stderr, "failed to open /dev/tty1 and /dev/vc/1");
@@ -171,6 +172,7 @@ void init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdlin
         }
     }
     else {
+        serial = 1;
         struct winsize winsize;
 
         if (ioctl(fd, TIOCGWINSZ, &winsize)) {
@@ -219,4 +221,6 @@ void init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdlin
         ts.c_iflag &= ~ISIG;
         tcsetattr(0, TCSANOW, &ts);
     }
+
+    return serial;
 }
diff --git a/loader/serial.h b/loader/serial.h
index 82e086c..34806da 100644
--- a/loader/serial.h
+++ b/loader/serial.h
@@ -6,4 +6,4 @@
 void get_mode_and_flags(struct termios *cmode, int *flags);
 void set_mode(struct termios *cmode);
 void restore_console(struct termios *orig_cmode, int orig_flags);
-void init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdline);
+int init_serial(struct termios *orig_cmode, int *orig_flags, GHashTable *cmdline);
-- 
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