diff options
author | Aaron Zang <Aaron.Zang@Sun.COM> | 2009-08-03 23:21:39 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-13 21:56:06 -0700 |
commit | 48ee5558333bd324463b6994735cabb23de262ec (patch) | |
tree | 6e9af7f602bb7bd027c9a0767847928d19fb2ce3 | |
parent | 613e76ff9055d8ac2b1af1130668180646a9e14c (diff) |
Add new VT support for OpenSolaris & future Solaris releases
Signed-off-by: Aaron Zang <Aaron.Zang@Sun.COM>
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Events.c | 8 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Globals.c | 3 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Privstr.h | 3 | ||||
-rw-r--r-- | hw/xfree86/doc/man/Xorg.man.pre | 2 | ||||
-rw-r--r-- | hw/xfree86/os-support/solaris/Makefile.am | 4 | ||||
-rw-r--r-- | hw/xfree86/os-support/solaris/sun_VTsw.c | 110 | ||||
-rw-r--r-- | hw/xfree86/os-support/solaris/sun_init.c | 177 | ||||
-rw-r--r-- | hw/xfree86/os-support/xf86_OSlib.h | 11 | ||||
-rw-r--r-- | include/xorg-config.h.in | 3 |
10 files changed, 229 insertions, 94 deletions
diff --git a/configure.ac b/configure.ac index 3bdfbab02..ff82d0e14 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1443,6 +1443,7 @@ if test "x$XORG" = xyes; then | |||
1443 | # use libpciaccess for PCI | 1443 | # use libpciaccess for PCI |
1444 | xorg_bus_bsdpci="yes" | 1444 | xorg_bus_bsdpci="yes" |
1445 | AC_CHECK_HEADERS([sys/kd.h]) | 1445 | AC_CHECK_HEADERS([sys/kd.h]) |
1446 | AC_CHECK_HEADERS([sys/vt.h], [solaris_vt=yes], [solaris_vt=no]) | ||
1446 | # Check for minimum supported release | 1447 | # Check for minimum supported release |
1447 | AC_MSG_CHECKING([Solaris version]) | 1448 | AC_MSG_CHECKING([Solaris version]) |
1448 | OS_MINOR=`echo ${host_os}|sed -e 's/^.*solaris2\.//' -e s'/\..*$//'` | 1449 | OS_MINOR=`echo ${host_os}|sed -e 's/^.*solaris2\.//' -e s'/\..*$//'` |
@@ -1603,6 +1604,7 @@ AM_CONDITIONAL([LINUX_IA64], [test "x$linux_ia64" = xyes]) | |||
1603 | AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes]) | 1604 | AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes]) |
1604 | AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes]) | 1605 | AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes]) |
1605 | AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes]) | 1606 | AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes]) |
1607 | AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes]) | ||
1606 | AM_CONDITIONAL([DGA], [test "x$DGA" = xyes]) | 1608 | AM_CONDITIONAL([DGA], [test "x$DGA" = xyes]) |
1607 | AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes]) | 1609 | AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes]) |
1608 | 1610 | ||
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 58ce15bac..9487fe7b2 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c | |||
@@ -201,8 +201,16 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) | |||
201 | #if defined(__SCO__) || defined(__UNIXWARE__) | 201 | #if defined(__SCO__) || defined(__UNIXWARE__) |
202 | vtno--; | 202 | vtno--; |
203 | #endif | 203 | #endif |
204 | #if defined(sun) | ||
205 | if (vtno == xf86Info.vtno) | ||
206 | break; | ||
207 | |||
208 | xf86Info.vtRequestsPending = TRUE; | ||
209 | xf86Info.vtPendingNum = vtno; | ||
210 | #else | ||
204 | if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) | 211 | if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) |
205 | ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); | 212 | ErrorF("Failed to switch consoles (%s)\n", strerror(errno)); |
213 | #endif | ||
206 | } | 214 | } |
207 | break; | 215 | break; |
208 | case ACTION_SWITCHSCREEN_NEXT: | 216 | case ACTION_SWITCHSCREEN_NEXT: |
diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index df0470c48..d8f7f7f27 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c | |||
@@ -104,6 +104,9 @@ xf86InfoRec xf86Info = { | |||
104 | .vtSysreq = FALSE, | 104 | .vtSysreq = FALSE, |
105 | .lastEventTime = -1, | 105 | .lastEventTime = -1, |
106 | .vtRequestsPending = FALSE, | 106 | .vtRequestsPending = FALSE, |
107 | #ifdef sun | ||
108 | .vtPendingNum = -1, | ||
109 | #endif | ||
107 | .dontVTSwitch = FALSE, | 110 | .dontVTSwitch = FALSE, |
108 | .dontZap = FALSE, | 111 | .dontZap = FALSE, |
109 | .dontZoom = FALSE, | 112 | .dontZoom = FALSE, |
diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 1a2f73637..26f822dc4 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h | |||
@@ -62,6 +62,9 @@ typedef struct { | |||
62 | /* event handler part */ | 62 | /* event handler part */ |
63 | int lastEventTime; | 63 | int lastEventTime; |
64 | Bool vtRequestsPending; | 64 | Bool vtRequestsPending; |
65 | #ifdef sun | ||
66 | int vtPendingNum; | ||
67 | #endif | ||
65 | Bool dontVTSwitch; | 68 | Bool dontVTSwitch; |
66 | Bool dontZap; | 69 | Bool dontZap; |
67 | Bool dontZoom; | 70 | Bool dontZoom; |
diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man.pre index ac4897966..2f9ff98c7 100644 --- a/hw/xfree86/doc/man/Xorg.man.pre +++ b/hw/xfree86/doc/man/Xorg.man.pre | |||
@@ -134,7 +134,7 @@ will use. Without this option, | |||
134 | .B __xservername__ | 134 | .B __xservername__ |
135 | will pick the first available Virtual Terminal that it can locate. This | 135 | will pick the first available Virtual Terminal that it can locate. This |
136 | option applies only to platforms that have virtual terminal support, such | 136 | option applies only to platforms that have virtual terminal support, such |
137 | as Linux, BSD, SVR3, and SVR4. | 137 | as Linux, BSD, OpenSolaris, SVR3, and SVR4. |
138 | .TP | 138 | .TP |
139 | .B \-allowMouseOpenFail | 139 | .B \-allowMouseOpenFail |
140 | Allow the server to start up even if the mouse device can't be opened | 140 | Allow the server to start up even if the mouse device can't be opened |
diff --git a/hw/xfree86/os-support/solaris/Makefile.am b/hw/xfree86/os-support/solaris/Makefile.am index c7ac08bce..5163f4423 100644 --- a/hw/xfree86/os-support/solaris/Makefile.am +++ b/hw/xfree86/os-support/solaris/Makefile.am | |||
@@ -1,5 +1,5 @@ | |||
1 | if SOLARIS_USL_CONSOLE | 1 | if SOLARIS_VT |
2 | VTSW_SRC = $(srcdir)/../shared/VTsw_usl.c | 2 | VTSW_SRC = sun_VTsw.c |
3 | else | 3 | else |
4 | VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c | 4 | VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c |
5 | endif | 5 | endif |
diff --git a/hw/xfree86/os-support/solaris/sun_VTsw.c b/hw/xfree86/os-support/solaris/sun_VTsw.c new file mode 100644 index 000000000..0dc76b8b5 --- /dev/null +++ b/hw/xfree86/os-support/solaris/sun_VTsw.c | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | * Copyright 2009 Sun Microsystems, Inc. All rights reserved. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the | ||
6 | * "Software"), to deal in the Software without restriction, including | ||
7 | * without limitation the rights to use, copy, modify, merge, publish, | ||
8 | * distribute, and/or sell copies of the Software, and to permit persons | ||
9 | * to whom the Software is furnished to do so, provided that the above | ||
10 | * copyright notice(s) and this permission notice appear in all copies of | ||
11 | * the Software and that both the above copyright notice(s) and this | ||
12 | * permission notice appear in supporting documentation. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT | ||
17 | * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR | ||
18 | * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL | ||
19 | * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING | ||
20 | * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
21 | * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
22 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
23 | * | ||
24 | * Except as contained in this notice, the name of a copyright holder | ||
25 | * shall not be used in advertising or otherwise to promote the sale, use | ||
26 | * or other dealings in this Software without prior written authorization | ||
27 | * of the copyright holder. | ||
28 | */ | ||
29 | |||
30 | #ifdef HAVE_XORG_CONFIG_H | ||
31 | #include <xorg-config.h> | ||
32 | #endif | ||
33 | |||
34 | #include <X11/X.h> | ||
35 | |||
36 | #include "xf86.h" | ||
37 | #include "xf86Priv.h" | ||
38 | #include "xf86_OSlib.h" | ||
39 | |||
40 | #include <door.h> | ||
41 | #include <sys/vtdaemon.h> | ||
42 | |||
43 | /* | ||
44 | * Handle the VT-switching interface for Solaris/OpenSolaris | ||
45 | */ | ||
46 | |||
47 | void | ||
48 | xf86VTRequest(int sig) | ||
49 | { | ||
50 | if (xf86Info.vtPendingNum != -1) | ||
51 | { | ||
52 | ioctl(xf86Info.consoleFd, VT_RELDISP, 1); | ||
53 | xf86Info.vtPendingNum = -1; | ||
54 | |||
55 | return; | ||
56 | } | ||
57 | |||
58 | xf86Info.vtRequestsPending = TRUE; | ||
59 | return; | ||
60 | } | ||
61 | |||
62 | Bool | ||
63 | xf86VTSwitchPending(void) | ||
64 | { | ||
65 | return(xf86Info.vtRequestsPending ? TRUE : FALSE); | ||
66 | } | ||
67 | |||
68 | Bool | ||
69 | xf86VTSwitchAway(void) | ||
70 | { | ||
71 | int door_fd; | ||
72 | vt_cmd_arg_t vt_door_arg; | ||
73 | door_arg_t door_arg; | ||
74 | |||
75 | xf86Info.vtRequestsPending = FALSE; | ||
76 | |||
77 | vt_door_arg.vt_ev = VT_EV_HOTKEYS; | ||
78 | vt_door_arg.vt_num = xf86Info.vtPendingNum; | ||
79 | door_arg.data_ptr = (char *)&vt_door_arg; | ||
80 | door_arg.data_size = sizeof (vt_cmd_arg_t); | ||
81 | door_arg.rbuf = NULL; | ||
82 | door_arg.rsize = 0; | ||
83 | door_arg.desc_ptr = NULL; | ||
84 | door_arg.desc_num = 0; | ||
85 | |||
86 | if ((door_fd = open(VT_DAEMON_DOOR_FILE, O_RDONLY)) < 0) | ||
87 | return (FALSE); | ||
88 | |||
89 | if (door_call(door_fd, &door_arg) != 0) { | ||
90 | close(door_fd); | ||
91 | return (FALSE); | ||
92 | } | ||
93 | |||
94 | close(door_fd); | ||
95 | return (TRUE); | ||
96 | } | ||
97 | |||
98 | Bool | ||
99 | xf86VTSwitchTo(void) | ||
100 | { | ||
101 | xf86Info.vtRequestsPending = FALSE; | ||
102 | if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) | ||
103 | { | ||
104 | return(FALSE); | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | return(TRUE); | ||
109 | } | ||
110 | } | ||
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c index 56f5e7c99..44588dd9f 100644 --- a/hw/xfree86/os-support/solaris/sun_init.c +++ b/hw/xfree86/os-support/solaris/sun_init.c | |||
@@ -38,9 +38,11 @@ static Bool Protect0 = FALSE; | |||
38 | #ifdef HAS_USL_VTS | 38 | #ifdef HAS_USL_VTS |
39 | static int VTnum = -1; | 39 | static int VTnum = -1; |
40 | static int xf86StartVT = -1; | 40 | static int xf86StartVT = -1; |
41 | #endif | 41 | static int vtEnabled = 0; |
42 | 42 | static char fb_dev[PATH_MAX] = "/dev/vt/0"; | |
43 | #else | ||
43 | static char fb_dev[PATH_MAX] = "/dev/fb"; | 44 | static char fb_dev[PATH_MAX] = "/dev/fb"; |
45 | #endif | ||
44 | 46 | ||
45 | void | 47 | void |
46 | xf86OpenConsole(void) | 48 | xf86OpenConsole(void) |
@@ -89,52 +91,60 @@ xf86OpenConsole(void) | |||
89 | /* | 91 | /* |
90 | * Setup the virtual terminal manager | 92 | * Setup the virtual terminal manager |
91 | */ | 93 | */ |
92 | if (VTnum != -1) | 94 | if ((fd = open("/dev/vt/0",O_RDWR,0)) == -1) |
93 | { | 95 | { |
94 | xf86Info.vtno = VTnum; | 96 | xf86ErrorF("xf86OpenConsole: Cannot open /dev/vt/0 (%s)\n", |
95 | from = X_CMDLINE; | 97 | strerror(errno)); |
98 | vtEnabled = 0; | ||
96 | } | 99 | } |
97 | else | 100 | else |
98 | { | 101 | { |
99 | if ((fd = open("/dev/vt00",O_RDWR,0)) < 0) | 102 | if (ioctl(fd, VT_ENABLED, &vtEnabled) < 0) |
100 | FatalError("xf86OpenConsole: Cannot open /dev/vt00 (%s)\n", | 103 | { |
101 | strerror(errno)); | 104 | xf86ErrorF("xf86OpenConsole: VT_ENABLED failed (%s)\n", |
105 | strerror(errno)); | ||
106 | vtEnabled = 0; | ||
107 | } | ||
108 | } | ||
102 | 109 | ||
110 | |||
111 | if (vtEnabled == 0) | ||
112 | { | ||
113 | /* VT not enabled - kernel too old or Sparc platforms | ||
114 | without visual_io support */ | ||
115 | xf86Msg(from, "VT infrastructure is not available\n"); | ||
116 | |||
117 | xf86StartVT = 0; | ||
118 | xf86Info.vtno = 0; | ||
119 | } | ||
120 | else | ||
121 | { | ||
103 | if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) | 122 | if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) |
104 | FatalError("xf86OpenConsole: Cannot determine current VT\n"); | 123 | FatalError("xf86OpenConsole: Cannot determine current VT\n"); |
105 | 124 | ||
106 | xf86StartVT = vtinfo.v_active; | 125 | xf86StartVT = vtinfo.v_active; |
107 | 126 | ||
108 | /* | 127 | if (VTnum != -1) |
109 | * There is a SEVERE problem with x86's VT's. The VT_OPENQRY | 128 | { |
110 | * ioctl() will panic the entire system if all 8 (7 VT's+Console) | 129 | xf86Info.vtno = VTnum; |
111 | * terminals are used. The only other way I've found to determine | 130 | from = X_CMDLINE; |
112 | * if there is a free VT is to try activating all the the available | 131 | } |
113 | * VT's and see if they all succeed - if they do, there there is no | 132 | else |
114 | * free VT, and the Xserver cannot continue without panic'ing the | 133 | { |
115 | * system. (It's ugly, but it seems to work.) Note there is a | 134 | if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || |
116 | * possible race condition here. | 135 | (xf86Info.vtno == -1)) { |
117 | * | 136 | FatalError("xf86OpenConsole: Cannot find a free VT\n"); |
118 | * David Holland 2/23/94 | 137 | } |
119 | */ | 138 | } |
120 | |||
121 | FreeVTslot = 0; | ||
122 | for (i = 7; (i >= 0) && !FreeVTslot; i--) | ||
123 | if (ioctl(fd, VT_ACTIVATE, i) != 0) | ||
124 | FreeVTslot = 1; | ||
125 | 139 | ||
126 | if (!FreeVTslot || | 140 | xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); |
127 | (ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || | 141 | snprintf(fb_dev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno); |
128 | (xf86Info.vtno == -1)) | 142 | } |
129 | FatalError("xf86OpenConsole: Cannot find a free VT\n"); | ||
130 | 143 | ||
144 | if (fd != -1) { | ||
131 | close(fd); | 145 | close(fd); |
132 | } | 146 | } |
133 | 147 | ||
134 | xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); | ||
135 | |||
136 | sprintf(fb_dev, "/dev/vt%02d", xf86Info.vtno); /* Solaris 2.1 x86 */ | ||
137 | |||
138 | #endif /* HAS_USL_VTS */ | 148 | #endif /* HAS_USL_VTS */ |
139 | 149 | ||
140 | if (!KeepTty) | 150 | if (!KeepTty) |
@@ -149,26 +159,32 @@ xf86OpenConsole(void) | |||
149 | /* Change ownership of the vt */ | 159 | /* Change ownership of the vt */ |
150 | chown(fb_dev, getuid(), getgid()); | 160 | chown(fb_dev, getuid(), getgid()); |
151 | 161 | ||
152 | /* | 162 | if (vtEnabled) |
153 | * Now get the VT | 163 | { |
154 | */ | 164 | /* |
155 | if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) | 165 | * Now get the VT |
156 | xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); | 166 | */ |
167 | if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) | ||
168 | xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); | ||
169 | |||
170 | if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) | ||
171 | xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); | ||
157 | 172 | ||
158 | if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) | 173 | if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) |
159 | xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); | 174 | FatalError("xf86OpenConsole: VT_GETMODE failed\n"); |
160 | 175 | ||
161 | if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) | 176 | OsSignal(SIGUSR1, xf86VTRequest); |
162 | FatalError("xf86OpenConsole: VT_GETMODE failed\n"); | ||
163 | 177 | ||
164 | signal(SIGUSR1, xf86VTRequest); | 178 | VT.mode = VT_PROCESS; |
179 | VT.relsig = SIGUSR1; | ||
180 | VT.acqsig = SIGUSR1; | ||
165 | 181 | ||
166 | VT.mode = VT_PROCESS; | 182 | if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) |
167 | VT.relsig = SIGUSR1; | 183 | FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); |
168 | VT.acqsig = SIGUSR1; | ||
169 | 184 | ||
170 | if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0) | 185 | if (ioctl(xf86Info.consoleFd, VT_SETDISPINFO, atoi(display)) < 0) |
171 | FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n"); | 186 | xf86Msg(X_WARNING, "xf86OpenConsole: VT_SETDISPINFO failed\n"); |
187 | } | ||
172 | #endif | 188 | #endif |
173 | 189 | ||
174 | #ifdef KDSETMODE | 190 | #ifdef KDSETMODE |
@@ -183,23 +199,24 @@ xf86OpenConsole(void) | |||
183 | else /* serverGeneration != 1 */ | 199 | else /* serverGeneration != 1 */ |
184 | { | 200 | { |
185 | #ifdef HAS_USL_VTS | 201 | #ifdef HAS_USL_VTS |
186 | /* | 202 | if (vtEnabled) { |
187 | * Now re-get the VT | 203 | /* |
188 | */ | 204 | * Now re-get the VT |
189 | if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) | 205 | */ |
190 | xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); | 206 | if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) |
207 | xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); | ||
191 | 208 | ||
192 | if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) | 209 | if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) |
193 | xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); | 210 | xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); |
194 | |||
195 | /* | ||
196 | * If the server doesn't have the VT when the reset occurs, | ||
197 | * this is to make sure we don't continue until the activate | ||
198 | * signal is received. | ||
199 | */ | ||
200 | if (!xf86Screens[0]->vtSema) | ||
201 | sleep(5); | ||
202 | 211 | ||
212 | /* | ||
213 | * If the server doesn't have the VT when the reset occurs, | ||
214 | * this is to make sure we don't continue until the activate | ||
215 | * signal is received. | ||
216 | */ | ||
217 | if (!xf86Screens[0]->vtSema) | ||
218 | sleep(5); | ||
219 | } | ||
203 | #endif /* HAS_USL_VTS */ | 220 | #endif /* HAS_USL_VTS */ |
204 | 221 | ||
205 | } | 222 | } |
@@ -263,30 +280,16 @@ xf86CloseConsole(void) | |||
263 | #endif | 280 | #endif |
264 | 281 | ||
265 | #ifdef HAS_USL_VTS | 282 | #ifdef HAS_USL_VTS |
283 | if (vtEnabled == 1) { | ||
284 | if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) | ||
285 | { | ||
286 | VT.mode = VT_AUTO; /* Set default vt handling */ | ||
287 | ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); | ||
288 | } | ||
266 | 289 | ||
267 | /* | 290 | /* Activate the VT that X was started on */ |
268 | * Solaris 2.1 x86 doesn't seem to "switch" back to the console when the VT | 291 | ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86StartVT); |
269 | * is relinquished and its mode is reset to auto. Also, Solaris 2.1 seems | ||
270 | * to associate vt00 with the console so I've opened the "console" back up | ||
271 | * and made it the active vt again in text mode and then closed it. There | ||
272 | * must be a better hack for this but I'm not aware of one at this time. | ||
273 | * | ||
274 | * Doug Anson 11/6/93 | ||
275 | * danson@lgc.com | ||
276 | * | ||
277 | * Fixed - 12/5/93 - David Holland - davidh@dorite.use.com | ||
278 | * Did the whole thing similarly to the way linux does it | ||
279 | */ | ||
280 | |||
281 | if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1) | ||
282 | { | ||
283 | VT.mode = VT_AUTO; /* Set default vt handling */ | ||
284 | ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); | ||
285 | } | 292 | } |
286 | |||
287 | /* Activate the VT that X was started on */ | ||
288 | ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86StartVT); | ||
289 | |||
290 | #endif /* HAS_USL_VTS */ | 293 | #endif /* HAS_USL_VTS */ |
291 | 294 | ||
292 | close(xf86Info.consoleFd); | 295 | close(xf86Info.consoleFd); |
@@ -319,7 +322,7 @@ xf86ProcessArgument(int argc, char **argv, int i) | |||
319 | 322 | ||
320 | if ((argv[i][0] == 'v') && (argv[i][1] == 't')) | 323 | if ((argv[i][0] == 'v') && (argv[i][1] == 't')) |
321 | { | 324 | { |
322 | if (sscanf(argv[i], "vt%2d", &VTnum) == 0) | 325 | if (sscanf(argv[i], "vt%d", &VTnum) == 0) |
323 | { | 326 | { |
324 | UseMsg(); | 327 | UseMsg(); |
325 | VTnum = -1; | 328 | VTnum = -1; |
@@ -345,7 +348,7 @@ xf86ProcessArgument(int argc, char **argv, int i) | |||
345 | void xf86UseMsg() | 348 | void xf86UseMsg() |
346 | { | 349 | { |
347 | #ifdef HAS_USL_VTS | 350 | #ifdef HAS_USL_VTS |
348 | ErrorF("vtXX Use the specified VT number\n"); | 351 | ErrorF("vtX Use the specified VT number\n"); |
349 | #endif | 352 | #endif |
350 | ErrorF("-dev <fb> Framebuffer device\n"); | 353 | ErrorF("-dev <fb> Framebuffer device\n"); |
351 | ErrorF("-keeptty Don't detach controlling tty\n"); | 354 | ErrorF("-keeptty Don't detach controlling tty\n"); |
diff --git a/hw/xfree86/os-support/xf86_OSlib.h b/hw/xfree86/os-support/xf86_OSlib.h index 35e1303b9..c53fc0dac 100644 --- a/hw/xfree86/os-support/xf86_OSlib.h +++ b/hw/xfree86/os-support/xf86_OSlib.h | |||
@@ -134,7 +134,7 @@ | |||
134 | # include <sys/mmap.h> /* MMAP driver header */ | 134 | # include <sys/mmap.h> /* MMAP driver header */ |
135 | # endif | 135 | # endif |
136 | 136 | ||
137 | # if !defined(sun) | 137 | # if !defined(sun) || defined(HAVE_SYS_VT_H) |
138 | # define HAS_USL_VTS | 138 | # define HAS_USL_VTS |
139 | # endif | 139 | # endif |
140 | # if !defined(sun) | 140 | # if !defined(sun) |
@@ -149,10 +149,14 @@ | |||
149 | # define LED_NUM NLKED | 149 | # define LED_NUM NLKED |
150 | # define LED_SCR SLKED | 150 | # define LED_SCR SLKED |
151 | # elif defined(HAS_USL_VTS) | 151 | # elif defined(HAS_USL_VTS) |
152 | # include <sys/at_ansi.h> | 152 | # if !defined(sun) |
153 | # include <sys/at_ansi.h> | ||
154 | # endif | ||
153 | # include <sys/kd.h> | 155 | # include <sys/kd.h> |
154 | # include <sys/vt.h> | 156 | # include <sys/vt.h> |
155 | # elif defined(sun) | 157 | # endif |
158 | |||
159 | # if defined(sun) | ||
156 | # include <sys/fbio.h> | 160 | # include <sys/fbio.h> |
157 | # include <sys/kbd.h> | 161 | # include <sys/kbd.h> |
158 | # include <sys/kbio.h> | 162 | # include <sys/kbio.h> |
@@ -194,7 +198,6 @@ | |||
194 | 198 | ||
195 | # if defined(sun) && defined(HAS_USL_VTS) | 199 | # if defined(sun) && defined(HAS_USL_VTS) |
196 | # define USE_VT_SYSREQ | 200 | # define USE_VT_SYSREQ |
197 | # define VT_SYSREQ_DEFAULT TRUE | ||
198 | # endif | 201 | # endif |
199 | 202 | ||
200 | #endif /* (SYSV || SVR4) */ | 203 | #endif /* (SYSV || SVR4) */ |
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in index 5689f3c19..f62db1742 100644 --- a/include/xorg-config.h.in +++ b/include/xorg-config.h.in | |||
@@ -57,6 +57,9 @@ | |||
57 | /* Define to 1 if you have the <sys/kd.h> header file. */ | 57 | /* Define to 1 if you have the <sys/kd.h> header file. */ |
58 | #undef HAVE_SYS_KD_H | 58 | #undef HAVE_SYS_KD_H |
59 | 59 | ||
60 | /* Define to 1 if you have the <sys/vt.h> header file. */ | ||
61 | #undef HAVE_SYS_VT_H | ||
62 | |||
60 | /* Define to 1 if you have the `walkcontext' function (used on Solaris for | 63 | /* Define to 1 if you have the `walkcontext' function (used on Solaris for |
61 | xorg_backtrace in hw/xfree86/common/xf86Events.c */ | 64 | xorg_backtrace in hw/xfree86/common/xf86Events.c */ |
62 | #undef HAVE_WALKCONTEXT | 65 | #undef HAVE_WALKCONTEXT |