View | Details | Raw Unified | Return to bug 220562
Collapse All | Expand All

(-)x11-servers/xorg-server/files/patch-hw_xfree86_os-support_bsd_bsd__init.c (-1 / +54 lines)
Lines 1-6 Link Here
1
--- hw/xfree86/os-support/bsd/bsd_init.c.orig	2016-07-19 17:07:29 UTC
1
--- hw/xfree86/os-support/bsd/bsd_init.c.orig	2016-07-19 17:07:29 UTC
2
+++ hw/xfree86/os-support/bsd/bsd_init.c
2
+++ hw/xfree86/os-support/bsd/bsd_init.c
3
@@ -230,6 +230,9 @@ xf86OpenConsole()
3
@@ -48,6 +48,8 @@ static int devConsoleFd = -1;
4
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
5
 static int VTnum = -1;
6
 static int initialVT = -1;
7
+static struct termios tty_attr;	/* tty state to restore */
8
+static int tty_mode;		/* kbd mode to restore */
9
 #endif
10
 
11
 #ifdef PCCONS_SUPPORT
12
@@ -230,6 +232,9 @@ xf86OpenConsole()
4
              * Add cases for other *BSD that behave the same.
13
              * Add cases for other *BSD that behave the same.
5
              */
14
              */
6
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
15
 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
Lines 10-12 Link Here
10
             uname(&uts);
19
             uname(&uts);
11
             i = atof(uts.release) * 100;
20
             i = atof(uts.release) * 100;
12
             if (i >= 310)
21
             if (i >= 310)
22
@@ -253,6 +258,7 @@ xf86OpenConsole()
23
 #endif
24
  acquire_vt:
25
             if (!xf86Info.ShareVTs) {
26
+                struct termios nTty;
27
                 /*
28
                  * now get the VT
29
                  */
30
@@ -287,6 +293,26 @@ xf86OpenConsole()
31
                 if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
32
                     FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed");
33
                 }
34
+
35
+                tcgetattr(xf86Info.consoleFd, &tty_attr);
36
+                ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode);
37
+
38
+                /* disable special keys */
39
+                if (ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW) < 0) {
40
+                    FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed (%s)",
41
+                               strerror(errno));
42
+                }
43
+
44
+                nTty = tty_attr;
45
+                nTty.c_iflag = IGNPAR | IGNBRK;
46
+                nTty.c_oflag = 0;
47
+                nTty.c_cflag = CREAD | CS8;
48
+                nTty.c_lflag = 0;
49
+                nTty.c_cc[VTIME] = 0;
50
+                nTty.c_cc[VMIN] = 1;
51
+                cfsetispeed(&nTty, 9600);
52
+                cfsetospeed(&nTty, 9600);
53
+                tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
54
             }
55
             else {              /* xf86Info.ShareVTs */
56
                 close(xf86Info.consoleFd);
57
@@ -594,6 +620,8 @@ xf86CloseConsole()
58
     case SYSCONS:
59
     case PCVT:
60
         ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT);  /* Back to text mode */
61
+        ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode);
62
+        tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
63
         if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) {
64
             VT.mode = VT_AUTO;
65
             ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* dflt vt handling */

Return to bug 220562