xfree86: remove Xqueue support completely

This commit is contained in:
Daniel Stone 2006-08-12 20:39:08 +03:00 committed by Daniel Stone
parent 26c3cd1c9e
commit 59dcc62906
26 changed files with 10 additions and 1902 deletions

View File

@ -76,7 +76,7 @@ Bool foundMouse = FALSE;
#elif defined(__SCO__)
static char *DFLT_MOUSE_PROTO = "OSMouse";
#elif defined(__UNIXWARE__)
static char *DFLT_MOUSE_PROTO = "Xqueue";
static char *DFLT_MOUSE_PROTO = "OSMouse";
static char *DFLT_MOUSE_DEV = "/dev/mouse";
#elif defined(QNX4)
static char *DFLT_MOUSE_PROTO = "OSMouse";

View File

@ -142,9 +142,6 @@ Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
extern fd_set EnabledDevices;
#if defined(XQUEUE)
extern void xf86XqueRequest(void);
#endif
#ifdef XF86PM
extern void (*xf86OSPMClose)(void);
#endif

View File

@ -2576,7 +2576,7 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
/*
* XXX quick hack to report correctly for OSs that can't do SilkenMouse
* yet. Should handle this differently so that alternate async methods
* like Xqueue work correctly with this too.
* work correctly with this too.
*/
pScrn->silkenMouse = useSM && xf86SIGIOSupported();
if (serverGeneration == 1)

View File

@ -433,15 +433,13 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
if (!xf86MouseProtocolIDToName)
return MISC_RET_NOMODULE;
if (mse->type < MTYPE_MICROSOFT
|| ( mse->type > MTYPE_EXPPS2
&& (mse->type!=MTYPE_OSMOUSE && mse->type!=MTYPE_XQUEUE)))
|| (mse->type > MTYPE_EXPPS2
&& (mse->type != MTYPE_OSMOUSE)))
return MISC_RET_BADMSEPROTO;
#ifdef OSMOUSE_ONLY
if (mse->type != MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#else
if (mse->type == MTYPE_XQUEUE)
return MISC_RET_BADMSEPROTO;
if (mse->type == MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#endif /* OSMOUSE_ONLY */
@ -462,7 +460,6 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
mse->flags &= ~MF_REOPEN;
}
if (mse->type != MTYPE_OSMOUSE
&& mse->type != MTYPE_XQUEUE
&& mse->type != MTYPE_PS_2
&& mse->type != MTYPE_BUSMOUSE
&& mse->type != MTYPE_IMPS2
@ -483,7 +480,6 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
return MISC_RET_BADFLAGS;
if (mse->type != MTYPE_OSMOUSE
&& mse->type != MTYPE_XQUEUE
&& mse->type != MTYPE_BUSMOUSE)
{
if (mse->samplerate < 0)

View File

@ -62,7 +62,6 @@ libbsd_la_SOURCES = \
$(srcdir)/../shared/vidmem.c \
bsd_VTsw.c \
bsd_init.c \
bsd_io.c \
bsd_mouse.c \
$(ARCH_SOURCES) \
$(AGP_SOURCES) \

View File

@ -1,293 +0,0 @@
/*
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
* Copyright 1993 by David Dawes <dawes@xfree86.org>
*
* 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, and that the names of Rich Murphey and David Dawes
* not be used in advertising or publicity pertaining to distribution of
* the software without specific, written prior permission. Rich Murphey and
* David Dawes make no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* RICH MURPHEY AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL RICH MURPHEY OR DAVID DAWES 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.
*
*/
/* $XConsortium: bsd_io.c /main/11 1996/10/19 18:06:07 kaleb $ */
#define NEED_EVENTS
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <termios.h>
#include "compiler.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#ifdef WSCONS_SUPPORT
#define KBD_FD(i) ((i).kbdFd != -1 ? (i).kbdFd : (i).consoleFd)
#endif
_X_EXPORT void
xf86SoundKbdBell(int loudness, int pitch, int duration)
{
#ifdef WSCONS_SUPPORT
struct wskbd_bell_data wsb;
#endif
if (loudness && pitch)
{
#ifdef PCCONS_SUPPORT
int data[2];
#endif
switch (xf86Info.consType) {
#ifdef PCCONS_SUPPORT
case PCCONS:
data[0] = pitch;
data[1] = (duration * loudness) / 50;
ioctl(xf86Info.consoleFd, CONSOLE_X_BELL, data);
break;
#endif
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
ioctl(xf86Info.consoleFd, KDMKTONE,
((1193190 / pitch) & 0xffff) |
(((unsigned long)duration*loudness/50)<<16));
break;
#endif
#if defined (WSCONS_SUPPORT)
case WSCONS:
wsb.which = WSKBD_BELL_DOALL;
wsb.pitch = pitch;
wsb.period = duration;
wsb.volume = loudness;
ioctl(KBD_FD(xf86Info), WSKBDIO_COMPLEXBELL,
&wsb);
break;
#endif
}
}
}
void
xf86SetKbdLeds(int leds)
{
switch (xf86Info.consType) {
case PCCONS:
break;
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
ioctl(xf86Info.consoleFd, KDSETLED, leds);
break;
#endif
#if defined(WSCONS_SUPPORT)
case WSCONS:
ioctl(KBD_FD(xf86Info), WSKBDIO_SETLEDS, &leds);
break;
#endif
}
}
int
xf86GetKbdLeds()
{
int leds = 0;
switch (xf86Info.consType) {
case PCCONS:
break;
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
ioctl(xf86Info.consoleFd, KDGETLED, &leds);
break;
#endif
#if defined(WSCONS_SUPPORT)
case WSCONS:
ioctl(KBD_FD(xf86Info), WSKBDIO_GETLEDS, &leds);
break;
#endif
}
return(leds);
}
void
xf86SetKbdRepeat(char rad)
{
switch (xf86Info.consType) {
case PCCONS:
break;
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
ioctl(xf86Info.consoleFd, KDSETRAD, rad);
break;
#endif
}
}
#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
static struct termios kbdtty;
#endif
void
xf86KbdInit()
{
switch (xf86Info.consType) {
#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case PCCONS:
case SYSCONS:
case PCVT:
tcgetattr(xf86Info.consoleFd, &kbdtty);
break;
#endif
#if defined WSCONS_SUPPORT
case WSCONS:
if (xf86Info.kbdFd != -1)
xf86FlushInput(xf86Info.kbdFd);
else
tcgetattr(xf86Info.consoleFd, &kbdtty);
break;
#endif
}
}
int
xf86KbdOn()
{
struct termios nTty;
#ifdef WSCONS_SUPPORT
int option;
#endif
switch (xf86Info.consType) {
#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
case SYSCONS:
case PCCONS:
case PCVT:
nTty = kbdtty;
nTty.c_iflag = IGNPAR | IGNBRK;
nTty.c_oflag = 0;
nTty.c_cflag = CREAD | CS8;
nTty.c_lflag = 0;
nTty.c_cc[VTIME] = 0;
nTty.c_cc[VMIN] = 1;
cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600);
tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW);
#endif
break;
#endif
#ifdef WSCONS_SUPPORT
case WSCONS:
if (xf86Info.kbdFd == -1) {
nTty = kbdtty;
nTty.c_iflag = IGNPAR | IGNBRK;
nTty.c_oflag = 0;
nTty.c_cflag = CREAD | CS8;
nTty.c_lflag = 0;
nTty.c_cc[VTIME] = 0;
nTty.c_cc[VMIN] = 1;
cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600);
tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty);
option = WSKBD_RAW;
if (ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE,
&option) == -1)
FatalError("can't switch keyboard to raw mode. "
"Enable support for it in the kernel\n"
"or use for example:\n\n"
"Option \"Protocol\" \"wskbd\"\n"
"Option \"Device\" \"/dev/wskbd0\"\n"
"\nin your XF86Config(5) file\n");
} else {
return xf86Info.kbdFd;
}
#endif
}
return(xf86Info.consoleFd);
}
int
xf86KbdOff()
{
#ifdef WSCONS_SUPPORT
int option;
#endif
switch (xf86Info.consType) {
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
case SYSCONS:
case PCVT:
ioctl(xf86Info.consoleFd, KDSKBMODE, K_XLATE);
/* FALL THROUGH */
#endif
#if defined(SYSCONS_SUPPORT) || defined(PCCONS_SUPPORT) || defined(PCVT_SUPPORT)
case PCCONS:
tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
break;
#endif
#ifdef WSCONS_SUPPORT
case WSCONS:
if (xf86Info.kbdFd != -1) {
return xf86Info.kbdFd;
} else {
option = WSKBD_TRANSLATED;
ioctl(xf86Info.consoleFd, WSKBDIO_SETMODE, &option);
tcsetattr(xf86Info.consoleFd, TCSANOW, &kbdtty);
}
break;
#endif
}
return(xf86Info.consoleFd);
}
#ifdef WSCONS_SUPPORT
#define NUMEVENTS 64
void
xf86WSKbdEvents(void)
{
static struct wscons_event events[NUMEVENTS];
int n, i;
n = read(xf86Info.kbdFd, events, sizeof events);
if (n <= 0)
return;
n /= sizeof(struct wscons_event);
for (i = 0; i < n; i++)
xf86PostWSKbdEvent(&events[i]);
}
#endif /* WSCONS_SUPPORT */

