According to the kernel documentation doc/Documentation/serial-console.txt and
doc/Documentation/devices.txt we should use /dev/ttyN. /dev/tty0 for the VT
ioctls, and /dev/ttyN for all the virtual terminals. Checking /dev/vc is
therefore unnecessary.

Signed-off-by: Cody Maloney <cmalo...@theoreticalchaos.com>
---
 hw/xfree86/os-support/linux/lnx_init.c |   39 ++++++-------------------------
 1 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/hw/xfree86/os-support/linux/lnx_init.c 
b/hw/xfree86/os-support/linux/lnx_init.c
index 77dfb2f..9ee93b2 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -76,12 +76,12 @@ switch_to(int vt, const char *from)
 void
 xf86OpenConsole(void)
 {
-    int i, fd = -1, ret;
+    int fd = -1, ret;
     struct vt_mode VT;
     struct vt_stat vts;
     MessageType from = X_PROBED;
-    char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
-    char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
+    const char *console_fname = "/dev/tty0";
+    const char *tty = "/dev/tty%d";
 
     if (serverGeneration == 1) {
 
@@ -96,18 +96,12 @@ xf86OpenConsole(void)
        if (xf86Info.vtno != -1) {
            from = X_CMDLINE;
        } else {
+           fd = open(console_fname, O_WRONLY, 0);
 
-           i=0;
-           while (tty0[i] != NULL) {
-               if ((fd = open(tty0[i],O_WRONLY,0)) >= 0)
-                 break;
-               i++;
-           }
-           
            if (fd < 0)
                FatalError(
-                   "xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
-                   strerror(errno));
+                   "xf86OpenConsole: Cannot open /dev/console to use VT"
+                   "ioctls (%s)\n", strerror(errno));
 
             if (ShareVTs)
             {
@@ -149,13 +143,8 @@ xf86OpenConsole(void)
                        strerror(errno));
        }
 
-        i=0;
-        while (vcs[i] != NULL) {
-            sprintf(vtname, vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
-           if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
-               break;
-            i++;
-        }
+        sprintf(vtname, tty, xf86Info.vtno); /* /dev/tty1-64 */
+        xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0);
 
        if (xf86Info.consoleFd < 0)
            FatalError("xf86OpenConsole: Cannot open virtual console"
@@ -172,18 +161,6 @@ xf86OpenConsole(void)
        else
            activeVT = vts.v_active;
 
-#if 0
-       if (!KeepTty) {
-           /*
-            * Detach from the controlling tty to avoid char loss
-            */
-           if ((i = open("/dev/tty",O_RDWR)) >= 0) {
-               SYSCALL(ioctl(i, TIOCNOTTY, 0));
-               close(i);
-           }
-       }
-#endif
-
         if (!ShareVTs)
         {
             struct termios nTty;
-- 
1.7.5.1

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to