From 23e2ddeb0f81d5ee9c6d01cf0b768eeb1c27555c Mon Sep 17 00:00:00 2001 From: marha Date: Sat, 22 May 2010 13:47:02 +0000 Subject: xserver git update 22/5/2010 --- xorg-server/hw/vfb/InitInput.c | 308 ++++++++++----------- xorg-server/hw/vfb/Makefile.am | 103 ++++--- xorg-server/hw/vfb/lk201kbd.h | 158 ----------- .../hw/xfree86/os-support/solaris/sun_init.c | 102 +++++-- 4 files changed, 284 insertions(+), 387 deletions(-) delete mode 100644 xorg-server/hw/vfb/lk201kbd.h (limited to 'xorg-server/hw') diff --git a/xorg-server/hw/vfb/InitInput.c b/xorg-server/hw/vfb/InitInput.c index 10bb6a599..64040c865 100644 --- a/xorg-server/hw/vfb/InitInput.c +++ b/xorg-server/hw/vfb/InitInput.c @@ -1,155 +1,153 @@ -/* - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_DIX_CONFIG_H -#include -#endif - -#include -#include "mi.h" -#include -#include "scrnintstr.h" -#include "inputstr.h" -#include -#include "mibstore.h" -#include "mipointer.h" -#include "lk201kbd.h" -#include "xkbsrv.h" -#include -#include "xserver-properties.h" -#include "exevents.h" -#include "extinit.h" - -Bool -LegalModifier(unsigned int key, DeviceIntPtr pDev) -{ - return TRUE; -} - -void -ProcessInputEvents(void) -{ - mieqProcessInputEvents(); -} - -void DDXRingBell(int volume, int pitch, int duration) -{ -} - -#define VFB_MIN_KEY 8 -#define VFB_MAX_KEY 255 -KeySym map[MAP_LENGTH * LK201_GLYPHS_PER_KEY]; - -static int -vfbKeybdProc(DeviceIntPtr pDevice, int onoff) -{ - DevicePtr pDev = (DevicePtr)pDevice; - - switch (onoff) - { - case DEVICE_INIT: - InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL); - break; - case DEVICE_ON: - pDev->on = TRUE; - break; - case DEVICE_OFF: - pDev->on = FALSE; - break; - case DEVICE_CLOSE: - break; - } - return Success; -} - -static int -vfbMouseProc(DeviceIntPtr pDevice, int onoff) -{ -#define NBUTTONS 3 -#define NAXES 2 - - BYTE map[NBUTTONS + 1]; - DevicePtr pDev = (DevicePtr)pDevice; - Atom btn_labels[NBUTTONS] = {0}; - Atom axes_labels[NAXES] = {0}; - - switch (onoff) - { - case DEVICE_INIT: - map[1] = 1; - map[2] = 2; - map[3] = 3; - - btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); - btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); - btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); - - axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); - axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); - - InitPointerDeviceStruct(pDev, map, NBUTTONS, btn_labels, - (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), NAXES, axes_labels); - break; - - case DEVICE_ON: - pDev->on = TRUE; - break; - - case DEVICE_OFF: - pDev->on = FALSE; - break; - - case DEVICE_CLOSE: - break; - } - return Success; - -#undef NBUTTONS -#undef NAXES -} - -void -InitInput(int argc, char *argv[]) -{ - DeviceIntPtr p, k; - Atom xiclass; - p = AddInputDevice(serverClient, vfbMouseProc, TRUE); - k = AddInputDevice(serverClient, vfbKeybdProc, TRUE); - RegisterPointerDevice(p); - xiclass = MakeAtom(XI_MOUSE, sizeof(XI_MOUSE) - 1, TRUE); - AssignTypeAndName(p, xiclass, "Xvfb mouse"); - RegisterKeyboardDevice(k); - xiclass = MakeAtom(XI_KEYBOARD, sizeof(XI_KEYBOARD) - 1, TRUE); - AssignTypeAndName(k, xiclass, "Xvfb keyboard"); - (void)mieqInit(); -} - -void -CloseInput (void) -{ -} +/* + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include +#include "mi.h" +#include +#include "scrnintstr.h" +#include "inputstr.h" +#include +#include "mibstore.h" +#include "mipointer.h" +#include "xkbsrv.h" +#include +#include "xserver-properties.h" +#include "exevents.h" +#include "extinit.h" + +Bool +LegalModifier(unsigned int key, DeviceIntPtr pDev) +{ + return TRUE; +} + +void +ProcessInputEvents(void) +{ + mieqProcessInputEvents(); +} + +void DDXRingBell(int volume, int pitch, int duration) +{ +} + +#define VFB_MIN_KEY 8 +#define VFB_MAX_KEY 255 + +static int +vfbKeybdProc(DeviceIntPtr pDevice, int onoff) +{ + DevicePtr pDev = (DevicePtr)pDevice; + + switch (onoff) + { + case DEVICE_INIT: + InitKeyboardDeviceStruct(pDevice, NULL, NULL, NULL); + break; + case DEVICE_ON: + pDev->on = TRUE; + break; + case DEVICE_OFF: + pDev->on = FALSE; + break; + case DEVICE_CLOSE: + break; + } + return Success; +} + +static int +vfbMouseProc(DeviceIntPtr pDevice, int onoff) +{ +#define NBUTTONS 3 +#define NAXES 2 + + BYTE map[NBUTTONS + 1]; + DevicePtr pDev = (DevicePtr)pDevice; + Atom btn_labels[NBUTTONS] = {0}; + Atom axes_labels[NAXES] = {0}; + + switch (onoff) + { + case DEVICE_INIT: + map[1] = 1; + map[2] = 2; + map[3] = 3; + + btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); + btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); + btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); + + axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); + axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); + + InitPointerDeviceStruct(pDev, map, NBUTTONS, btn_labels, + (PtrCtrlProcPtr)NoopDDA, GetMotionHistorySize(), NAXES, axes_labels); + break; + + case DEVICE_ON: + pDev->on = TRUE; + break; + + case DEVICE_OFF: + pDev->on = FALSE; + break; + + case DEVICE_CLOSE: + break; + } + return Success; + +#undef NBUTTONS +#undef NAXES +} + +void +InitInput(int argc, char *argv[]) +{ + DeviceIntPtr p, k; + Atom xiclass; + p = AddInputDevice(serverClient, vfbMouseProc, TRUE); + k = AddInputDevice(serverClient, vfbKeybdProc, TRUE); + RegisterPointerDevice(p); + xiclass = MakeAtom(XI_MOUSE, sizeof(XI_MOUSE) - 1, TRUE); + AssignTypeAndName(p, xiclass, "Xvfb mouse"); + RegisterKeyboardDevice(k); + xiclass = MakeAtom(XI_KEYBOARD, sizeof(XI_KEYBOARD) - 1, TRUE); + AssignTypeAndName(k, xiclass, "Xvfb keyboard"); + (void)mieqInit(); +} + +void +CloseInput (void) +{ +} diff --git a/xorg-server/hw/vfb/Makefile.am b/xorg-server/hw/vfb/Makefile.am index 4ac0c8f89..f7a8c24af 100644 --- a/xorg-server/hw/vfb/Makefile.am +++ b/xorg-server/hw/vfb/Makefile.am @@ -1,52 +1,51 @@ -bin_PROGRAMS = Xvfb -noinst_LIBRARIES = libfbcmap.a - -AM_CFLAGS = -DHAVE_DIX_CONFIG_H \ - -DNO_HW_ONLY_EXTS \ - -DNO_MODULE_EXTS \ - $(XVFBMODULES_CFLAGS) \ - $(DIX_CFLAGS) - -SRCS = InitInput.c \ - InitOutput.c \ - lk201kbd.h \ - $(top_srcdir)/Xext/dpmsstubs.c \ - $(top_srcdir)/Xi/stubs.c \ - $(top_srcdir)/mi/miinitext.c - -libfbcmap_a_CFLAGS = $(AM_CFLAGS) -libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c - -Xvfb_SOURCES = $(SRCS) - -XVFB_LIBS = \ - @XVFB_LIBS@ \ - libfbcmap.a \ - $(MAIN_LIB) \ - $(XSERVER_LIBS) - -Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS) -Xvfb_DEPENDENCIES = $(XVFB_LIBS) -Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) - -# Man page -include $(top_srcdir)/cpprules.in - -appmandir = $(APP_MAN_DIR) - -appman_PRE = Xvfb.man -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -BUILT_SOURCES = $(appman_PRE) -CLEANFILES = $(appman_PRE) $(appman_DATA) - -SUFFIXES += .$(APP_MAN_SUFFIX) .man - -.man.$(APP_MAN_SUFFIX): - -$(AM_V_at)rm -f $@ - $(AM_V_at)$(LN_S) $< $@ - -EXTRA_DIST = Xvfb.man.pre - -relink: - $(AM_V_at)rm -f Xvfb$(EXEEXT) && $(MAKE) Xvfb$(EXEEXT) +bin_PROGRAMS = Xvfb +noinst_LIBRARIES = libfbcmap.a + +AM_CFLAGS = -DHAVE_DIX_CONFIG_H \ + -DNO_HW_ONLY_EXTS \ + -DNO_MODULE_EXTS \ + $(XVFBMODULES_CFLAGS) \ + $(DIX_CFLAGS) + +SRCS = InitInput.c \ + InitOutput.c \ + $(top_srcdir)/Xext/dpmsstubs.c \ + $(top_srcdir)/Xi/stubs.c \ + $(top_srcdir)/mi/miinitext.c + +libfbcmap_a_CFLAGS = $(AM_CFLAGS) +libfbcmap_a_SOURCES = $(top_srcdir)/fb/fbcmap_mi.c + +Xvfb_SOURCES = $(SRCS) + +XVFB_LIBS = \ + @XVFB_LIBS@ \ + libfbcmap.a \ + $(MAIN_LIB) \ + $(XSERVER_LIBS) + +Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS) +Xvfb_DEPENDENCIES = $(XVFB_LIBS) +Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) + +# Man page +include $(top_srcdir)/cpprules.in + +appmandir = $(APP_MAN_DIR) + +appman_PRE = Xvfb.man +appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) + +BUILT_SOURCES = $(appman_PRE) +CLEANFILES = $(appman_PRE) $(appman_DATA) + +SUFFIXES += .$(APP_MAN_SUFFIX) .man + +.man.$(APP_MAN_SUFFIX): + -$(AM_V_at)rm -f $@ + $(AM_V_at)$(LN_S) $< $@ + +EXTRA_DIST = Xvfb.man.pre + +relink: + $(AM_V_at)rm -f Xvfb$(EXEEXT) && $(MAKE) Xvfb$(EXEEXT) diff --git a/xorg-server/hw/vfb/lk201kbd.h b/xorg-server/hw/vfb/lk201kbd.h deleted file mode 100644 index d0198d06b..000000000 --- a/xorg-server/hw/vfb/lk201kbd.h +++ /dev/null @@ -1,158 +0,0 @@ -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -******************************************************************/ - - -#define MIN_LK201_KEY 86 -#define MAX_LK201_KEY 251 -#define LK201_GLYPHS_PER_KEY 2 - -#define KEY_F1 86 -#define KEY_F2 87 -#define KEY_F3 88 -#define KEY_F4 89 -#define KEY_F5 90 -#define KEY_F6 100 -#define KEY_F7 101 -#define KEY_F8 102 -#define KEY_F9 103 -#define KEY_F10 104 -#define KEY_F11 113 -#define KEY_F12 114 -#define KEY_F13 115 -#define KEY_F14 116 -#define KEY_HELP 124 -#define KEY_MENU 125 -#define KEY_F17 128 -#define KEY_F18 129 -#define KEY_F19 130 -#define KEY_F20 131 -#define KEY_FIND 138 -#define KEY_INSERT_HERE 139 -#define KEY_REMOVE 140 -#define KEY_SELECT 141 -#define KEY_PREV_SCREEN 142 -#define KEY_NEXT_SCREEN 143 -#define KEY_KP_0 146 /* key pad */ -#define KEY_KP_PERIOD 148 /* key pad */ -#define KEY_KP_ENTER 149 /* key pad */ -#define KEY_KP_1 150 /* key pad */ -#define KEY_KP_2 151 /* key pad */ -#define KEY_KP_3 152 /* key pad */ -#define KEY_KP_4 153 /* key pad */ -#define KEY_KP_5 154 /* key pad */ -#define KEY_KP_6 155 /* key pad */ -#define KEY_KP_COMMA 156 /* key pad */ -#define KEY_KP_7 157 /* key pad */ -#define KEY_KP_8 158 /* key pad */ -#define KEY_KP_9 159 /* key pad */ -#define KEY_KP_HYPHEN 160 -#define KEY_KP_PF1 161 -#define KEY_KP_PF2 162 -#define KEY_KP_PF3 163 -#define KEY_KP_PF4 164 -#define KEY_LEFT 167 -#define KEY_RIGHT 168 -#define KEY_DOWN 169 -#define KEY_UP 170 -#define KEY_SHIFT 174 -#define KEY_CTRL 175 -#define KEY_LOCK 176 -#define KEY_COMPOSE 177 -#define KEY_APPLE 177 -#define KEY_META 177 -#define KEY_DELETE 188 -#define KEY_RETURN 189 -#define KEY_TAB 190 -#define KEY_TILDE 191 -#define KEY_TR_1 192 /* Top Row */ -#define KEY_Q 193 -#define KEY_A 194 -#define KEY_Z 195 -#define KEY_TR_2 197 -#define KEY_W 198 -#define KEY_S 199 -#define KEY_X 200 -#define KEY_LANGLE_RANGLE 201 /* xxx */ -#define KEY_TR_3 203 -#define KEY_E 204 -#define KEY_D 205 -#define KEY_C 206 -#define KEY_TR_4 208 -#define KEY_R 209 -#define KEY_F 210 -#define KEY_V 211 -#define KEY_SPACE 212 -#define KEY_TR_5 214 -#define KEY_T 215 -#define KEY_G 216 -#define KEY_B 217 -#define KEY_TR_6 219 -#define KEY_Y 220 -#define KEY_H 221 -#define KEY_N 222 -#define KEY_TR_7 224 -#define KEY_U 225 -#define KEY_J 226 -#define KEY_M 227 -#define KEY_TR_8 229 -#define KEY_I 230 -#define KEY_K 231 -#define KEY_COMMA 232 /* xxx */ -#define KEY_TR_9 234 -#define KEY_O 235 -#define KEY_L 236 -#define KEY_PERIOD 237 /* xxx */ -#define KEY_TR_0 239 -#define KEY_P 240 -#define KEY_SEMICOLON 242 /* xxx */ -#define KEY_QMARK 243 -#define KEY_PLUS 245 /* xxx */ -#define KEY_RBRACE 246 -#define KEY_VBAR 247 /* xxx */ -#define KEY_UBAR 249 /* xxx */ -#define KEY_LBRACE 250 -#define KEY_QUOTE 251 diff --git a/xorg-server/hw/xfree86/os-support/solaris/sun_init.c b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c index 82df2e9dd..4716da93e 100644 --- a/xorg-server/hw/xfree86/os-support/solaris/sun_init.c +++ b/xorg-server/hw/xfree86/os-support/solaris/sun_init.c @@ -33,8 +33,21 @@ # include #endif +/* + * Applications see VT number as consecutive integers starting from 1. + * VT number VT device + * ------------------------------------------------------- + * 1 : /dev/vt/0 (Alt + Ctrl + F1) + * 2 : /dev/vt/2 (Alt + Ctrl + F2) + * 3 : /dev/vt/3 (Alt + Ctrl + F3) + * ... ... + */ +#define CONSOLE_VTNO 1 +#define SOL_CONSOLE_DEV "/dev/console" + static Bool KeepTty = FALSE; static Bool Protect0 = FALSE; +static Bool UseConsole = FALSE; #ifdef HAS_USL_VTS static int VTnum = -1; static int xf86StartVT = -1; @@ -112,8 +125,30 @@ xf86OpenConsole(void) vtEnabled = 0; } } +#endif /* HAS_USL_VTS */ + if (UseConsole) + { + strlcpy(consoleDev, SOL_CONSOLE_DEV, sizeof(consoleDev)); + +#ifdef HAS_USL_VTS + xf86Info.vtno = CONSOLE_VTNO; + if (vtEnabled == 0) + { + xf86StartVT = 0; + } + else + { + if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) + FatalError("xf86OpenConsole: Cannot determine current VT\n"); + xf86StartVT = vtinfo.v_active; + } +#endif /* HAS_USL_VTS */ + goto OPENCONSOLE; + } + +#ifdef HAS_USL_VTS if (vtEnabled == 0) { /* VT not enabled - kernel too old or Sparc platforms @@ -123,32 +158,31 @@ xf86OpenConsole(void) xf86StartVT = 0; xf86Info.vtno = 0; strlcpy(consoleDev, xf86SolarisFbDev, sizeof(consoleDev)); + goto OPENCONSOLE; } - else - { - if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) - FatalError("xf86OpenConsole: Cannot determine current VT\n"); - xf86StartVT = vtinfo.v_active; + if (ioctl(fd, VT_GETSTATE, &vtinfo) < 0) + FatalError("xf86OpenConsole: Cannot determine current VT\n"); - if (VTnum != -1) - { - xf86Info.vtno = VTnum; - from = X_CMDLINE; - } - else + xf86StartVT = vtinfo.v_active; + + if (VTnum != -1) + { + xf86Info.vtno = VTnum; + from = X_CMDLINE; + } + else + { + if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || + (xf86Info.vtno == -1)) { - if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) || - (xf86Info.vtno == -1)) - { - FatalError("xf86OpenConsole: Cannot find a free VT\n"); - } + FatalError("xf86OpenConsole: Cannot find a free VT\n"); } - - xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); - snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno); } + xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno); + snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno); + if (fd != -1) { close(fd); @@ -156,6 +190,7 @@ xf86OpenConsole(void) #endif /* HAS_USL_VTS */ +OPENCONSOLE: if (!KeepTty) setpgrp(); @@ -163,11 +198,10 @@ xf86OpenConsole(void) FatalError("xf86OpenConsole: Cannot open %s (%s)\n", consoleDev, strerror(errno)); -#ifdef HAS_USL_VTS - - /* Change ownership of the vt */ + /* Change ownership of the vt or console */ chown(consoleDev, getuid(), getgid()); +#ifdef HAS_USL_VTS if (vtEnabled) { /* @@ -179,6 +213,13 @@ xf86OpenConsole(void) if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); +#ifdef VT_SET_CONSUSER /* added in snv_139 */ + if (strcmp(display, "0") == 0) + if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0) + xf86Msg(X_WARNING, + "xf86OpenConsole: VT_SET_CONSUSER failed\n"); +#endif + if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) FatalError("xf86OpenConsole: VT_GETMODE failed\n"); @@ -220,6 +261,13 @@ xf86OpenConsole(void) if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) != 0) xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n"); +#ifdef VT_SET_CONSUSER /* added in snv_139 */ + if (strcmp(display, "0") == 0) + if (ioctl(xf86Info.consoleFd, VT_SET_CONSUSER) != 0) + xf86Msg(X_WARNING, + "xf86OpenConsole: VT_SET_CONSUSER failed\n"); +#endif + /* * If the server doesn't have the VT when the reset occurs, * this is to make sure we don't continue until the activate @@ -330,6 +378,15 @@ xf86ProcessArgument(int argc, char **argv, int i) return 1; } + /* + * Use /dev/console as the console device. + */ + if (!strcmp(argv[i], "-C")) + { + UseConsole = TRUE; + return 1; + } + #ifdef HAS_USL_VTS if ((argv[i][0] == 'v') && (argv[i][1] == 't')) @@ -364,4 +421,5 @@ void xf86UseMsg() ErrorF("-dev Framebuffer device\n"); ErrorF("-keeptty Don't detach controlling tty\n"); ErrorF(" (for debugging only)\n"); + ErrorF("-C Use /dev/console as the console device\n"); } -- cgit v1.2.3