View File

@ -1,4 +0,0 @@
extern void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms,
CARD8 *pModMap);

View File

@ -1,8 +1,6 @@
EXTRA_DIST = \
VTsw_sco.c \
sco_KbdMap.c \
sco_init.c \
sco_io.c \
sco_iop.c \
sco_mouse.c \
sco_video.c

View File

@ -1,268 +0,0 @@
/*
* Copyright 2001 by J. Kean Johnston <jkj@sco.com>
*
* 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, and that the name J. Kean Johnston not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. J. Kean Johnston makes no
* representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL J. KEAN JOHNSTON 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.
*/
/* $XConsortium$ */
/* Re-written May 2001 to represent the current state of reality */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "compiler.h"
#define _NEED_SYSI86
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86OSpriv.h"
#include "xf86_OSlib.h"
#include <sys/param.h>
#include <sys/emap.h>
#include <sys/nmap.h>
_X_EXPORT void
xf86SoundKbdBell(int loudness, int pitch, int duration)
{
if (loudness && pitch) {
ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
usleep(duration * loudness * 20);
ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
}
}
void
xf86SetKbdLeds(int leds)
{
/*
* sleep the first time through under SCO. There appears to be a
* timing problem in the driver which causes the keyboard to be lost.
* This usleep stops it from occurring. NOTE: this was in the old code.
* I am not convinced it is true any longer, but it doesn't hurt to
* leave this in here.
*/
static int once = 1;
if (once) {
usleep(100);
once = 0;
}
ioctl(xf86Info.consoleFd, KDSETLED, leds );
}
int
xf86GetKbdLeds(void)
{
int leds;
ioctl (xf86Info.consoleFd, KDGETLED, &leds);
return leds;
}
/*
* Much of the code in this function is duplicated from the Linux code
* by Orest Zborowski <obz@Kodak.com> and David Dawes <dawes@xfree86.org>.
* Please see the file ../linux/lnx_io.c for full copyright information.
*
* NOTE: Only OpenServer Release 5.0.6 with Release Supplement 5.0.6A
* and later have the required ioctl. 5.0.6A or higher is HIGHLY
* recommended. The console driver is quite a different beast on that OS.
*/
void
xf86SetKbdRepeat(char rad)
{
#if defined(KBIO_SETRATE)
int i;
int value = 0x7f; /* Maximum delay with slowest rate */
int delay = 250; /* Default delay */
int rate = 300; /* Default repeat rate */
static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
133, 120, 109, 100, 92, 86, 80, 75, 67,
60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
25, 23, 21, 20 };
#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
static int valid_delays[] = { 250, 500, 750, 1000 };
#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
if (xf86Info.kbdRate >= 0)
rate = xf86Info.kbdRate * 10;
if (xf86Info.kbdDelay >= 0)
delay = xf86Info.kbdDelay;
for (i = 0; i < RATE_COUNT; i++)
if (rate >= valid_rates[i]) {
value &= 0x60;
value |= i;
break;
}
for (i = 0; i < DELAY_COUNT; i++)
if (delay <= valid_delays[i]) {
value &= 0x1f;
value |= i << 5;
break;
}
ioctl (xf86Info.consoleFd, KBIO_SETRATE, value);
#endif /* defined(KBIO_SETRATE) */
}
static Bool use_tcs = TRUE, use_kd = TRUE;
static Bool no_nmap = TRUE, no_emap = TRUE;
static int orig_getsc, orig_kbm;
static struct termios orig_termios;
static keymap_t keymap, noledmap;
static uchar_t *sc_mapbuf;
static uchar_t *sc_mapbuf2;
void
xf86KbdInit(void)
{
orig_getsc = 0;
if (ioctl (xf86Info.consoleFd, TCGETSC, &orig_getsc) < 0)
use_tcs = FALSE;
if (ioctl (xf86Info.consoleFd, KDGKBMODE, &orig_kbm) < 0)
use_kd = FALSE;
if (!use_tcs && !use_kd)
FatalError ("xf86KbdInit: Could not determine keyboard mode\n");
/*
* One day this should be fixed to translate normal ASCII characters
* back into scancodes or into events that XFree86 wants, but not
* now. For the time being, we only support scancode mode screens.
*/
if (use_tcs && !(orig_getsc & KB_ISSCANCODE))
FatalError ("xf86KbdInit: Keyboard can not send scancodes\n");
/*
* We need to get the original keyboard map and NUL out the lock
* modifiers. This prevents the scancode API from messing with
* the keyboard LED's. We restore the original map when we exit.
*/
if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &keymap) < 0) {
FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
strerror(errno));
}
if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &noledmap) < 0) {
FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
strerror(errno));
} else {
int i, j;
for (i = 0; i < noledmap.n_keys; i++) {
for (j = 0; j < NUM_STATES; j++) {
if (IS_SPECIAL(noledmap, i, j) &&
((noledmap.key[i].map[j] == K_CLK) ||
(noledmap.key[i].map[j] == K_NLK) ||
(noledmap.key[i].map[j] == K_SLK))) {
noledmap.key[i].map[j] = K_NOP;
}
}
}
}
if (ioctl (xf86Info.consoleFd, XCGETA, &orig_termios) < 0) {
FatalError ("xf86KbdInit: Failed to get terminal modes (%s)\n",
strerror(errno));
}
sc_mapbuf = xalloc (10*BSIZE);
sc_mapbuf2 = xalloc(10*BSIZE);
/* Get the emap */
if (ioctl (xf86Info.consoleFd, LDGMAP, sc_mapbuf) < 0) {
if (errno != ENAVAIL) {
FatalError ("xf86KbdInit: Failed to retrieve e-map (%s)\n",
strerror (errno));
}
no_emap = FALSE;
}
/* Get the nmap */
if (ioctl (xf86Info.consoleFd, NMGMAP, sc_mapbuf2) < 0) {
if (errno != ENAVAIL) {
FatalError ("xf86KbdInit: Failed to retrieve n-map (%s)\n",
strerror (errno));
}
no_nmap = FALSE;
}
}
int
xf86KbdOn(void)
{
struct termios newtio;
ioctl (xf86Info.consoleFd, LDNMAP); /* Turn e-mapping off */
ioctl (xf86Info.consoleFd, NMNMAP); /* Turn n-mapping off */
newtio = orig_termios; /* structure copy */
newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
newtio.c_oflag = 0;
newtio.c_cflag = CREAD | CS8 | B9600;
newtio.c_lflag = 0;
newtio.c_cc[VTIME]=0;
newtio.c_cc[VMIN]=1;
cfsetispeed(&newtio, 9600);
cfsetospeed(&newtio, 9600);
ioctl(xf86Info.consoleFd, XCSETA, &newtio);
/* Now tell the keyboard driver to send us raw scancodes */
if (use_tcs) {
int nm = orig_getsc;
nm &= ~KB_XSCANCODE;
ioctl (xf86Info.consoleFd, TCSETSC, &nm);
}
if (use_kd)
ioctl (xf86Info.consoleFd, KDSKBMODE, K_RAW);
ioctl (xf86Info.consoleFd, PIO_KEYMAP, &noledmap);
return(xf86Info.consoleFd);
}
int
xf86KbdOff(void)
{
/* Revert back to original translate scancode mode */
if (use_tcs)
ioctl (xf86Info.consoleFd, TCSETSC, &orig_getsc);
if (use_kd)
ioctl (xf86Info.consoleFd, KDSKBMODE, orig_kbm);
ioctl (xf86Info.consoleFd, PIO_KEYMAP, &keymap);
if (no_emap)
ioctl (xf86Info.consoleFd, LDSMAP, sc_mapbuf);
if (no_nmap)
ioctl (xf86Info.consoleFd, NMSMAP, sc_mapbuf2);
ioctl(xf86Info.consoleFd, XCSETA, &orig_termios);
return(xf86Info.consoleFd);
}

