Re: patch "Revert "tty: Set correct tty name in 'active' sysfs attribute"" added to tty tree

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

 



On Sat, Feb 22, 2014 at 02:34:11PM -0800, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     Revert "tty: Set correct tty name in 'active' sysfs attribute"
> 
> to my tty git tree which can be found at
>     git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
> in the tty-linus branch.
> 
> The patch will show up in the next release of the linux-next tree
> (usually sometime within the next 24 hours during the week.)
> 
> The patch will hopefully also be merged in Linus's tree for the
> next -rc kernel release.
> 
> If you have any questions about this process, please let me know.
> 
> 
> From 5c0a2450d695bbe32b1fb81c07751bcbea64f084 Mon Sep 17 00:00:00 2001
> From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Date: Sat, 22 Feb 2014 14:31:04 -0800
> Subject: Revert "tty: Set correct tty name in 'active' sysfs attribute"
> 
> This reverts commit d8a5dc3033af2fd6d16030d2ee4fbd073460fe54.
> 
> This breaks plymouth installs, either because plymouth is using the file
> "incorrectly" or because the patch is incorrect.  Either way, this needs
> to be reverted until it is all figured out.

IMHO this is a bug in plymouth as systemd does it correct in

src/getty-generator/getty-generator.c

From plymouth code src/main.c in add_consoles_from_file() it can be seen that:

      /* If this console is anything besides tty0, then the user is sort
       * of a weird case (uses a serial console or whatever) and they
       * most likely don't want a graphical splash, so force details.
       */
      if (strcmp (console, "tty0") != 0)
        state->should_force_details = true;

      asprintf (&console_device, "/dev/%s", console);

      free (console);

      ply_trace ("console %s found!", console_device);
      ply_hashtable_insert (consoles, console_device, console_device);
      num_consoles++;

only checks for normal PC configurations that is here for tty0 but ignores
the real active virtual console e.g. tty1.  The patch

 "tty: Set correct tty name in 'active' sysfs attribute"

force the usage of the current used tty's of the system console. This
patch is required to be able to find the correct devices on other
architectures like s390x with the TN3270 consoles.

As fix I suggest to use either a check for the major == 4 and the minor
0 up to 63 or the way as systemd it does, that is to search for the
names /dev/tty1 upto /dev/tty63 for virtual consoles. And if not
found or an other devices is found to switch to the serial console
mode.  I've attached a simple patch to enhance plymouth's in the
same manner as systemd does it.

Werner

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr
From: Werner Fink <werner@xxxxxxx>
Date: Mon Feb 24 08:34:42 UTC 2014
Subject: [PATCH] Make plymouth's check for none virtual console devices smart

---
 main.c |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

--- src/main.c
+++ src/main.c	2014-02-24 08:32:41.059591757 +0000
@@ -1979,6 +1979,30 @@ add_display_and_keyboard_for_console (co
 }
 
 static int
+tty_is_vc (const char *tty)
+{
+  char *end = NULL;
+  long int num;
+
+  assert(tty);
+
+  if (strncmp(tty, "/dev/", 5) == 0)
+    tty += 5;
+  if (strncmp(tty, "tty", 3) == 0)
+    tty += 3;
+  else
+    return 0;
+  if (*tty < '0' || *tty > '9')
+    return 0;
+
+  num = strtol (tty, &end, 10);
+  if (!end || end == tty || *end || errno)
+    return 0;
+
+  return num >= 0 && num <= 63;
+}
+
+static int
 add_consoles_from_file (state_t         *state,
                         ply_hashtable_t *consoles,
                         const char      *path)
@@ -2038,7 +2062,7 @@ add_consoles_from_file (state_t
        * of a weird case (uses a serial console or whatever) and they
        * most likely don't want a graphical splash, so force details.
        */
-      if (strcmp (console, "tty0") != 0)
+      if (!tty_is_vc (console))
         state->should_force_details = true;
 
       asprintf (&console_device, "/dev/%s", console);

Attachment: pgpbi33ksF55r.pgp
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]