View File

@ -1,8 +1,6 @@
if SOLARIS_USL_CONSOLE
IO_SRC = $(srcdir)/../sysv/sysv_io.c
VTSW_SRC = $(srcdir)/../shared/VTsw_usl.c
else
IO_SRC = sun_io.c
VTSW_SRC = $(srcdir)/../shared/VTsw_noop.c
endif
@ -20,7 +18,7 @@ solaris-$(SOLARIS_INOUT_ARCH).il: solaris-${SOLARIS_INOUT_ARCH}.S
$(CPP) -P -DINLINE_ASM solaris-${SOLARIS_INOUT_ARCH}.S > $@
noinst_LTLIBRARIES = libsolaris.la
libsolaris_la_SOURCES = sun_bios.c sun_init.c $(IO_SRC) \
libsolaris_la_SOURCES = sun_bios.c sun_init.c \
sun_mouse.c sun_vid.c $(AGP_SRC) \
$(srcdir)/../shared/libc_wrapper.c \
$(srcdir)/../shared/kmod_noop.c $(srcdir)/../shared/pm_noop.c \

View File

@ -1,159 +0,0 @@
/* $XdotOrg: $ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Dawes <dawes@xfree86.org>
*
* 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, and that the names of Thomas Roell and David Dawes
* not be used in advertising or publicity pertaining to distribution of
* the software without specific, written prior permission. Thomas Roell and
* David Dawes makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* THOMAS ROELL AND DAVID DAWES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL THOMAS ROELL OR DAVID DAWES 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.
*
*/
/* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons
* to whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* 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
* OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale, use
* or other dealings in this Software without prior written authorization
* of the copyright holder.
*/
/* Solaris support routines for builtin "keyboard" driver */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "sun_kbd.h"
static sunKbdPrivRec sunKeyboardPriv;
_X_HIDDEN void
xf86KbdInit(void)
{
const char *kbdName = "keyboard";
pointer *kbdOptions = NULL;
IDevPtr pDev;
/* There should be a better way to find the keyboard device name, but
this seems to work for now. */
for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
if (!xf86NameCmp(pDev->driver, "keyboard")) {
kbdName = pDev->identifier;
kbdOptions = pDev->commonOptions;
break;
}
}
if (xf86Info.kbdFd < 0) {
xf86Info.kbdFd = sunKbdOpen(kbdName, kbdOptions);
if (xf86Info.kbdFd < 0) {
FatalError("Unable to open keyboard: /dev/kbd\n");
}
}
memset(&sunKeyboardPriv, 0, sizeof(sunKbdPrivRec));
if (sunKbdInit(&sunKeyboardPriv, xf86Info.kbdFd,
kbdName, kbdOptions) != Success) {
FatalError("Unable to initialize keyboard driver\n");
}
}
_X_HIDDEN int
xf86KbdOn(void)
{
if (sunKbdOn(&sunKeyboardPriv) != Success) {
FatalError("Enabling keyboard");
}
return xf86Info.kbdFd;
}
_X_HIDDEN int
xf86KbdOff(void)
{
if (sunKbdOff(&sunKeyboardPriv) != Success) {
FatalError("Disabling keyboard");
}
return xf86Info.kbdFd;
}
_X_EXPORT void
xf86SoundKbdBell(int loudness, int pitch, int duration)
{
sunKbdSoundBell(&sunKeyboardPriv, loudness, pitch, duration);
}
_X_HIDDEN void
xf86SetKbdLeds(int leds)
{
sunKbdSetLeds(&sunKeyboardPriv, leds);
}
_X_HIDDEN int
xf86GetKbdLeds(void)
{
return sunKbdGetLeds(&sunKeyboardPriv);
}
_X_HIDDEN void
xf86SetKbdRepeat(char rad)
{
sunKbdSetRepeat(&sunKeyboardPriv, rad);
}
/*
* Lets try reading more than one keyboard event at a time in the hopes that
* this will be slightly more efficient. Or we could just try the MicroSoft
* method, and forget about efficiency. :-)
*/
_X_HIDDEN void
xf86KbdEvents(void)
{
Firm_event event[64];
int nBytes, i;
/* I certainly hope its not possible to read partial events */
if ((nBytes = read(xf86Info.kbdFd, (char *)event, sizeof(event))) > 0)
{
for (i = 0; i < (nBytes / sizeof(Firm_event)); i++)
sunPostKbdEvent(sunKeyboardPriv.ktype, &event[i]);
}
}

View File

@ -1 +1 @@
EXTRA_DIST = sysv_init.c sysv_io.c sysv_mouse.c sysv_video.c xqueue.c xqueue.h
EXTRA_DIST = sysv_init.c sysv_io.c sysv_mouse.c sysv_video.c

View File

@ -11,7 +11,6 @@
#include "xf86.h"
#include "xf86Xinput.h"
#include "xf86OSmouse.h"
#include "xqueue.h"
static int
SupportedInterfaces(void)
@ -22,7 +21,6 @@ SupportedInterfaces(void)
#ifndef ISC
static const char *internalNames[] = {
"Xqueue",
NULL
};
@ -56,7 +54,6 @@ xf86OSMouseInit(int flags)
#ifndef ISC
p->BuiltinNames = BuiltinNames;
p->CheckProtocol = CheckProtocol;
p->PreInit = XqueueMousePreInit;
#endif
return p;
}

View File

@ -1,536 +0,0 @@
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993-1999 by The XFree86 Project, Inc.
*
* 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, and that the name of the copyright holders not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The copyright holders make no
* representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS 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.
*
*/
/* $XConsortium: xqueue.c /main/8 1996/10/19 18:08:11 kaleb $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "compiler.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "xf86Xinput.h"
#include "xf86OSmouse.h"
#include "xqueue.h"
#ifdef XQUEUE
static xqEventQueue *XqueQaddr;
static int xqueFd = -1;
#ifndef XQUEUE_ASYNC
static int xquePipe[2];
#endif
#ifdef XKB
#include "inputstr.h"
#include <X11/extensions/XKB.h>
#include <X11/extensions/XKBstr.h>
#include <X11/extensions/XKBsrv.h>
extern Bool noXkbExtension;
#endif
#include "xf86Xinput.h"
#include "mipointer.h"
typedef struct {
int xquePending;
int xqueSema;
} XqInfoRec, *XqInfoPtr;
InputInfoPtr XqMouse = NULL;
InputInfoPtr XqKeyboard = NULL;
#ifndef XQUEUE_ASYNC
/*
* xf86XqueSignal --
* Trap the signal from xqueue and let it be known that events are
* ready for collection
*/
static void
xf86XqueSignal(int signum)
{
((XqInfoPtr)(((MouseDevPtr)(XqMouse->private))->mousePriv))->xquePending = 1;
/*
* This is a hack, but it is the only reliable way I can find of letting
* the main select() loop know that there is more input waiting. Receiving
* a signal will interrupt select(), but there is no way I can find of
* dealing with events that come in between the end of processing the
* last set and when select() gets called.
*
* Suggestions for better ways of dealing with this without going back to
* asynchronous event processing are welcome.
*/
#ifdef DEBUG
ErrorF("xf86XqueSignal\n");
#endif
write(xquePipe[1], "X", 1);
signal(SIGUSR2, xf86XqueSignal);
}
#endif
/*
* xf86XqueKbdProc --
* Handle the initialization, etc. of a keyboard.
*/
int
xf86XqueKbdProc(DeviceIntPtr pKeyboard, int what)
{
KeySymsRec keySyms;
CARD8 modMap[MAP_LENGTH];
switch (what) {
case DEVICE_INIT:
xf86KbdGetMapping(&keySyms, modMap);
/*
* Get also the initial led settings
*/
ioctl(xf86Info.consoleFd, KDGETLED, &xf86Info.leds);
/*
* Perform final initialization of the system private keyboard
* structure and fill in various slots in the device record
* itself which couldn't be filled in before.
*/
pKeyboard->public.on = FALSE;
#ifdef XKB
if (noXkbExtension) {
#endif
InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard,
&keySyms,
modMap,
xf86KbdBell,
(KbdCtrlProcPtr)xf86KbdCtrl);
#ifdef XKB
} else {
XkbComponentNamesRec names;
if (xf86Info.xkbkeymap) {
names.keymap = xf86Info.xkbkeymap;
names.keycodes = NULL;
names.types = NULL;
names.compat = NULL;
names.symbols = NULL;
names.geometry = NULL;
} else {
names.keymap = NULL;
names.keycodes = xf86Info.xkbkeycodes;
names.types = xf86Info.xkbtypes;
names.compat = xf86Info.xkbcompat;
names.symbols = xf86Info.xkbsymbols;
names.geometry = xf86Info.xkbgeometry;
}
if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified)
&& (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) {
xf86Info.xkbrules = NULL;
}
XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel,
xf86Info.xkblayout, xf86Info.xkbvariant,
xf86Info.xkboptions);
XkbInitKeyboardDeviceStruct(pKeyboard,
&names,
&keySyms,
modMap,
xf86KbdBell,
(KbdCtrlProcPtr)xf86KbdCtrl);
}
#endif
xf86InitKBD(TRUE);
break;
case DEVICE_ON:
pKeyboard->public.on = TRUE;
xf86InitKBD(FALSE);
break;
case DEVICE_CLOSE:
case DEVICE_OFF:
pKeyboard->public.on = FALSE;
break;
}
return (Success);
}
/*
* xf86XqueEvents --
* Get some events from our queue. Nothing to do here ...
*/
void
xf86XqueEvents()
{
}
#ifdef XQUEUE_ASYNC
static void XqDoInput(int signum);
#endif
void
XqReadInput(InputInfoPtr pInfo)
{
MouseDevPtr pMse;
XqInfoPtr pXq;
xqEvent *XqueEvents;
int XqueHead;
char buf[100];
signed char dx, dy;
if (xqueFd < 0)
return;
pMse = pInfo->private;
pXq = pMse->mousePriv;
XqueEvents = XqueQaddr->xq_events;
XqueHead = XqueQaddr->xq_head;
while (XqueHead != XqueQaddr->xq_tail) {
switch (XqueEvents[XqueHead].xq_type) {
case XQ_BUTTON:
pMse->PostEvent(pInfo, ~(XqueEvents[XqueHead].xq_code) & 0x07,
0, 0, 0, 0);
#ifdef DEBUG
ErrorF("xqueue: buttons: %d\n", ~(XqueEvents[XqueHead].xq_code) & 0x07);
#endif
break;
case XQ_MOTION:
dx = (signed char)XqueEvents[XqueHead].xq_x;
dy = (signed char)XqueEvents[XqueHead].xq_y;
pMse->PostEvent(pInfo, ~(XqueEvents[XqueHead].xq_code) & 0x07,
(int)dx, (int)dy, 0, 0);
#ifdef DEBUG
ErrorF("xqueue: Motion: (%d, %d) (buttons: %d)\n", dx, dy, ~(XqueEvents[XqueHead].xq_code) & 0x07);
#endif
break;
case XQ_KEY:
/* XXX Need to deal with the keyboard part nicely. */
#ifdef DEBUG
ErrorF("xqueue: key: %d\n", XqueEvents[XqueHead].xq_code);
#endif
xf86PostKbdEvent(XqueEvents[XqueHead].xq_code);
break;
default:
xf86Msg(X_WARNING, "Unknown Xque Event: 0x%02x\n",
XqueEvents[XqueHead].xq_type);
}
if ((++XqueHead) == XqueQaddr->xq_size) XqueHead = 0;
xf86Info.inputPending = TRUE;
}
/* reenable the signal-processing */
#ifdef XQUEUE_ASYNC
signal(SIGUSR2, XqDoInput);
#endif
#ifndef XQUEUE_ASYNC
{
int rval;
while ((rval = read(xquePipe[0], buf, sizeof(buf))) > 0)
#ifdef DEBUG
ErrorF("Read %d bytes from xquePipe[0]\n", rval);
#else
;
#endif
}
#endif
#ifdef DEBUG
ErrorF("Leaving XqReadInput()\n");
#endif
pXq->xquePending = 0;
XqueQaddr->xq_head = XqueQaddr->xq_tail;
XqueQaddr->xq_sigenable = 1; /* UNLOCK */
}
#ifdef XQUEUE_ASYNC
static void
XqDoInput(int signum)
{
if (XqMouse)
XqReadInput(XqMouse);
}
#endif
static void
XqBlock(pointer blockData, OSTimePtr pTimeout, pointer pReadmask)
{
InputInfoPtr pInfo;
MouseDevPtr pMse;
XqInfoPtr pXq;
/*
* On MP SVR4 boxes, a race condition exists because the XQUEUE does
* not have anyway to lock it for exclusive access. This results in one
* processor putting something on the queue at the same time the other
* processor is taking it something off. The count of items in the queue
* can get off by 1. This just goes and checks to see if an extra event
* was put in the queue a during this period. The signal for this event
* was ignored while processing the previous event.
*/
pInfo = blockData;
pMse = pInfo->private;
pXq = pMse-> mousePriv;
if (!pXq->xquePending) {
#ifdef DEBUG
ErrorF("XqBlock: calling XqReadInput()\n");
#endif
XqReadInput((InputInfoPtr)blockData);
} else {
#ifdef DEBUG
ErrorF("XqBlock: not calling XqReadInput()\n");
#endif
;
}
/*
* Make sure that any events that come in here are passed on without.
* waiting for the next wakeup.
*/
if (xf86Info.inputPending) {
#ifdef DEBUG
ErrorF("XqBlock: calling ProcessInputEvents()\n");
#endif
ProcessInputEvents();
} else {
#ifdef DEBUG
ErrorF("XqBlock: not calling ProcessInputEvents()\n");
#endif
;
}
}
/*
* XqEnable --
* Enable the handling of the Xque
*/
static int
XqEnable(InputInfoPtr pInfo)
{
MouseDevPtr pMse;
XqInfoPtr pXq;
static struct kd_quemode xqueMode;
static Bool was_here = FALSE;
pMse = pInfo->private;
pXq = pMse->mousePriv;
if (xqueFd < 0) {
if ((xqueFd = open("/dev/mouse", O_RDONLY | O_NDELAY)) < 0) {
if (xf86GetAllowMouseOpenFail()) {
xf86Msg(X_WARNING,
"%s: Cannot open /dev/mouse (%s) - Continuing...\n",
pInfo->name, strerror(errno));
return Success;
} else {
xf86Msg(X_ERROR, "%s: Cannot open /dev/mouse (%s)\n",
pInfo->name, strerror(errno));
return !Success;
}
}
}
#ifndef XQUEUE_ASYNC
if (!was_here) {
pipe(xquePipe);
fcntl(xquePipe[0], F_SETFL, fcntl(xquePipe[0], F_GETFL, 0) | O_NDELAY);
fcntl(xquePipe[1], F_SETFL, fcntl(xquePipe[1], F_GETFL, 0) | O_NDELAY);
was_here = TRUE;
}
#endif
if (pXq->xqueSema++ == 0) {
#ifdef XQUEUE_ASYNC
(void) signal(SIGUSR2, XqDoInput);
#else
(void) signal(SIGUSR2, xf86XqueSignal);
#endif
xqueMode.qsize = 64; /* max events */
xqueMode.signo = SIGUSR2;
ioctl(xf86Info.consoleFd, KDQUEMODE, NULL);
if (ioctl(xf86Info.consoleFd, KDQUEMODE, &xqueMode) < 0) {
xf86Msg(X_ERROR, "%s: Cannot set KDQUEMODE", pInfo->name);
return !Success;
}
XqueQaddr = (xqEventQueue *)xqueMode.qaddr;
XqueQaddr->xq_sigenable = 1; /* UNLOCK */
}
return Success;
}
/*
* xf86XqueDisable --
* disable the handling of the Xque
*/
static int
XqDisable(InputInfoPtr pInfo)
{
MouseDevPtr pMse;
XqInfoPtr pXq;
pMse = pInfo->private;
pXq = pMse->mousePriv;
if (pXq->xqueSema-- == 1)
{
XqueQaddr->xq_sigenable = 0; /* LOCK */
if (ioctl(xf86Info.consoleFd, KDQUEMODE, NULL) < 0) {
xf86Msg(X_ERROR, "%s: Cannot unset KDQUEMODE", pInfo->name);
return !Success;
}
}
if (xqueFd >= 0) {
close(xqueFd);
xqueFd = -1;
}
return Success;
}
/*
* XqMouseProc --
* Handle the initialization, etc. of a mouse
*/
static int
XqMouseProc(DeviceIntPtr pPointer, int what)
{
InputInfoPtr pInfo;
MouseDevPtr pMse;
unchar map[4];
int ret;
pInfo = pPointer->public.devicePrivate;
pMse = pInfo->private;
pMse->device = pPointer;
switch (what) {
case DEVICE_INIT:
pPointer->public.on = FALSE;
map[1] = 1;
map[2] = 2;
map[3] = 3;
InitPointerDeviceStruct((DevicePtr)pPointer,
map,
3,
miPointerGetMotionEvents,
pMse->Ctrl,
miPointerGetMotionBufferSize());
/* X valuator */
xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
xf86InitValuatorDefaults(pPointer, 0);
/* Y valuator */
xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
xf86InitValuatorDefaults(pPointer, 1);
xf86MotionHistoryAllocate(pInfo);
RegisterBlockAndWakeupHandlers(XqBlock, (WakeupHandlerProcPtr)NoopDDA,
pInfo);
break;
case DEVICE_ON:
pMse->lastButtons = 0;
pMse->lastMappedButtons = 0;
pMse->emulateState = 0;
pPointer->public.on = TRUE;
ret = XqEnable(pInfo);
#ifndef XQUEUE_ASYNC
if (xquePipe[0] != -1) {
pInfo->fd = xquePipe[0];
AddEnabledDevice(xquePipe[0]);
}
#endif
return ret;
case DEVICE_CLOSE:
case DEVICE_OFF:
pPointer->public.on = FALSE;
ret = XqDisable(pInfo);
#ifndef XQUEUE_ASYNC
if (xquePipe[0] != -1) {
RemoveEnabledDevice(xquePipe[0]);
pInfo->fd = -1;
}
#endif
return ret;
}
return Success;
}
Bool
XqueueMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
{
MouseDevPtr pMse;
XqInfoPtr pXq;
pMse = pInfo->private;
pMse->protocol = protocol;
xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
pXq = pMse->mousePriv = xnfcalloc(sizeof(XqInfoRec), 1);
/* Collect the options, and process the common options. */
xf86CollectInputOptions(pInfo, NULL, NULL);
xf86ProcessCommonOptions(pInfo, pInfo->options);
/* Process common mouse options (like Emulate3Buttons, etc). */
pMse->CommonOptions(pInfo);
/* Setup the local procs. */
pInfo->device_control = XqMouseProc;
#ifdef XQUEUE_ASYNC
pInfo->read_input = NULL;
#else
pInfo->read_input = XqReadInput;
#endif
pInfo->fd = -1;
XqMouse = pInfo;
pInfo->flags |= XI86_CONFIGURED;
return TRUE;
}
#endif /* XQUEUE */

View File

@ -1,12 +0,0 @@
/* $XFree86$ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#ifndef _XF86_XQUEUE_H_
#define _XF86_XQUEUE_H_
Bool XqueueMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags);
#endif

View File

@ -1,9 +1,6 @@
EXTRA_DIST = \
usl_init.c \
usl_io.c \
usl_iop.c \
usl_mouse.c \
usl_video.c \
usl_vtsw.c \
usl_xqueue.c \
usl_xqueue.h
usl_vtsw.c

View File

@ -1,171 +0,0 @@
/*
* Copyright 2001-2005 by Kean Johnston <jkj@sco.com>
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993 by David Dawes <dawes@xfree86.org>
*
* 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, and that the names of Thomas Roell, David Dawes
* and Kean Johnston not be used in advertising or publicity pertaining to
* distribution of the software without specific, written prior permission.
* Thomas Roell, David Dawes and Kean Johnston make no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* THOMAS ROELL, DAVID DAWES AND KEAN JOHNSTON DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THOMAS ROELLm DAVID WEXELBLAT
* OR KEAN JOHNSTON 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.
*
*/
/* $XConsortium$ */
#include "X.h"
#include "compiler.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
_X_EXPORT void
xf86SoundKbdBell(int loudness, int pitch, int duration)
{
if (loudness && pitch) {
ioctl(xf86Info.consoleFd, KIOCSOUND, 1193180 / pitch);
usleep(xf86Info.bell_duration * loudness * 20);
ioctl(xf86Info.consoleFd, KIOCSOUND, 0);
}
}
void
xf86SetKbdLeds(int leds)
{
ioctl(xf86Info.consoleFd, KDSETLED, leds);
}
int
xf86GetKbdLeds(void)
{
int leds;
ioctl(xf86Info.consoleFd, KDGETLED, &leds);
return(leds);
}
/*
* Much of the code in this function is duplicated from the Linux code
* by Orest Zborowski <obz@Kodak.com> and David Dawes <dawes@xfree86.org>.
* Please see the file ../linux/lnx_io.c for full copyright information.
*/
void
xf86SetKbdRepeat(char rad)
{
int i;
int value = 0x7f; /* Maximum delay with slowest rate */
int delay = 250; /* Default delay */
int rate = 300; /* Default repeat rate */
static int valid_rates[] = { 300, 267, 240, 218, 200, 185, 171, 160, 150,
133, 120, 109, 100, 92, 86, 80, 75, 67,
60, 55, 50, 46, 43, 40, 37, 33, 30, 27,
25, 23, 21, 20 };
#define RATE_COUNT (sizeof( valid_rates ) / sizeof( int ))
static int valid_delays[] = { 250, 500, 750, 1000 };
#define DELAY_COUNT (sizeof( valid_delays ) / sizeof( int ))
if (xf86Info.kbdRate >= 0)
rate = xf86Info.kbdRate * 10;
if (xf86Info.kbdDelay >= 0)
delay = xf86Info.kbdDelay;
for (i = 0; i < RATE_COUNT; i++)
if (rate >= valid_rates[i]) {
value &= 0x60;
value |= i;
break;
}
for (i = 0; i < DELAY_COUNT; i++)
if (delay <= valid_delays[i]) {
value &= 0x1f;
value |= i << 5;
break;
}
ioctl (xf86Info.consoleFd, KDSETTYPEMATICS, value);
}
static int orig_kbm;
static struct termio orig_termio;
static keymap_t keymap, noledmap;
void
xf86KbdInit(void)
{
ioctl (xf86Info.consoleFd, KDGKBMODE, &orig_kbm);
ioctl (xf86Info.consoleFd, TCGETA, &orig_termio);
/*
* We need to get the original keyboard map and NUL out the lock
* modifiers. This prevents the scancode API from messing with
* the keyboard LED's. We restore the original map when we exit.
*/
if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &keymap) < 0) {
FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
strerror(errno));
}
if (ioctl (xf86Info.consoleFd, GIO_KEYMAP, &noledmap) < 0) {
FatalError ("xf86KbdInit: Failed to get keyboard map (%s)\n",
strerror(errno));
} else {
int i, j;
for (i = 0; i < noledmap.n_keys; i++) {
for (j = 0; j < NUM_STATES; j++) {
if (IS_SPECKEY(&noledmap, i, j) &&
((noledmap.key[i].map[j] == K_CLK) ||
(noledmap.key[i].map[j] == K_NLK) ||
(noledmap.key[i].map[j] == K_SLK))) {
noledmap.key[i].map[j] = K_NOP;
}
}
}
}
}
int
xf86KbdOn(void)
{
struct termio newtio;
newtio = orig_termio; /* structure copy */
newtio.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
newtio.c_oflag = 0;
newtio.c_cflag = CREAD | CS8 | B9600;
newtio.c_lflag = 0;
newtio.c_cc[VTIME]=0;
newtio.c_cc[VMIN]=1;
ioctl(xf86Info.consoleFd, TCSETA, &newtio);
ioctl (xf86Info.consoleFd, KDSKBMODE, K_RAW);
ioctl (xf86Info.consoleFd, PIO_KEYMAP, &noledmap);
return(xf86Info.consoleFd);
}
int
xf86KbdOff(void)
{
ioctl (xf86Info.consoleFd, KDSKBMODE, orig_kbm);
ioctl (xf86Info.consoleFd, PIO_KEYMAP, &keymap);
ioctl(xf86Info.consoleFd, TCSETA, &orig_termio);
return(xf86Info.consoleFd);
}

View File

@ -33,7 +33,6 @@
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "mipointer.h"
#include "usl_xqueue.h"
static int
SupportedInterfaces(void)
@ -42,7 +41,6 @@ SupportedInterfaces(void)
}
static const char *internalNames[] = {
"Xqueue",
NULL
};
@ -55,7 +53,7 @@ BuiltinNames(void)
static const char *
DefaultProtocol (void)
{
return "Xqueue";
return "OSMouse";
}
static Bool
@ -121,7 +119,6 @@ OsMouseProc(DeviceIntPtr pPointer, int what)
static Bool
OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
{
/* This is called when the protocol is "Xqueue" */
MouseDevPtr pMse;
pMse = pInfo->private;
@ -155,7 +152,7 @@ OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
/* Setup the local procs. */
pInfo->device_control = OsMouseProc;
pInfo->read_input = NULL; /* Handled by the XQUEUE signal handler */
pInfo->read_input = NULL;
pInfo->flags |= XI86_CONFIGURED;
return TRUE;

View File

@ -1,359 +0,0 @@
/* $XdotOrg$ */
/*
* Copyright 2005 by Kean Johnston <jkj@sco.com>
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
* Copyright 1993-1999 by The XFree86 Project, Inc.
*
* 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, and that the name of the copyright holders not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. The copyright holders make no
* representations about the suitability of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS 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.
*
*/
/* $XConsortium$ */
#include "X.h"
#include "compiler.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "xf86Xinput.h"
#include "xf86OSmouse.h"
#include "usl_xqueue.h"
#ifdef XKB
#include "inputstr.h"
#include <X11/extensions/XKB.h>
#include <X11/extensions/XKBstr.h>
#include <X11/extensions/XKBsrv.h>
extern Bool noXkbExtension;
#endif
#include "xf86Xinput.h"
#include "mipointer.h"
#if !defined(XQ_WHEEL)
# define XQ_WHEEL 4
#endif
/*
* Implementation notes
*
* This code is based on a mixture of the original XFree86 sysv/xqueue.c
* and information gathered from the SCO X server code (no actual code
* was used, just the principles).
*
* The XFree86 XQUEUE code went to some considerable lengths to implement
* what it calls "asynchronous XQUEUE". This involved creating a pipe,
* and writing to that pipe each time an XQUEUE signal is received. The
* one end of that pipe was then added to the list of selectable file
* descriptors with AddEnabledDevice(). I completely fail to see the need
* for this, and this code does not implement that mechanism. The server
* will be interrupted anyway by the XQUEUE driver, so whether we pull the
* events off the queue at the time we receive the signal or whether we
* write to a pipe and then have the main select() loop stop and call us,
* it makes no difference I can fathom.
*
* The code also differs from the original XFree86 code in that it maintains
* local variables for the number of devices initialized. The original code
* stored that information in the private data pointer of the mouse structure,
* but this same code is used for both the keyboard and the mouse, so that
* was changed.
*
* Part of the difficulty in dealing with XQUEUE is that it is a single
* interface to two devices. The recent changes in XFree86/Xorg try to
* treat the mouse and keyboard as discrete devices, and the code is
* structured in such a way that they should be able to be independently
* opened and closed. But we can't do that with XQUEUE, so we have to
* centralize XQUEUE access here in this module.
*/
static xqEventQueue *xqQaddr = NULL;
static int xqSigEnable = 1;
static int xqEnableCount = 0;
static struct kd_quemode xqMode;
/*
* These two pointers are set when the keyboard/mouse handler procs
* are called to turn them on or off. This is so that we can call the
* correct PostEvent for the device.
*/
static InputInfoPtr xqMouse = NULL;
static InputInfoPtr xqKeyboard = NULL;
static void XqSignalHandler (int signo);
/*
* Private functions
*/
static void
XqReset (void)
{
if (xqEnableCount > 0) {
xqQaddr->xq_head = xqQaddr->xq_tail;
xqQaddr->xq_sigenable = xqSigEnable;
}
}
#ifdef NOTNEEDED
static void
XqLock (void)
{
xqSigEnable = 0;
if (xqEnableCount > 0) {
xqQaddr->xq_sigenable = xqSigEnable;
}
}
static void
XqUnlock (void)
{
xqSigEnable = 1;
if (xqEnableCount > 0) {
xqQaddr->xq_sigenable = xqSigEnable;
}
}
#endif /* NOTNEEDED */
/*
* Since this code is shared between two devices, we need to keep track
* of how many times we've been enabled or disabled. For example, if the
* keyboard has been turned off, but the mouse hasn't, then we do not
* want the whole queue off. Only when both devices are turned off do we
* actually disable Xqueue mode. When either device is turned on, we
* enable it.
*/
static int
XqEnable (InputInfoPtr pInfo)
{
struct sigaction xqsig;
static int msefd = -1;
if (msefd == -1) {
msefd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK);
#if 0
msefd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK | O_NOCTTY);
if (msefd < 0) {
/*
* Try giving it a controlling tty
*/
msefd = open (ttyname(xf86Info.consoleFd), O_RDWR | O_NONBLOCK);
if (msefd >= 0)
close (msefd);
msefd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK | O_NOCTTY);
if (msefd < 0)
sleep(2);
}
#endif
}
if (msefd < 0) {
if (xf86GetAllowMouseOpenFail()) {
ErrorF("%s: cannot open /dev/mouse (%s)\n",
ttyname(xf86Info.consoleFd), strerror(errno));
} else {
sleep(5);
FatalError ("%s: cannot open /dev/mouse (%s)\n",
ttyname(xf86Info.consoleFd), strerror(errno));
}
}
if (xqEnableCount++ == 0) {
xqMode.qaddr = 0;
ioctl (xf86Info.consoleFd, KDQUEMODE, NULL);
/*
* Note: We need to make sure the signal is armed before we enable
* XQUEUE mode, so that if we get events immediately after the ioctl
* we dont have an unhandled signal coming to the Xserver.
* Also note that we use sigaction, so that we do not have to re-arm
* the signal every time it is delivered, which just slows things
* down (setting a signal is a fairly expensive operation).
*/
xqsig.sa_handler = XqSignalHandler;
sigfillset (&xqsig.sa_mask);
xqsig.sa_flags = 0;
sigaction (SIGUSR2, &xqsig, NULL);
/*
* This is a fairly large queue size. Since we are reacting to events
* asynchronously, its best for performance if we deal with as many
* events as possible, and high resolution mice generate a lot of
* events.
*/
xqMode.qsize = 64;
xqMode.signo = SIGUSR2;
xqMode.qaddr = 0;
if (ioctl (xf86Info.consoleFd, KDQUEMODE, &xqMode) < 0) {
xf86Msg (X_ERROR, "%s: could not set XQUEUE mode (%s)", pInfo->name,
strerror(errno));
xqEnableCount--;
xqsig.sa_handler = SIG_DFL;
sigfillset (&xqsig.sa_mask);
xqsig.sa_flags = 0;
sigaction (SIGUSR2, &xqsig, NULL);
return !Success;
}
/*
* We're in business. The workstation is now in XQUEUE mode.
*/
xqQaddr = (xqEventQueue *)xqMode.qaddr;
xqQaddr->xq_sigenable = 0; /* LOCK */
nap(500);
XqReset();
}
return Success;
}
static int
XqDisable (InputInfoPtr pInfo)
{
struct sigaction xqsig;
if (xqEnableCount-- == 1) {
xqQaddr->xq_sigenable = 0; /* LOCK */
if (ioctl (xf86Info.consoleFd, KDQUEMODE, NULL) < 0) {
xf86Msg (X_ERROR, "%s: could not unset XQUEUE mode (%s)", pInfo->name,
strerror(errno));
xqEnableCount++;
return !Success;
}
xqsig.sa_handler = SIG_DFL;
sigfillset (&xqsig.sa_mask);
xqsig.sa_flags = 0;
sigaction (SIGUSR2, &xqsig, NULL);
}
return Success;
}
/*
* XQUEUE signal handler. This is what goes through the list of events
* we've already received and dispatches them to either the keyboard or
* mouse event poster.
*/
static void
XqSignalHandler (int signo)
{
xqEvent *xqEvents = xqQaddr->xq_events;
int xqHead = xqQaddr->xq_head;
xEvent xE;
MouseDevPtr pMse = NULL;
KbdDevPtr pKbd = NULL;
signed char dx, dy;
if (xqMouse)
pMse = (MouseDevPtr)xqMouse->private;
if (xqKeyboard)
pKbd = (KbdDevPtr)xqKeyboard->private;
while (xqHead != xqQaddr->xq_tail) {
switch (xqEvents[xqHead].xq_type) {
case XQ_MOTION:
dx = (signed char)xqEvents[xqHead].xq_x;
dy = (signed char)xqEvents[xqHead].xq_y;
if (pMse)
pMse->PostEvent(xqMouse, ~(xqEvents[xqHead].xq_code) & 0x07,
(int)dx, (int)dy, 0, 0);
break;
case XQ_BUTTON:
if (pMse)
pMse->PostEvent(xqMouse, ~(xqEvents[xqHead].xq_code) & 0x07,
0, 0, 0, 0);
break;
case XQ_WHEEL:
if (pMse) {
int wbut = pMse->lastButtons, dz;
if (xqEvents[xqHead].xq_code == 1)
dz = 1;
else
dz = -1;
pMse->PostEvent(xqMouse, wbut, 0, 0, dz, 0);
}
break;
case XQ_KEY:
if (pKbd)
pKbd->PostEvent(xqKeyboard, xqEvents[xqHead].xq_code & 0x7f,
xqEvents[xqHead].xq_code & 0x80 ? FALSE : TRUE);
break;
default:
xf86Msg(X_WARNING, "XQUEUE: unknown event type %d\n",
xqEvents[xqHead].xq_type);
break;
}
xqHead++;
if (xqHead == xqQaddr->xq_size)
xqHead = 0;
xf86Info.inputPending = TRUE;
}
XqReset();
}
/*
* Public functions
*/
int
XqMseOnOff (InputInfoPtr pInfo, int on)
{
if (on) {
if (xqMouse) {
if (xqMouse != pInfo)
xf86Msg(X_WARNING, "XqMseOnOff: mouse pointer structure changed!\n");
xqMouse = pInfo;
} else {
xqMouse = pInfo;
return XqEnable(pInfo);
}
} else {
xqMouse = NULL;
return XqDisable(pInfo);
}
return Success;
}
int
XqKbdOnOff (InputInfoPtr pInfo, int on)
{
if (on) {
if (xqKeyboard) {
if (xqKeyboard != pInfo)
xf86Msg(X_WARNING, "XqKbdOnOff: keyboard pointer structure changed!\n");
xqKeyboard = pInfo;
} else {
xqKeyboard = pInfo;
return XqEnable(pInfo);
}
} else {
xqKeyboard = NULL;
return XqDisable(pInfo);
}
return Success;
}

View File

@ -1,9 +0,0 @@
/* $XdotOrg$ */
#ifndef _XF86_USL_XQUEUE_H_
#define _XF86_USL_XQUEUE_H_
extern int XqMseOnOff (InputInfoPtr pInfo, int on);
extern int XqKbdOnOff (InputInfoPtr pInfo, int on);
#endif

View File

@ -235,15 +235,6 @@ typedef signed long xf86ssize_t;
# define i386 /* not defined in ANSI C mode */
# endif /* ATT && !i386 */
# if (defined(ATT) || defined(SVR4)) && !defined(sun)
# ifndef __UNIXWARE__
# ifndef XQUEUE
# define XQUEUE
# endif
# endif
# include <sys/xque.h>
# endif /* ATT || SVR4 */
# ifdef SYSV
# if !defined(ISC) || defined(ISC202) || defined(ISC22)
# define NEED_STRERROR

View File

@ -135,10 +135,6 @@ extern void xf86WrapperInit(void);
#include <X11/Xfuncproto.h>
#include "opaque.h"
#if defined(XQUEUE)
#include "input.h" /* for DeviceIntPtr */
#endif
_XFUNCPROTOBEGIN
/* public functions */
@ -224,21 +220,7 @@ extern Bool xf86VTSwitchTo(void);
extern void xf86VTRequest(int sig);
extern int xf86ProcessArgument(int, char **, int);
extern void xf86UseMsg(void);
extern void xf86SetKbdLeds(int);
extern int xf86GetKbdLeds(void);
extern void xf86SetKbdRepeat(char);
extern void xf86KbdInit(void);
extern int xf86KbdOn(void);
extern int xf86KbdOff(void);
extern void xf86KbdEvents(void);
#ifdef XQUEUE
extern int xf86XqueKbdProc(DeviceIntPtr, int);
extern void xf86XqueEvents(void);
#endif
extern void xf86ReloadInputDevs(int sig);
#ifdef WSCONS_SUPPORT
extern void xf86WSKbdEvents(void);
#endif
extern PMClose xf86OSPMOpen(void);
#ifdef NEED_OS_RAC_PROTOS

View File

@ -60,9 +60,6 @@ static struct MouseProtocol {
#ifdef __SCO__
{"OsMouse", MTYPE_AUTOMOUSE},
#endif
#if defined(__UNIXWARE__)
{"Xqueue", MTYPE_XQUEUE},
#endif
#ifdef WSCONS_SUPPORT
{"wsmouse", MTYPE_AUTOMOUSE},
#endif

View File

@ -361,9 +361,6 @@ static char *protocols[] = {
#ifdef __SCO__
"OsMouse",
#endif
#ifdef __UNIXWARE__
"Xqueue",
#endif
#ifdef WSCONS_SUPPORT
"wsmouse",
#endif

View File

@ -2068,12 +2068,6 @@ static char *XF86Config_fontpathchunk_text =
" Identifier \"Keyboard1\"\n"
" Driver \"kbd\"\n"
"\n"
"# For most OSs the protocol can be omitted (it defaults to \"Standard\").\n"
"# When using XQUEUE (only for SVR3 and SVR4, but not Solaris),\n"
"# uncomment the following line.\n"
"\n"
"# Option \"Protocol\" \"Xqueue\"\n"
"\n"
" Option \"AutoRepeat\" \"500 30\"\n"
"\n"
"# Specify which keyboard LEDs can be user-controlled (eg, with xset(1))\n"
@ -2125,7 +2119,7 @@ static char *pointersection_text1 =
"\n"
"# Identifier and driver\n"
"\n"
#if defined(__UNIXWARE__) || defined(XQUEUE)
#if defined(__UNIXWARE__)
"# Identifier \"Mouse1\"\n"
"# Driver \"mouse\"\n"
#else
@ -2136,15 +2130,6 @@ static char *pointersection_text1 =
static char *pointersection_text2 =
"\n"
"# When using XQUEUE, comment out the above two lines, and uncomment\n"
"# the following line.\n"
"\n"
#if defined(__UNIXWARE__) || defined(XQUEUE)
" Option \"Protocol\" \"Xqueue\"\n"
#else
"# Option \"Protocol\" \"Xqueue\"\n"
#endif
"\n"
"# Mouse-speed setting for PS/2 mouse.\n"
"\n"
"# Option \"Resolution\" \"256\"\n"

View File

@ -181,12 +181,6 @@ Section "InputDevice"
Identifier "Keyboard1"
Driver "keyboard"
XCOMM For most OSs the protocol can be omitted (it defaults to "Standard").
XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), comment
XCOMM out the above line, and uncomment the following line.
XCOMM Option "Protocol" "Xqueue"
XCOMM Set the keyboard auto repeat parameters. Not all platforms implement
XCOMM this.
@ -270,12 +264,6 @@ XCOMM be available.
XCOMM Option "Protocol" "PS/2"
XCOMM When using XQUEUE (only for SVR3 and SVR4, but not Solaris), use
XCOMM the following instead of any of the lines above. The Device line
XCOMM is not required in this case.
XCOMM Option "Protocol" "Xqueue"
XCOMM Baudrate and SampleRate are only for some older Logitech mice. In
XCOMM almost every case these lines should be omitted.