XFree86: Delete OSMouse code
This should be moved into the mouse driver, if anything.
This commit is contained in:
parent
d0de5ea96d
commit
b89a59248a
|
@ -32,7 +32,7 @@ libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
|
||||||
xf86MiscExt.c xf86Option.c \
|
xf86MiscExt.c xf86Option.c \
|
||||||
xf86VidMode.c xf86fbman.c xf86cmap.c \
|
xf86VidMode.c xf86fbman.c xf86cmap.c \
|
||||||
xf86Helper.c xf86PM.c xf86RAC.c \
|
xf86Helper.c xf86PM.c xf86RAC.c \
|
||||||
xf86Mode.c xf86Build.h xorgHelper.c xf86Versions.c \
|
xf86Mode.c xf86Build.h xorgHelper.c \
|
||||||
$(XVSOURCES) $(BUSSOURCES) $(XISOURCES) $(RANDRSOURCES)
|
$(XVSOURCES) $(BUSSOURCES) $(XISOURCES) $(RANDRSOURCES)
|
||||||
nodist_libcommon_la_SOURCES = xf86DefModeSet.c
|
nodist_libcommon_la_SOURCES = xf86DefModeSet.c
|
||||||
libinit_a_SOURCES = xf86Build.h xf86Init.c
|
libinit_a_SOURCES = xf86Build.h xf86Init.c
|
||||||
|
@ -44,7 +44,7 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
|
||||||
|
|
||||||
sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
|
sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
|
||||||
xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86Resources.h \
|
xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86Resources.h \
|
||||||
xf86cmap.h xf86fbman.h xf86str.h $(XISDKINCS) xf86RAC.h \
|
xf86cmap.h xf86fbman.h xf86str.h xf86RAC.h $(XISDKINCS) \
|
||||||
$(XVSDKINCS) atKeynames.h xf86Version.h xorgVersion.h \
|
$(XVSDKINCS) atKeynames.h xf86Version.h xorgVersion.h \
|
||||||
xf86sbusBus.h xf86xv.h xf86xvmc.h xf86xvpriv.h
|
xf86sbusBus.h xf86xv.h xf86xvmc.h xf86xvpriv.h
|
||||||
|
|
||||||
|
|
|
@ -401,12 +401,6 @@ Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
|
||||||
|
|
||||||
Bool VidModeExtensionInit(ScreenPtr pScreen);
|
Bool VidModeExtensionInit(ScreenPtr pScreen);
|
||||||
|
|
||||||
/* xf86Versions.c */
|
|
||||||
CARD32 xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flag);
|
|
||||||
Bool xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface,
|
|
||||||
CARD32 version, int flags);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _NO_XF86_PROTOTYPES */
|
#endif /* _NO_XF86_PROTOTYPES */
|
||||||
|
|
||||||
#endif /* _XF86_H */
|
#endif /* _XF86_H */
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
#include <X11/extensions/XIproto.h>
|
#include <X11/extensions/XIproto.h>
|
||||||
#include "xf86Xinput.h"
|
#include "xf86Xinput.h"
|
||||||
|
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# define DEBUG_P(x) ErrorF(x"\n");
|
# define DEBUG_P(x) ErrorF(x"\n");
|
||||||
#else
|
#else
|
||||||
|
@ -404,17 +402,8 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
|
||||||
= LoaderSymbol("xf86MouseProtocolIDToName");
|
= LoaderSymbol("xf86MouseProtocolIDToName");
|
||||||
if (!xf86MouseProtocolIDToName)
|
if (!xf86MouseProtocolIDToName)
|
||||||
return MISC_RET_NOMODULE;
|
return MISC_RET_NOMODULE;
|
||||||
if (mse->type < MTYPE_MICROSOFT
|
if (mse->type < MTYPE_MICROSOFT || mse->type > MTYPE_EXPPS2)
|
||||||
|| (mse->type > MTYPE_EXPPS2
|
|
||||||
&& (mse->type != MTYPE_OSMOUSE)))
|
|
||||||
return MISC_RET_BADMSEPROTO;
|
return MISC_RET_BADMSEPROTO;
|
||||||
#ifdef OSMOUSE_ONLY
|
|
||||||
if (mse->type != MTYPE_OSMOUSE)
|
|
||||||
return MISC_RET_BADMSEPROTO;
|
|
||||||
#else
|
|
||||||
if (mse->type == MTYPE_OSMOUSE)
|
|
||||||
return MISC_RET_BADMSEPROTO;
|
|
||||||
#endif /* OSMOUSE_ONLY */
|
|
||||||
|
|
||||||
if (mse->em3timeout < 0)
|
if (mse->em3timeout < 0)
|
||||||
return MISC_RET_BADVAL;
|
return MISC_RET_BADVAL;
|
||||||
|
@ -431,8 +420,7 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
|
||||||
reopen = TRUE;
|
reopen = TRUE;
|
||||||
mse->flags &= ~MF_REOPEN;
|
mse->flags &= ~MF_REOPEN;
|
||||||
}
|
}
|
||||||
if (mse->type != MTYPE_OSMOUSE
|
if (mse->type != MTYPE_PS_2
|
||||||
&& mse->type != MTYPE_PS_2
|
|
||||||
&& mse->type != MTYPE_BUSMOUSE
|
&& mse->type != MTYPE_BUSMOUSE
|
||||||
&& mse->type != MTYPE_IMPS2
|
&& mse->type != MTYPE_IMPS2
|
||||||
&& mse->type != MTYPE_THINKINGPS2
|
&& mse->type != MTYPE_THINKINGPS2
|
||||||
|
@ -451,12 +439,8 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
|
||||||
&& (mse->type != MTYPE_MOUSESYS))
|
&& (mse->type != MTYPE_MOUSESYS))
|
||||||
return MISC_RET_BADFLAGS;
|
return MISC_RET_BADFLAGS;
|
||||||
|
|
||||||
if (mse->type != MTYPE_OSMOUSE
|
if (mse->type != MTYPE_BUSMOUSE && mse->samplerate < 0)
|
||||||
&& mse->type != MTYPE_BUSMOUSE)
|
return MISC_RET_BADVAL;
|
||||||
{
|
|
||||||
if (mse->samplerate < 0)
|
|
||||||
return MISC_RET_BADVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mse->resolution < 0)
|
if (mse->resolution < 0)
|
||||||
return MISC_RET_BADVAL;
|
return MISC_RET_BADVAL;
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2003 by The XFree86 Project, Inc.
|
|
||||||
*
|
|
||||||
* 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, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
|
|
||||||
* and author(s) 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 copyright holder(s) and author(s).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
|
|
||||||
static CARD32 registeredVersions[NUM_BUILTIN_IFS];
|
|
||||||
|
|
||||||
_X_EXPORT CARD32
|
|
||||||
xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flags)
|
|
||||||
{
|
|
||||||
if (iface < 0 || iface >= NUM_BUILTIN_IFS) {
|
|
||||||
xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: Unexpected interface"
|
|
||||||
"query: %d\n", iface);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (registeredVersions[iface])
|
|
||||||
return registeredVersions[iface];
|
|
||||||
|
|
||||||
/* Most built-in interfaces are handled this way. */
|
|
||||||
switch (iface) {
|
|
||||||
case BUILTIN_IF_OSMOUSE:
|
|
||||||
return OS_MOUSE_VERSION_CURRENT;
|
|
||||||
default:
|
|
||||||
xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: internal error: "
|
|
||||||
"interface %d not handled\n", iface);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT Bool
|
|
||||||
xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface, CARD32 version,
|
|
||||||
int flags)
|
|
||||||
{
|
|
||||||
if (iface < 0 || iface >= NUM_BUILTIN_IFS) {
|
|
||||||
xf86Msg(X_ERROR, "xf86RegisterBuiltinInterfaceVersion: "
|
|
||||||
"unexpected interface number: %d\n", iface);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (version == 0) {
|
|
||||||
xf86Msg(X_ERROR, "xf86RegisterBuiltinInterfaceVersion: "
|
|
||||||
"versions must be greater than zero\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
registeredVersions[iface] = version;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1103,13 +1103,6 @@ typedef void (*InputHandlerProc)(int fd, pointer data);
|
||||||
#define OVERLAY_8_16_DUALFB 0x00000004
|
#define OVERLAY_8_16_DUALFB 0x00000004
|
||||||
#define OVERLAY_8_32_PLANAR 0x00000008
|
#define OVERLAY_8_32_PLANAR 0x00000008
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define LD_RESOLV_IFDONE 0 /* only check if no more
|
|
||||||
delays pending */
|
|
||||||
#define LD_RESOLV_NOW 1 /* finish one delay step */
|
|
||||||
#define LD_RESOLV_FORCE 2 /* force checking... */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Values of xf86Info.mouseFlags */
|
/* Values of xf86Info.mouseFlags */
|
||||||
#define MF_CLEAR_DTR 1
|
#define MF_CLEAR_DTR 1
|
||||||
#define MF_CLEAR_RTS 2
|
#define MF_CLEAR_RTS 2
|
||||||
|
@ -1127,28 +1120,4 @@ typedef enum {
|
||||||
ACTION_MESSAGE = 9999 /* Generic message passing */
|
ACTION_MESSAGE = 9999 /* Generic message passing */
|
||||||
} ActionEvent;
|
} ActionEvent;
|
||||||
|
|
||||||
/* xf86Versions.c */
|
|
||||||
/*
|
|
||||||
* Never change existing values, and always assign values explicitly.
|
|
||||||
* NUM_BUILTIN_IFS must always be the last entry.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
BUILTIN_IF_OSMOUSE = 0,
|
|
||||||
BUILTIN_IF_OSKBD = 1,
|
|
||||||
NUM_BUILTIN_IFS
|
|
||||||
} BuiltinInterface;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These are intentionally the same as the module version macros.
|
|
||||||
* It is possible to register a module as providing a specific interface,
|
|
||||||
* in which case the module's version is used. This feature isn't
|
|
||||||
* really ready for use yet though.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define BUILTIN_INTERFACE_VERSION_NUMERIC(maj, min, patch) \
|
|
||||||
((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
|
|
||||||
#define GET_BUILTIN_INTERFACE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF)
|
|
||||||
#define GET_BUILTIN_INTERFACE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF)
|
|
||||||
#define GET_BUILTIN_INTERFACE_PATCH_VERSION(vers) ((vers) & 0xFFFF)
|
|
||||||
|
|
||||||
#endif /* _XF86STR_H */
|
#endif /* _XF86STR_H */
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
#include "xf86Parser.h"
|
#include "xf86Parser.h"
|
||||||
#include "xf86Config.h"
|
#include "xf86Config.h"
|
||||||
# include "xf86Xinput.h"
|
# include "xf86Xinput.h"
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
#ifdef XV
|
#ifdef XV
|
||||||
#include "xf86xv.h"
|
#include "xf86xv.h"
|
||||||
#include "xf86xvmc.h"
|
#include "xf86xvmc.h"
|
||||||
|
@ -278,7 +277,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
SYMFUNC(xf86SerialModemSetBits)
|
SYMFUNC(xf86SerialModemSetBits)
|
||||||
SYMFUNC(xf86SerialModemClearBits)
|
SYMFUNC(xf86SerialModemClearBits)
|
||||||
SYMFUNC(xf86LoadKernelModule)
|
SYMFUNC(xf86LoadKernelModule)
|
||||||
SYMFUNC(xf86OSMouseInit)
|
|
||||||
SYMFUNC(xf86AgpGARTSupported)
|
SYMFUNC(xf86AgpGARTSupported)
|
||||||
SYMFUNC(xf86GetAGPInfo)
|
SYMFUNC(xf86GetAGPInfo)
|
||||||
SYMFUNC(xf86AcquireGART)
|
SYMFUNC(xf86AcquireGART)
|
||||||
|
@ -644,10 +642,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
|
||||||
SYMFUNC(VidModeGetGammaRampSize)
|
SYMFUNC(VidModeGetGammaRampSize)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* xf86Versions.c */
|
|
||||||
SYMFUNC(xf86GetBuiltinInterfaceVersion)
|
|
||||||
SYMFUNC(xf86RegisterBuiltinInterfaceVersion)
|
|
||||||
|
|
||||||
/* xf86MiscExt.c */
|
/* xf86MiscExt.c */
|
||||||
#ifdef XF86MISC
|
#ifdef XF86MISC
|
||||||
SYMFUNC(MiscExtGetMouseSettings)
|
SYMFUNC(MiscExtGetMouseSettings)
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
|
SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
|
||||||
DIST_SUBDIRS = bsd bus misc linux lynxos solaris sysv sco usl hurd
|
DIST_SUBDIRS = bsd bus misc linux lynxos solaris sysv sco usl hurd
|
||||||
|
|
||||||
sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h \
|
sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h assyntax.h
|
||||||
assyntax.h xf86OSmouse.h
|
|
||||||
|
|
||||||
EXTRA_DIST = int10Defines.h xf86OSpriv.h README.OS-lib
|
EXTRA_DIST = int10Defines.h xf86OSpriv.h README.OS-lib
|
||||||
|
|
||||||
|
|
|
@ -1,222 +0,0 @@
|
||||||
|
|
||||||
README for XFree86 OS-support Layer
|
|
||||||
-----------------------------------
|
|
||||||
|
|
||||||
Contents
|
|
||||||
--------
|
|
||||||
1) Overview
|
|
||||||
2) Directory Layout
|
|
||||||
3) Adding a new OS
|
|
||||||
4) OS Support API
|
|
||||||
|
|
||||||
1 - Overview
|
|
||||||
------------
|
|
||||||
This directory contains the OS support layer functions for the XFree86
|
|
||||||
servers. In addition, some miscellaneous server support functions (not
|
|
||||||
OS-dependent) are included here, to take advantage of the fact that this
|
|
||||||
library comes last in the linking order.
|
|
||||||
|
|
||||||
Most of the functionality required to support a new OS is encapsulated in
|
|
||||||
this library. It is hoped that all OS-specific details can be encapsulated,
|
|
||||||
but that is not likely ever to be completely possible. Hence some minor
|
|
||||||
changes will wind up being made in other parts of the server. The major
|
|
||||||
design principles for this library are maintainability, readability, and
|
|
||||||
portability. Sometimes these goals conflict; some somewhat arbitrary choices
|
|
||||||
have been made in implementation.
|
|
||||||
|
|
||||||
2 - Directory Layout
|
|
||||||
--------------------
|
|
||||||
os-support/ Contains headers and documentation; no code
|
|
||||||
misc/ Non-OS-specific miscellaneous functions that
|
|
||||||
fit best into the link architecture this way.
|
|
||||||
shared/ Contains files with functions used by more than one
|
|
||||||
OS. These are symlinked into the OS subdirectories
|
|
||||||
at build time via Imakefile rules. This is alway
|
|
||||||
preferable to reproducing functions in more than one
|
|
||||||
OS library.
|
|
||||||
bsd/ OS support for the NetBSD/FreeBSD/OpenBSD operating
|
|
||||||
systems.
|
|
||||||
linux/ OS support for the Linux operating system.
|
|
||||||
sco/ OS support for the SCO SVR3.x operating system.
|
|
||||||
solaris/ OS support for the Solaris operating system.
|
|
||||||
sysv/ OS support for all SVR4.0 and SVR4.2, and for
|
|
||||||
ISC and AT&T SVR3.2 operating systems.
|
|
||||||
|
|
||||||
3 - Adding A New OS
|
|
||||||
-------------------
|
|
||||||
Adding a support for a new operating system entails implementing all of
|
|
||||||
the functions described in the API below. Many of these functions are no-ops
|
|
||||||
for many operating systems, and appropriate files with dummy declarations are
|
|
||||||
available in the 'shared' subdirectory.
|
|
||||||
|
|
||||||
If your OS is sufficiently similar to an existing OS, you can make use of
|
|
||||||
the existing subdirectory. One of the reasons for implementing this OS
|
|
||||||
library was the unmaintainability of the spagetti-#ifdef code that existed
|
|
||||||
before. You should try to avoid cluttering the code with #ifdef's. If
|
|
||||||
you find that the subdirectory is getting cluttered, split off into a
|
|
||||||
seperate subdirectory (e.g. as was done for SCO, rather than cluttering
|
|
||||||
the 'sysv' subdirectory). You can split functions out of an existing
|
|
||||||
subdirectory into the 'shared' subdirectory, if that is appropriate. Just
|
|
||||||
remember to update the Imakefile for the old subdirectory.
|
|
||||||
|
|
||||||
You will still likely have to make some small changes to other parts of
|
|
||||||
the server. You should not put OS-specific #define's or #include's anywhere
|
|
||||||
else in the server. These should all go in the "xf86_OSlib.h" header file
|
|
||||||
in this directory.
|
|
||||||
|
|
||||||
4 - OS Support API
|
|
||||||
-----------------
|
|
||||||
void xf86OpenConsole(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Open console device, activate VTs, etc, etc. Fill in requisite
|
|
||||||
* pieces of xf86Info. Most of this code comes from xf86Init.c
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf86CloseConsole(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Close console at server exit.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool xf86VTSwitchPending(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Returns TRUE iff there is a VT switch operation pending for
|
|
||||||
* the server. In the USL VT model, this is indicated via a
|
|
||||||
* signal handler. Should return FALSE always for OSs without
|
|
||||||
* VTs.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool xf86VTSwitchAway(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Handles the OS-specific action for switching away from the active
|
|
||||||
* VT. Returns FALSE if the switch away fails. Should return
|
|
||||||
* FALSE always for OSs without VTs (then again, this function
|
|
||||||
* should never be called in that case).
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool xf86VTSwitchTo(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Handles the OS-specific action for switching to the active VT.
|
|
||||||
* Returns FALSE if the switch to fails. Should return TRUE
|
|
||||||
* always for OSs without VTs (then again, this function should
|
|
||||||
* never be called in that case).
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool xf86LinearVidMem(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Returns TRUE if the OS supports mapping linear frame buffers
|
|
||||||
* (ie memory at addresses above physical memory).
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
pointer xf86MapVidMem(int ScreenNum, pointer Base, unsigned long Size)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Handle mapping the video memory. Returns (pointer *)0 for
|
|
||||||
* failure; causes server exit. It is allowable to call FatalError()
|
|
||||||
* from inside this function and exit directly.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Handle unmapping the video memory. This should undo what
|
|
||||||
* xf86MapVidMem() does. Base is a pointer obtained from
|
|
||||||
* a previous call to xf86MapVidMem().
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf86MapDisplay(int ScreenNum, int Region)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* For OSs that require the screen be mapped when entering a VT.
|
|
||||||
* A dummy function will be defined for OSs that don't require
|
|
||||||
* this (or don't have VTs at all).
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf86UnMapDisplay(int ScreenNum, int Region)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* For Os that require that the screen be unmapped when leaving a
|
|
||||||
* VT. A dummy function will be defined for OSs that don't require
|
|
||||||
* this (or don't have VTs at all).
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
int xf86ReadBIOS(unsigned long Base, unsigned long Offset,
|
|
||||||
unsigned char *Buf, int Len)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Read Len bytes from the BIOS at address Base, offset Offset,
|
|
||||||
* into buffer Buf. Returns -1 for failure or if the OS does
|
|
||||||
* not support reading the BIOS. This causes a driver probe
|
|
||||||
* to fail, but does not cause the server to abort.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void xf86EnableIOPorts(int ScreenNum)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Enables I/O permissions. The OS layer should
|
|
||||||
* enable all I/O port access.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf86DisableIOPorts(int ScreenNum)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Disables I/O permissions.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool xf86DisableInterrupts(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Disable interrupts if allowed for this OS. Returns FALSE if
|
|
||||||
* this is not allowed or if the attempt fails for some reason.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf86EnableInterrupts(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Reenable interrupts
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
int xf86ProcessArgument(int argc, char *argv[], int i)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Process OS-specific command-line arguments. See
|
|
||||||
* ddxProcessArgument() for more info.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void xf86UseMsg(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Print list of OS-specific command-line arguments. See
|
|
||||||
* ddxUseMsg() for more info.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
$XFree86: xc/programs/Xserver/hw/xfree86/os-support/README.OS-lib,v 3.10 2001/12/17 20:00:45 dawes Exp $
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$XConsortium: README.OS-lib /main/5 1996/02/21 17:50:28 kaleb $
|
|
|
@ -1,791 +0,0 @@
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 1999-2003 by The XFree86 Project, Inc.
|
|
||||||
*
|
|
||||||
* 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, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
|
|
||||||
* and author(s) 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 copyright holder(s) and author(s).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Priv.h"
|
|
||||||
#include "xf86_OSlib.h"
|
|
||||||
#include "xf86Xinput.h"
|
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
#include "xisb.h"
|
|
||||||
#include "mipointer.h"
|
|
||||||
#ifdef WSCONS_SUPPORT
|
|
||||||
#include <dev/wscons/wsconsio.h>
|
|
||||||
#endif
|
|
||||||
#ifdef USBMOUSE_SUPPORT
|
|
||||||
#ifdef HAS_LIB_USB_HID
|
|
||||||
#include <usbhid.h>
|
|
||||||
#else
|
|
||||||
#include "usb.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <dev/usb/usb.h>
|
|
||||||
#ifdef USB_GET_REPORT_ID
|
|
||||||
#define USB_NEW_HID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define HUP_GENERIC_DESKTOP 0x0001
|
|
||||||
#define HUP_BUTTON 0x0009
|
|
||||||
|
|
||||||
#define HUG_X 0x0030
|
|
||||||
#define HUG_Y 0x0031
|
|
||||||
#define HUG_Z 0x0032
|
|
||||||
#define HUG_WHEEL 0x0038
|
|
||||||
|
|
||||||
#define HID_USAGE2(p,u) (((p) << 16) | u)
|
|
||||||
|
|
||||||
/* The UMS mices have middle button as number 3 */
|
|
||||||
#define UMS_BUT(i) ((i) == 0 ? 2 : (i) == 1 ? 0 : (i) == 2 ? 1 : (i))
|
|
||||||
#endif /* USBMOUSE_SUPPORT */
|
|
||||||
|
|
||||||
#ifdef USBMOUSE_SUPPORT
|
|
||||||
static void usbSigioReadInput (int fd, void *closure);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
|
||||||
/* These are for FreeBSD and DragonFly */
|
|
||||||
#define DEFAULT_MOUSE_DEV "/dev/mouse"
|
|
||||||
#define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse"
|
|
||||||
#define DEFAULT_PS2_DEV "/dev/psm0"
|
|
||||||
|
|
||||||
static const char *mouseDevs[] = {
|
|
||||||
DEFAULT_MOUSE_DEV,
|
|
||||||
DEFAULT_SYSMOUSE_DEV,
|
|
||||||
DEFAULT_PS2_DEV,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
|
|
||||||
/* Only wsmouse mices are autoconfigured for now on OpenBSD */
|
|
||||||
#define DEFAULT_WSMOUSE_DEV "/dev/wsmouse"
|
|
||||||
#define DEFAULT_WSMOUSE0_DEV "/dev/wsmouse0"
|
|
||||||
|
|
||||||
static const char *mouseDevs[] = {
|
|
||||||
DEFAULT_WSMOUSE_DEV,
|
|
||||||
DEFAULT_WSMOUSE0_DEV,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
|
||||||
SupportedInterfaces(void)
|
|
||||||
{
|
|
||||||
#if defined(__NetBSD__)
|
|
||||||
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO;
|
|
||||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
|
||||||
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_MISC;
|
|
||||||
#else
|
|
||||||
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Names of protocols that are handled internally here. */
|
|
||||||
static const char *internalNames[] = {
|
|
||||||
#if defined(WSCONS_SUPPORT)
|
|
||||||
"WSMouse",
|
|
||||||
#endif
|
|
||||||
#if defined(USBMOUSE_SUPPORT)
|
|
||||||
"usb",
|
|
||||||
#endif
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Names of MSC_MISC protocols that the OS supports. These are decoded by
|
|
||||||
* main "mouse" driver.
|
|
||||||
*/
|
|
||||||
static const char *miscNames[] = {
|
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
|
||||||
"SysMouse",
|
|
||||||
#endif
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char **
|
|
||||||
BuiltinNames(void)
|
|
||||||
{
|
|
||||||
return internalNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
CheckProtocol(const char *protocol)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; internalNames[i]; i++)
|
|
||||||
if (xf86NameCmp(protocol, internalNames[i]) == 0)
|
|
||||||
return TRUE;
|
|
||||||
for (i = 0; miscNames[i]; i++)
|
|
||||||
if (xf86NameCmp(protocol, miscNames[i]) == 0)
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
DefaultProtocol(void)
|
|
||||||
{
|
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
|
||||||
return "Auto";
|
|
||||||
#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
|
|
||||||
return "WSMouse";
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE)
|
|
||||||
static struct {
|
|
||||||
int dproto;
|
|
||||||
const char *name;
|
|
||||||
} devproto[] = {
|
|
||||||
{ MOUSE_PROTO_MS, "Microsoft" },
|
|
||||||
{ MOUSE_PROTO_MSC, "MouseSystems" },
|
|
||||||
{ MOUSE_PROTO_LOGI, "Logitech" },
|
|
||||||
{ MOUSE_PROTO_MM, "MMSeries" },
|
|
||||||
{ MOUSE_PROTO_LOGIMOUSEMAN, "MouseMan" },
|
|
||||||
{ MOUSE_PROTO_BUS, "BusMouse" },
|
|
||||||
{ MOUSE_PROTO_INPORT, "BusMouse" },
|
|
||||||
{ MOUSE_PROTO_PS2, "PS/2" },
|
|
||||||
{ MOUSE_PROTO_HITTAB, "MMHitTab" },
|
|
||||||
{ MOUSE_PROTO_GLIDEPOINT, "GlidePoint" },
|
|
||||||
{ MOUSE_PROTO_INTELLI, "Intellimouse" },
|
|
||||||
{ MOUSE_PROTO_THINK, "ThinkingMouse" },
|
|
||||||
{ MOUSE_PROTO_SYSMOUSE, "SysMouse" }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
SetupAuto(InputInfoPtr pInfo, int *protoPara)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
mousehw_t hw;
|
|
||||||
mousemode_t mode;
|
|
||||||
|
|
||||||
if (pInfo->fd == -1)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* set the driver operation level, if applicable */
|
|
||||||
i = 1;
|
|
||||||
ioctl(pInfo->fd, MOUSE_SETLEVEL, &i);
|
|
||||||
|
|
||||||
/* interrogate the driver and get some intelligence on the device. */
|
|
||||||
hw.iftype = MOUSE_IF_UNKNOWN;
|
|
||||||
hw.model = MOUSE_MODEL_GENERIC;
|
|
||||||
ioctl(pInfo->fd, MOUSE_GETHWINFO, &hw);
|
|
||||||
xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: hw.iftype is %d, hw.model is %d\n",
|
|
||||||
pInfo->name, hw.iftype, hw.model);
|
|
||||||
if (ioctl(pInfo->fd, MOUSE_GETMODE, &mode) == 0) {
|
|
||||||
for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); ++i) {
|
|
||||||
if (mode.protocol == devproto[i].dproto) {
|
|
||||||
/* override some parameters */
|
|
||||||
if (protoPara) {
|
|
||||||
protoPara[4] = mode.packetsize;
|
|
||||||
protoPara[0] = mode.syncmask[0];
|
|
||||||
protoPara[1] = mode.syncmask[1];
|
|
||||||
}
|
|
||||||
xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
|
|
||||||
pInfo->name, devproto[i].name);
|
|
||||||
return devproto[i].name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
SetSysMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res)
|
|
||||||
{
|
|
||||||
mousemode_t mode;
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
|
|
||||||
pMse = pInfo->private;
|
|
||||||
|
|
||||||
mode.rate = rate > 0 ? rate : -1;
|
|
||||||
mode.resolution = res > 0 ? res : -1;
|
|
||||||
mode.accelfactor = -1;
|
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
|
||||||
if (pMse->autoProbe ||
|
|
||||||
(protocol && xf86NameCmp(protocol, "SysMouse") == 0)) {
|
|
||||||
/*
|
|
||||||
* As the FreeBSD sysmouse driver defaults to protocol level 0
|
|
||||||
* everytime it is opened we enforce protocol level 1 again at
|
|
||||||
* this point.
|
|
||||||
*/
|
|
||||||
mode.level = 1;
|
|
||||||
} else
|
|
||||||
mode.level = -1;
|
|
||||||
#else
|
|
||||||
mode.level = -1;
|
|
||||||
#endif
|
|
||||||
ioctl(pInfo->fd, MOUSE_SETMODE, &mode);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
|
||||||
|
|
||||||
#define MOUSED_PID_FILE "/var/run/moused.pid"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Try to check if moused is running. DEFAULT_SYSMOUSE_DEV is useless without
|
|
||||||
* it. There doesn't seem to be a better way of checking.
|
|
||||||
*/
|
|
||||||
static Bool
|
|
||||||
MousedRunning(void)
|
|
||||||
{
|
|
||||||
FILE *f = NULL;
|
|
||||||
unsigned int pid;
|
|
||||||
|
|
||||||
if ((f = fopen(MOUSED_PID_FILE, "r")) != NULL) {
|
|
||||||
if (fscanf(f, "%u", &pid) == 1 && pid > 0) {
|
|
||||||
if (kill(pid, 0) == 0) {
|
|
||||||
fclose(f);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(f);
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
int fd = -1;
|
|
||||||
const char **pdev, *dev = NULL;
|
|
||||||
Bool devMouse = FALSE;
|
|
||||||
struct stat devMouseStat;
|
|
||||||
struct stat sb;
|
|
||||||
|
|
||||||
for (pdev = mouseDevs; *pdev; pdev++) {
|
|
||||||
SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
|
|
||||||
if (fd == -1) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* /dev/mouse is held until checks for matches with other devices
|
|
||||||
* are done. This is so that when it points to /dev/sysmouse,
|
|
||||||
* the test for whether /dev/sysmouse is usable can be made.
|
|
||||||
*/
|
|
||||||
if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) {
|
|
||||||
if (fstat(fd, &devMouseStat) == 0)
|
|
||||||
devMouse = TRUE;
|
|
||||||
close(fd);
|
|
||||||
continue;
|
|
||||||
} else if (!strcmp(*pdev, DEFAULT_SYSMOUSE_DEV)) {
|
|
||||||
/* Check if /dev/mouse is the same as /dev/sysmouse. */
|
|
||||||
if (devMouse && fstat(fd, &sb) == 0 &&
|
|
||||||
devMouseStat.st_dev == sb.st_dev &&
|
|
||||||
devMouseStat.st_ino == sb.st_ino) {
|
|
||||||
/* If the same, use /dev/sysmouse. */
|
|
||||||
devMouse = FALSE;
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
if (MousedRunning())
|
|
||||||
break;
|
|
||||||
else {
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("moused isn't running\n");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
close(fd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*pdev)
|
|
||||||
dev = *pdev;
|
|
||||||
else if (devMouse)
|
|
||||||
dev = DEFAULT_MOUSE_DEV;
|
|
||||||
|
|
||||||
if (dev) {
|
|
||||||
/* Set the Device option. */
|
|
||||||
pInfo->conf_idev->commonOptions =
|
|
||||||
xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", dev);
|
|
||||||
xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
|
|
||||||
pInfo->name, dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
return *pdev;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
|
|
||||||
|
|
||||||
/* Only support wsmouse configuration for now */
|
|
||||||
static const char *
|
|
||||||
SetupAuto(InputInfoPtr pInfo, int *protoPara)
|
|
||||||
{
|
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 3, "%s: SetupAuto: protocol is %s\n",
|
|
||||||
pInfo->name, "wsmouse");
|
|
||||||
return "wsmouse";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
SetMouseRes(InputInfoPtr pInfo, const char *protocol, int rate, int res)
|
|
||||||
{
|
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 3, "%s: SetMouseRes: protocol %s rate %d res %d\n",
|
|
||||||
pInfo->name, protocol, rate, res);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
int fd = -1;
|
|
||||||
const char **pdev;
|
|
||||||
|
|
||||||
for (pdev = mouseDevs; *pdev; pdev++) {
|
|
||||||
SYSCALL(fd = open(*pdev, O_RDWR | O_NONBLOCK));
|
|
||||||
if (fd != -1) {
|
|
||||||
/* Set the Device option. */
|
|
||||||
pInfo->conf_idev->commonOptions =
|
|
||||||
xf86AddNewOption(pInfo->conf_idev->commonOptions,
|
|
||||||
"Device", *pdev);
|
|
||||||
xf86Msg(X_INFO, "%s: found Device \"%s\"\n",
|
|
||||||
pInfo->name, *pdev);
|
|
||||||
close(fd);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return *pdev;
|
|
||||||
}
|
|
||||||
#endif /* __OpenBSD__ || __NetBSD__ && WSCONS_SUPPORT */
|
|
||||||
|
|
||||||
#ifdef WSCONS_SUPPORT
|
|
||||||
#define NUMEVENTS 64
|
|
||||||
|
|
||||||
static void
|
|
||||||
wsconsReadInput(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
static struct wscons_event eventList[NUMEVENTS];
|
|
||||||
int n, c;
|
|
||||||
struct wscons_event *event = eventList;
|
|
||||||
unsigned char *pBuf;
|
|
||||||
|
|
||||||
pMse = pInfo->private;
|
|
||||||
|
|
||||||
XisbBlockDuration(pMse->buffer, -1);
|
|
||||||
pBuf = (unsigned char *)eventList;
|
|
||||||
n = 0;
|
|
||||||
while (n < sizeof(eventList) && (c = XisbRead(pMse->buffer)) >= 0) {
|
|
||||||
pBuf[n++] = (unsigned char)c;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
n /= sizeof(struct wscons_event);
|
|
||||||
while( n-- ) {
|
|
||||||
int buttons = pMse->lastButtons;
|
|
||||||
int dx = 0, dy = 0, dz = 0, dw = 0;
|
|
||||||
switch (event->type) {
|
|
||||||
case WSCONS_EVENT_MOUSE_UP:
|
|
||||||
#define BUTBIT (1 << (event->value <= 2 ? 2 - event->value : event->value))
|
|
||||||
buttons &= ~BUTBIT;
|
|
||||||
break;
|
|
||||||
case WSCONS_EVENT_MOUSE_DOWN:
|
|
||||||
buttons |= BUTBIT;
|
|
||||||
break;
|
|
||||||
case WSCONS_EVENT_MOUSE_DELTA_X:
|
|
||||||
dx = event->value;
|
|
||||||
break;
|
|
||||||
case WSCONS_EVENT_MOUSE_DELTA_Y:
|
|
||||||
dy = -event->value;
|
|
||||||
break;
|
|
||||||
#ifdef WSCONS_EVENT_MOUSE_DELTA_Z
|
|
||||||
case WSCONS_EVENT_MOUSE_DELTA_Z:
|
|
||||||
dz = event->value;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
xf86Msg(X_WARNING, "%s: bad wsmouse event type=%d\n", pInfo->name,
|
|
||||||
event->type);
|
|
||||||
++event;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
|
|
||||||
++event;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* This function is called when the protocol is "wsmouse". */
|
|
||||||
static Bool
|
|
||||||
wsconsPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse = pInfo->private;
|
|
||||||
|
|
||||||
pMse->protocol = protocol;
|
|
||||||
xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
|
|
||||||
|
|
||||||
/* Collect the options, and process the common options. */
|
|
||||||
xf86CollectInputOptions(pInfo, NULL, NULL);
|
|
||||||
xf86ProcessCommonOptions(pInfo, pInfo->options);
|
|
||||||
|
|
||||||
/* Check if the device can be opened. */
|
|
||||||
pInfo->fd = xf86OpenSerial(pInfo->options);
|
|
||||||
if (pInfo->fd == -1) {
|
|
||||||
if (xf86GetAllowMouseOpenFail())
|
|
||||||
xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
|
|
||||||
else {
|
|
||||||
xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
|
|
||||||
xfree(pMse);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xf86CloseSerial(pInfo->fd);
|
|
||||||
pInfo->fd = -1;
|
|
||||||
|
|
||||||
/* Process common mouse options (like Emulate3Buttons, etc). */
|
|
||||||
pMse->CommonOptions(pInfo);
|
|
||||||
|
|
||||||
/* Setup the local input proc. */
|
|
||||||
pInfo->read_input = wsconsReadInput;
|
|
||||||
pMse->xisbscale = sizeof(struct wscons_event);
|
|
||||||
|
|
||||||
pInfo->flags |= XI86_CONFIGURED;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(USBMOUSE_SUPPORT)
|
|
||||||
|
|
||||||
typedef struct _UsbMseRec {
|
|
||||||
int packetSize;
|
|
||||||
int iid;
|
|
||||||
hid_item_t loc_x; /* x locator item */
|
|
||||||
hid_item_t loc_y; /* y locator item */
|
|
||||||
hid_item_t loc_z; /* z (wheel) locator item */
|
|
||||||
hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */
|
|
||||||
unsigned char *buffer;
|
|
||||||
} UsbMseRec, *UsbMsePtr;
|
|
||||||
|
|
||||||
static int
|
|
||||||
usbMouseProc(DeviceIntPtr pPointer, int what)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo;
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
UsbMsePtr pUsbMse;
|
|
||||||
unsigned char map[MSE_MAXBUTTONS + 1];
|
|
||||||
int nbuttons;
|
|
||||||
|
|
||||||
pInfo = pPointer->public.devicePrivate;
|
|
||||||
pMse = pInfo->private;
|
|
||||||
pMse->device = pPointer;
|
|
||||||
pUsbMse = pMse->mousePriv;
|
|
||||||
|
|
||||||
switch (what) {
|
|
||||||
case DEVICE_INIT:
|
|
||||||
pPointer->public.on = FALSE;
|
|
||||||
|
|
||||||
for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons)
|
|
||||||
map[nbuttons + 1] = nbuttons + 1;
|
|
||||||
|
|
||||||
InitPointerDeviceStruct((DevicePtr)pPointer,
|
|
||||||
map,
|
|
||||||
min(pMse->buttons, MSE_MAXBUTTONS),
|
|
||||||
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);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEVICE_ON:
|
|
||||||
pInfo->fd = xf86OpenSerial(pInfo->options);
|
|
||||||
if (pInfo->fd == -1)
|
|
||||||
xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
|
|
||||||
else {
|
|
||||||
pMse->buffer = XisbNew(pInfo->fd, pUsbMse->packetSize);
|
|
||||||
if (!pMse->buffer) {
|
|
||||||
xfree(pMse);
|
|
||||||
xf86CloseSerial(pInfo->fd);
|
|
||||||
pInfo->fd = -1;
|
|
||||||
} else {
|
|
||||||
xf86FlushInput(pInfo->fd);
|
|
||||||
if (!xf86InstallSIGIOHandler (pInfo->fd, usbSigioReadInput,
|
|
||||||
pInfo))
|
|
||||||
AddEnabledDevice(pInfo->fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pMse->lastButtons = 0;
|
|
||||||
pMse->lastMappedButtons = 0;
|
|
||||||
pMse->emulateState = 0;
|
|
||||||
pPointer->public.on = TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEVICE_OFF:
|
|
||||||
case DEVICE_CLOSE:
|
|
||||||
if (pInfo->fd != -1) {
|
|
||||||
RemoveEnabledDevice(pInfo->fd);
|
|
||||||
if (pUsbMse->packetSize > 8 && pUsbMse->buffer) {
|
|
||||||
xfree(pUsbMse->buffer);
|
|
||||||
}
|
|
||||||
if (pMse->buffer) {
|
|
||||||
XisbFree(pMse->buffer);
|
|
||||||
pMse->buffer = NULL;
|
|
||||||
}
|
|
||||||
xf86CloseSerial(pInfo->fd);
|
|
||||||
pInfo->fd = -1;
|
|
||||||
}
|
|
||||||
pPointer->public.on = FALSE;
|
|
||||||
usleep(300000);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
usbReadInput(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
UsbMsePtr pUsbMse;
|
|
||||||
int buttons = pMse->lastButtons;
|
|
||||||
int dx = 0, dy = 0, dz = 0, dw = 0;
|
|
||||||
int n, c;
|
|
||||||
unsigned char *pBuf;
|
|
||||||
|
|
||||||
pMse = pInfo->private;
|
|
||||||
pUsbMse = pMse->mousePriv;
|
|
||||||
|
|
||||||
XisbBlockDuration(pMse->buffer, -1);
|
|
||||||
pBuf = pUsbMse->buffer;
|
|
||||||
n = 0;
|
|
||||||
while ((c = XisbRead(pMse->buffer)) >= 0 && n < pUsbMse->packetSize) {
|
|
||||||
pBuf[n++] = (unsigned char)c;
|
|
||||||
}
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
if (n != pUsbMse->packetSize) {
|
|
||||||
xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n", pInfo->name,
|
|
||||||
n);
|
|
||||||
}
|
|
||||||
/* discard packets with an id that don't match the mouse */
|
|
||||||
/* XXX this is probably not the right thing */
|
|
||||||
if (pUsbMse->iid != 0) {
|
|
||||||
if (*pBuf++ != pUsbMse->iid)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
dx = hid_get_data(pBuf, &pUsbMse->loc_x);
|
|
||||||
dy = hid_get_data(pBuf, &pUsbMse->loc_y);
|
|
||||||
dz = hid_get_data(pBuf, &pUsbMse->loc_z);
|
|
||||||
|
|
||||||
buttons = 0;
|
|
||||||
for (n = 0; n < pMse->buttons; n++) {
|
|
||||||
if (hid_get_data(pBuf, &pUsbMse->loc_btn[n]))
|
|
||||||
buttons |= (1 << UMS_BUT(n));
|
|
||||||
}
|
|
||||||
pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
usbSigioReadInput (int fd, void *closure)
|
|
||||||
{
|
|
||||||
usbReadInput ((InputInfoPtr) closure);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function is called when the protocol is "usb". */
|
|
||||||
static Bool
|
|
||||||
usbPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse = pInfo->private;
|
|
||||||
UsbMsePtr pUsbMse;
|
|
||||||
report_desc_t reportDesc;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
pUsbMse = xalloc(sizeof(UsbMseRec));
|
|
||||||
if (pUsbMse == NULL) {
|
|
||||||
xf86Msg(X_ERROR, "%s: cannot allocate UsbMouseRec\n", pInfo->name);
|
|
||||||
xfree(pMse);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pMse->protocol = protocol;
|
|
||||||
xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
|
|
||||||
|
|
||||||
/* Collect the options, and process the common options. */
|
|
||||||
xf86CollectInputOptions(pInfo, NULL, NULL);
|
|
||||||
xf86ProcessCommonOptions(pInfo, pInfo->options);
|
|
||||||
|
|
||||||
/* Check if the device can be opened. */
|
|
||||||
pInfo->fd = xf86OpenSerial(pInfo->options);
|
|
||||||
if (pInfo->fd == -1) {
|
|
||||||
if (xf86GetAllowMouseOpenFail())
|
|
||||||
xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
|
|
||||||
else {
|
|
||||||
xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
|
|
||||||
xfree(pUsbMse);
|
|
||||||
xfree(pMse);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Get USB informations */
|
|
||||||
reportDesc = hid_get_report_desc(pInfo->fd);
|
|
||||||
/* Get packet size & iid */
|
|
||||||
#ifdef USB_NEW_HID
|
|
||||||
if (ioctl(pInfo->fd, USB_GET_REPORT_ID, &pUsbMse->iid) == -1) {
|
|
||||||
xf86Msg(X_ERROR, "Error ioctl USB_GET_REPORT_ID on %s : %s\n",
|
|
||||||
pInfo->name, strerror(errno));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
pUsbMse->packetSize = hid_report_size(reportDesc, hid_input,
|
|
||||||
pUsbMse->iid);
|
|
||||||
#else
|
|
||||||
pUsbMse->packetSize = hid_report_size(reportDesc, hid_input,
|
|
||||||
&pUsbMse->iid);
|
|
||||||
#endif
|
|
||||||
/* Allocate buffer */
|
|
||||||
if (pUsbMse->packetSize <= 8) {
|
|
||||||
pUsbMse->buffer = pMse->protoBuf;
|
|
||||||
} else {
|
|
||||||
pUsbMse->buffer = xalloc(pUsbMse->packetSize);
|
|
||||||
}
|
|
||||||
if (pUsbMse->buffer == NULL) {
|
|
||||||
xf86Msg(X_ERROR, "%s: cannot allocate buffer\n", pInfo->name);
|
|
||||||
xfree(pUsbMse);
|
|
||||||
xfree(pMse);
|
|
||||||
xf86CloseSerial(pInfo->fd);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
#ifdef USB_NEW_HID
|
|
||||||
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X),
|
|
||||||
hid_input, &pUsbMse->loc_x, pUsbMse->iid) < 0) {
|
|
||||||
xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name);
|
|
||||||
}
|
|
||||||
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y),
|
|
||||||
hid_input, &pUsbMse->loc_y, pUsbMse->iid) < 0) {
|
|
||||||
xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name);
|
|
||||||
}
|
|
||||||
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
|
|
||||||
hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) {
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X),
|
|
||||||
hid_input, &pUsbMse->loc_x) < 0) {
|
|
||||||
xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name);
|
|
||||||
}
|
|
||||||
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y),
|
|
||||||
hid_input, &pUsbMse->loc_y) < 0) {
|
|
||||||
xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name);
|
|
||||||
}
|
|
||||||
if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
|
|
||||||
hid_input, &pUsbMse->loc_z) < 0) {
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* Probe for number of buttons */
|
|
||||||
for (i = 1; i <= MSE_MAXBUTTONS; i++) {
|
|
||||||
if (!hid_locate(reportDesc, HID_USAGE2(HUP_BUTTON, i),
|
|
||||||
hid_input, &pUsbMse->loc_btn[i-1]
|
|
||||||
#ifdef USB_NEW_HID
|
|
||||||
, pUsbMse->iid
|
|
||||||
#endif
|
|
||||||
))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pMse->buttons = i-1;
|
|
||||||
|
|
||||||
xf86CloseSerial(pInfo->fd);
|
|
||||||
pInfo->fd = -1;
|
|
||||||
|
|
||||||
/* Private structure */
|
|
||||||
pMse->mousePriv = pUsbMse;
|
|
||||||
|
|
||||||
/* Process common mouse options (like Emulate3Buttons, etc). */
|
|
||||||
pMse->CommonOptions(pInfo);
|
|
||||||
|
|
||||||
/* Setup the local procs. */
|
|
||||||
pInfo->device_control = usbMouseProc;
|
|
||||||
pInfo->read_input = usbReadInput;
|
|
||||||
|
|
||||||
pInfo->flags |= XI86_CONFIGURED;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
#endif /* USBMOUSE */
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
bsdMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
/* The protocol is guaranteed to be one of the internalNames[] */
|
|
||||||
#ifdef WSCONS_SUPPORT
|
|
||||||
if (xf86NameCmp(protocol, "WSMouse") == 0) {
|
|
||||||
return wsconsPreInit(pInfo, protocol, flags);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef USBMOUSE_SUPPORT
|
|
||||||
if (xf86NameCmp(protocol, "usb") == 0) {
|
|
||||||
return usbPreInit(pInfo, protocol, flags);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT OSMouseInfoPtr
|
|
||||||
xf86OSMouseInit(int flags)
|
|
||||||
{
|
|
||||||
OSMouseInfoPtr p;
|
|
||||||
|
|
||||||
p = xcalloc(sizeof(OSMouseInfoRec), 1);
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
p->SupportedInterfaces = SupportedInterfaces;
|
|
||||||
p->BuiltinNames = BuiltinNames;
|
|
||||||
p->DefaultProtocol = DefaultProtocol;
|
|
||||||
p->CheckProtocol = CheckProtocol;
|
|
||||||
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE)
|
|
||||||
p->SetupAuto = SetupAuto;
|
|
||||||
p->SetPS2Res = SetSysMouseRes;
|
|
||||||
p->SetBMRes = SetSysMouseRes;
|
|
||||||
p->SetMiscRes = SetSysMouseRes;
|
|
||||||
#endif
|
|
||||||
#if (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT)
|
|
||||||
p->SetupAuto = SetupAuto;
|
|
||||||
p->SetMiscRes = SetMouseRes;
|
|
||||||
#endif
|
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
|
|
||||||
p->FindDevice = FindDevice;
|
|
||||||
#endif
|
|
||||||
p->PreInit = bsdMousePreInit;
|
|
||||||
return p;
|
|
||||||
}
|
|
|
@ -1,242 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 1997,1998 by UCHIYAMA Yasushi
|
|
||||||
*
|
|
||||||
* 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 UCHIYAMA Yasushi not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the software without
|
|
||||||
* specific, written prior permission. UCHIYAMA Yasushi makes no representations
|
|
||||||
* about the suitability of this software for any purpose. It is provided
|
|
||||||
* "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL UCHIYAMA YASUSHI 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 NEED_EVENTS
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "inputstr.h"
|
|
||||||
#include "scrnintstr.h"
|
|
||||||
#include "mipointer.h"
|
|
||||||
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Xinput.h"
|
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
#include "xf86_OSlib.h"
|
|
||||||
#include "xisb.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/file.h>
|
|
||||||
#include <assert.h>
|
|
||||||
#include <mach.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
|
|
||||||
#define DEFAULT_MOUSE_DEV "/dev/mouse"
|
|
||||||
|
|
||||||
typedef unsigned short kev_type; /* kd event type */
|
|
||||||
typedef unsigned char Scancode;
|
|
||||||
|
|
||||||
struct mouse_motion {
|
|
||||||
short mm_deltaX; /* units? */
|
|
||||||
short mm_deltaY;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
kev_type type; /* see below */
|
|
||||||
struct timeval time; /* timestamp */
|
|
||||||
union { /* value associated with event */
|
|
||||||
boolean_t up; /* MOUSE_LEFT .. MOUSE_RIGHT */
|
|
||||||
Scancode sc; /* KEYBD_EVENT */
|
|
||||||
struct mouse_motion mmotion; /* MOUSE_MOTION */
|
|
||||||
} value;
|
|
||||||
} kd_event;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* kd_event ID's.
|
|
||||||
*/
|
|
||||||
#define MOUSE_LEFT 1 /* mouse left button up/down */
|
|
||||||
#define MOUSE_MIDDLE 2
|
|
||||||
#define MOUSE_RIGHT 3
|
|
||||||
#define MOUSE_MOTION 4 /* mouse motion */
|
|
||||||
#define KEYBD_EVENT 5 /* key up/down */
|
|
||||||
|
|
||||||
#define NUMEVENTS 64
|
|
||||||
|
|
||||||
/*
|
|
||||||
* OsMouseReadInput --
|
|
||||||
* Get some events from our queue. Process all outstanding events now.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
OsMouseReadInput(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
static kd_event eventList[NUMEVENTS];
|
|
||||||
int n, c;
|
|
||||||
kd_event *event = eventList;
|
|
||||||
unsigned char *pBuf;
|
|
||||||
|
|
||||||
pMse = pInfo->private;
|
|
||||||
|
|
||||||
XisbBlockDuration(pMse->buffer, -1);
|
|
||||||
pBuf = (unsigned char *)eventList;
|
|
||||||
n = 0;
|
|
||||||
while ((c = XisbRead(pMse->buffer)) >= 0 && n < sizeof(eventList))
|
|
||||||
pBuf[n++] = (unsigned char)c;
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
n /= sizeof(kd_event);
|
|
||||||
while( n-- ) {
|
|
||||||
int buttons = pMse->lastButtons;
|
|
||||||
int dx = 0, dy = 0;
|
|
||||||
switch (event->type) {
|
|
||||||
case MOUSE_RIGHT:
|
|
||||||
buttons = buttons & 6 |(event->value.up ? 0 : 1);
|
|
||||||
break;
|
|
||||||
case MOUSE_MIDDLE:
|
|
||||||
buttons = buttons & 5 |(event->value.up ? 0 : 2);
|
|
||||||
break;
|
|
||||||
case MOUSE_LEFT:
|
|
||||||
buttons = buttons & 3 |(event->value.up ? 0 : 4) ;
|
|
||||||
break;
|
|
||||||
case MOUSE_MOTION:
|
|
||||||
dx = event->value.mmotion.mm_deltaX;
|
|
||||||
dy = - event->value.mmotion.mm_deltaY;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ErrorF("Bad mouse event (%d)\n",event->type);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pMse->PostEvent(pInfo, buttons, dx, dy, 0, 0);
|
|
||||||
++event;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
|
|
||||||
/* This is called when the protocol is "OSMouse". */
|
|
||||||
|
|
||||||
pMse = pInfo->private;
|
|
||||||
pMse->protocol = protocol;
|
|
||||||
xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
|
|
||||||
|
|
||||||
/* Collect the options, and process the common options. */
|
|
||||||
xf86CollectInputOptions(pInfo, NULL, NULL);
|
|
||||||
xf86ProcessCommonOptions(pInfo, pInfo->options);
|
|
||||||
|
|
||||||
/* Check if the device can be opened. */
|
|
||||||
pInfo->fd = xf86OpenSerial(pInfo->options);
|
|
||||||
if (pInfo->fd == -1) {
|
|
||||||
if (xf86GetAllowMouseOpenFail())
|
|
||||||
xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
|
|
||||||
else {
|
|
||||||
xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
|
|
||||||
xfree(pMse);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xf86CloseSerial(pInfo->fd);
|
|
||||||
pInfo->fd = -1;
|
|
||||||
|
|
||||||
/* Process common mouse options (like Emulate3Buttons, etc). */
|
|
||||||
pMse->CommonOptions(pInfo);
|
|
||||||
|
|
||||||
/* Setup the local procs. */
|
|
||||||
pInfo->read_input = OsMouseReadInput;
|
|
||||||
|
|
||||||
pInfo->flags |= XI86_CONFIGURED;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
const char path[] = DEFAULT_MOUSE_DEV;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
SYSCALL (fd = open(path, O_RDWR | O_NONBLOCK | O_EXCL));
|
|
||||||
|
|
||||||
if (fd == -1)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
pInfo->conf_idev->commonOptions =
|
|
||||||
xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", path);
|
|
||||||
xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n", pInfo->name,
|
|
||||||
path);
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
SupportedInterfaces(void)
|
|
||||||
{
|
|
||||||
/* XXX Need to check this. */
|
|
||||||
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *internalNames[] = {
|
|
||||||
"OSMouse",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char **
|
|
||||||
BuiltinNames(void)
|
|
||||||
{
|
|
||||||
return internalNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
CheckProtocol(const char *protocol)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; internalNames[i]; i++)
|
|
||||||
if (xf86NameCmp(protocol, internalNames[i]) == 0)
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
DefaultProtocol(void)
|
|
||||||
{
|
|
||||||
return "OSMouse";
|
|
||||||
}
|
|
||||||
|
|
||||||
OSMouseInfoPtr
|
|
||||||
xf86OSMouseInit(int flags)
|
|
||||||
{
|
|
||||||
OSMouseInfoPtr p;
|
|
||||||
|
|
||||||
p = xcalloc(sizeof(OSMouseInfoRec), 1);
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
p->SupportedInterfaces = SupportedInterfaces;
|
|
||||||
p->BuiltinNames = BuiltinNames;
|
|
||||||
p->FindDevice = FindDevice;
|
|
||||||
p->DefaultProtocol = DefaultProtocol;
|
|
||||||
p->CheckProtocol = CheckProtocol;
|
|
||||||
p->PreInit = OsMousePreInit;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ APM_SRCS = lnx_apm.c
|
||||||
XORG_CFLAGS += -DHAVE_APM
|
XORG_CFLAGS += -DHAVE_APM
|
||||||
endif
|
endif
|
||||||
|
|
||||||
liblinux_la_SOURCES = lnx_init.c lnx_video.c lnx_mouse.c \
|
liblinux_la_SOURCES = lnx_init.c lnx_video.c \
|
||||||
lnx_pci.c lnx_agp.c lnx_kmod.c lnx_bell.c \
|
lnx_pci.c lnx_agp.c lnx_kmod.c lnx_bell.c \
|
||||||
$(srcdir)/../shared/bios_mmap.c \
|
$(srcdir)/../shared/bios_mmap.c \
|
||||||
$(srcdir)/../shared/VTsw_usl.c \
|
$(srcdir)/../shared/VTsw_usl.c \
|
||||||
|
|
|
@ -1,221 +0,0 @@
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 1999 by The XFree86 Project, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Xinput.h"
|
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
#include "xf86_OSlib.h"
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
static int
|
|
||||||
SupportedInterfaces(void)
|
|
||||||
{
|
|
||||||
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
DefaultProtocol(void)
|
|
||||||
{
|
|
||||||
return "Auto";
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFAULT_MOUSE_DEV "/dev/input/mice"
|
|
||||||
#define DEFAULT_PS2_DEV "/dev/psaux"
|
|
||||||
#define DEFAULT_GPM_DATA_DEV "/dev/gpmdata"
|
|
||||||
#define DEFAULT_GPM_CTL_DEV "/dev/gpmdata"
|
|
||||||
|
|
||||||
static const char *mouseDevs[] = {
|
|
||||||
DEFAULT_MOUSE_DEV,
|
|
||||||
DEFAULT_PS2_DEV,
|
|
||||||
DEFAULT_GPM_DATA_DEV,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
MOUSE_PROTO_UNKNOWN = 0,
|
|
||||||
MOUSE_PROTO_SERIAL,
|
|
||||||
MOUSE_PROTO_PS2,
|
|
||||||
MOUSE_PROTO_MSC,
|
|
||||||
MOUSE_PROTO_GPM,
|
|
||||||
MOUSE_PROTO_EXPPS2,
|
|
||||||
} protocolTypes;
|
|
||||||
|
|
||||||
static struct {
|
|
||||||
protocolTypes proto;
|
|
||||||
const char *name;
|
|
||||||
} devproto[] = {
|
|
||||||
{ MOUSE_PROTO_UNKNOWN, NULL },
|
|
||||||
{ MOUSE_PROTO_PS2, "PS/2" },
|
|
||||||
{ MOUSE_PROTO_MSC, "MouseSystems" },
|
|
||||||
{ MOUSE_PROTO_GPM, "GPM" },
|
|
||||||
{ MOUSE_PROTO_EXPPS2, "ExplorerPS/2" },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
int fd = -1;
|
|
||||||
const char **pdev;
|
|
||||||
|
|
||||||
for (pdev = mouseDevs; *pdev; pdev++) {
|
|
||||||
SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK | O_EXCL));
|
|
||||||
if (fd == -1) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("Cannot open %s (%s)\n", *pdev, strerror(errno));
|
|
||||||
#endif
|
|
||||||
} else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*pdev) {
|
|
||||||
close(fd);
|
|
||||||
/* Set the Device option. */
|
|
||||||
pInfo->conf_idev->commonOptions =
|
|
||||||
xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", *pdev);
|
|
||||||
xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
|
|
||||||
pInfo->name, *pdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
return *pdev;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
lnxMouseMagic(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
int fd = -1;
|
|
||||||
const char *dev;
|
|
||||||
char *realdev;
|
|
||||||
struct stat sbuf;
|
|
||||||
int i;
|
|
||||||
int proto = MOUSE_PROTO_UNKNOWN;
|
|
||||||
|
|
||||||
dev = xf86SetStrOption(pInfo->conf_idev->commonOptions, "Device", NULL);
|
|
||||||
if (!dev) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("xf86SetStrOption failed to return the device name\n");
|
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
/* Look at the device name to guess the protocol. */
|
|
||||||
realdev = NULL;
|
|
||||||
if (strcmp(dev, DEFAULT_MOUSE_DEV) == 0) {
|
|
||||||
if (lstat(dev, &sbuf) != 0) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("lstat failed for %s (%s)\n", dev, strerror(errno));
|
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (S_ISLNK(sbuf.st_mode)) {
|
|
||||||
realdev = xnfalloc(PATH_MAX + 1);
|
|
||||||
i = readlink(dev, realdev, PATH_MAX);
|
|
||||||
if (i <= 0) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("readlink failed for %s (%s)\n", dev, strerror(errno));
|
|
||||||
#endif
|
|
||||||
xfree(realdev);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
realdev[i] = '\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!realdev)
|
|
||||||
realdev = xnfstrdup(dev);
|
|
||||||
else {
|
|
||||||
/* If realdev doesn't contain a '/' then prepend "/dev/" */
|
|
||||||
if (!strchr(realdev, '/')) {
|
|
||||||
char *tmp = xnfalloc(strlen(realdev) + 5 + 1);
|
|
||||||
sprintf(tmp, "/dev/%s", realdev);
|
|
||||||
xfree(realdev);
|
|
||||||
realdev = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(realdev, DEFAULT_MOUSE_DEV) == 0)
|
|
||||||
proto = MOUSE_PROTO_EXPPS2;
|
|
||||||
else if (strcmp(realdev, DEFAULT_PS2_DEV) == 0)
|
|
||||||
proto = MOUSE_PROTO_EXPPS2;
|
|
||||||
else if (strcmp(realdev, DEFAULT_GPM_DATA_DEV) == 0)
|
|
||||||
proto = MOUSE_PROTO_MSC;
|
|
||||||
else if (strcmp(realdev, DEFAULT_GPM_CTL_DEV) == 0)
|
|
||||||
proto = MOUSE_PROTO_GPM;
|
|
||||||
xfree(realdev);
|
|
||||||
/*
|
|
||||||
* If the protocol can't be guessed from the device name,
|
|
||||||
* try to characterise it.
|
|
||||||
*/
|
|
||||||
if (proto == MOUSE_PROTO_UNKNOWN) {
|
|
||||||
SYSCALL (fd = open(dev, O_RDWR | O_NONBLOCK | O_EXCL));
|
|
||||||
if (isatty(fd)) {
|
|
||||||
/* Serial PnP has already failed, so give up. */
|
|
||||||
} else {
|
|
||||||
if (fstat(fd, &sbuf) != 0) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("fstat failed for %s (%s)\n", dev, strerror(errno));
|
|
||||||
#endif
|
|
||||||
close(fd);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (S_ISFIFO(sbuf.st_mode)) {
|
|
||||||
/* Assume GPM data in MSC format. */
|
|
||||||
proto = MOUSE_PROTO_MSC;
|
|
||||||
} else {
|
|
||||||
/* Default to PS/2 */
|
|
||||||
proto = MOUSE_PROTO_PS2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
if (proto == MOUSE_PROTO_UNKNOWN) {
|
|
||||||
xf86Msg(X_ERROR, "%s: Cannot find mouse protocol.\n",
|
|
||||||
pInfo->name);
|
|
||||||
return NULL;
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < sizeof(devproto)/sizeof(devproto[0]); i++) {
|
|
||||||
if (devproto[i].proto == proto) {
|
|
||||||
xf86Msg(X_INFO,
|
|
||||||
"%s: Setting mouse protocol to \"%s\"\n",
|
|
||||||
pInfo->name, devproto[i].name);
|
|
||||||
return devproto[i].name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
GuessProtocol(InputInfoPtr pInfo, int flags)
|
|
||||||
{
|
|
||||||
return lnxMouseMagic(pInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
SetupAuto(InputInfoPtr pInfo, int *protoPara)
|
|
||||||
{
|
|
||||||
return lnxMouseMagic(pInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT OSMouseInfoPtr
|
|
||||||
xf86OSMouseInit(int flags)
|
|
||||||
{
|
|
||||||
OSMouseInfoPtr p;
|
|
||||||
|
|
||||||
p = xcalloc(sizeof(OSMouseInfoRec), 1);
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
p->SupportedInterfaces = SupportedInterfaces;
|
|
||||||
p->DefaultProtocol = DefaultProtocol;
|
|
||||||
p->FindDevice = FindDevice;
|
|
||||||
p->GuessProtocol = GuessProtocol;
|
|
||||||
p->SetupAuto = SetupAuto;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 1999 by The XFree86 Project, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Xinput.h"
|
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
|
|
||||||
static int
|
|
||||||
SupportedInterfaces(void)
|
|
||||||
{
|
|
||||||
/* XXX Need to check this. */
|
|
||||||
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT OSMouseInfoPtr
|
|
||||||
xf86OSMouseInit(int flags)
|
|
||||||
{
|
|
||||||
OSMouseInfoPtr p;
|
|
||||||
|
|
||||||
p = xcalloc(sizeof(OSMouseInfoRec), 1);
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
p->SupportedInterfaces = SupportedInterfaces;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,258 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#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 "mipointer.h"
|
|
||||||
#include <sys/event.h>
|
|
||||||
#include <mouse.h>
|
|
||||||
|
|
||||||
static int
|
|
||||||
SupportedInterfaces (void)
|
|
||||||
{
|
|
||||||
return MSE_MISC;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *internalNames[] = {
|
|
||||||
"OSMouse",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char **
|
|
||||||
BuiltinNames (void)
|
|
||||||
{
|
|
||||||
return internalNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
CheckProtocol (const char *protocol)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; internalNames[i]; i++) {
|
|
||||||
if (xf86NameCmp (protocol, internalNames[i]) == 0)
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
DefaultProtocol (void)
|
|
||||||
{
|
|
||||||
return "OSMouse";
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
evtErrStr (int evterr)
|
|
||||||
{
|
|
||||||
switch (evterr) {
|
|
||||||
case -1: return "error in config files";
|
|
||||||
case -2: return "no mouse devices to attach";
|
|
||||||
case -3: return "unable to open device";
|
|
||||||
case -4: return "unable to open event queue";
|
|
||||||
case -999: return "unable to initialize event driver";
|
|
||||||
default: return "unknown event driver error";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
OsMouseProc (DeviceIntPtr pPointer, int what)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo;
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
unsigned char map[9];
|
|
||||||
dmask_t dmask;
|
|
||||||
MessageType from = X_CONFIG;
|
|
||||||
int evi;
|
|
||||||
|
|
||||||
pInfo = pPointer->public.devicePrivate;
|
|
||||||
pMse = pInfo->private;
|
|
||||||
pMse->device = pPointer;
|
|
||||||
|
|
||||||
switch (what) {
|
|
||||||
case DEVICE_INIT:
|
|
||||||
pPointer->public.on = FALSE;
|
|
||||||
|
|
||||||
dmask = D_ABS | D_REL | D_BUTTON;
|
|
||||||
if ((evi = ev_initf(xf86Info.consoleFd)) < 0) {
|
|
||||||
FatalError ("OsMouseProc: Event driver initialization failed (%s)\n",
|
|
||||||
evtErrStr(evi));
|
|
||||||
}
|
|
||||||
pInfo->fd = ev_open (&dmask);
|
|
||||||
if (pInfo->fd < 0) {
|
|
||||||
FatalError ("OsMouseProc: DEVICE_INIT failed (%s)\n", evtErrStr(pInfo->fd));
|
|
||||||
}
|
|
||||||
|
|
||||||
pMse->buttons = xf86SetIntOption (pInfo->options, "Buttons", 0);
|
|
||||||
if (pMse->buttons == 0) {
|
|
||||||
pMse->buttons = 8;
|
|
||||||
from = X_DEFAULT;
|
|
||||||
}
|
|
||||||
xf86Msg (from, "%s: Buttons: %d\n", pInfo->name, pMse->buttons);
|
|
||||||
|
|
||||||
for (evi = 0; evi <= 8; evi++)
|
|
||||||
map[evi] = evi;
|
|
||||||
|
|
||||||
InitPointerDeviceStruct((DevicePtr)pPointer, map, 8,
|
|
||||||
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);
|
|
||||||
|
|
||||||
ev_flush();
|
|
||||||
ev_suspend();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEVICE_ON:
|
|
||||||
pMse->lastButtons = 0;
|
|
||||||
pMse->lastMappedButtons = 0;
|
|
||||||
pMse->emulateState = 0;
|
|
||||||
pPointer->public.on = TRUE;
|
|
||||||
ev_resume();
|
|
||||||
AddEnabledDevice (pInfo->fd);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEVICE_OFF:
|
|
||||||
case DEVICE_CLOSE:
|
|
||||||
pPointer->public.on = FALSE;
|
|
||||||
RemoveEnabledDevice (pInfo->fd);
|
|
||||||
if (what == DEVICE_CLOSE) {
|
|
||||||
ev_close();
|
|
||||||
pInfo->fd = -1;
|
|
||||||
} else {
|
|
||||||
ev_suspend();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
OsMouseReadInput (InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
EVENT *evp;
|
|
||||||
|
|
||||||
pMse = pInfo->private;
|
|
||||||
|
|
||||||
while ((evp = ev_read()) != (EVENT *)0) {
|
|
||||||
int buttons = EV_BUTTONS(*evp);
|
|
||||||
int dx = EV_DX(*evp), dy = -(EV_DY(*evp)), dz = 0;
|
|
||||||
|
|
||||||
if (buttons & WHEEL_FWD)
|
|
||||||
dz = -1;
|
|
||||||
else if (buttons & WHEEL_BACK)
|
|
||||||
dz = 1;
|
|
||||||
|
|
||||||
buttons &= ~(WHEEL_FWD | WHEEL_BACK);
|
|
||||||
|
|
||||||
pMse->PostEvent (pInfo, buttons, dx, dy, dz, 0);
|
|
||||||
ev_pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
|
|
||||||
/* This is called when the protocol is "OSMouse". */
|
|
||||||
|
|
||||||
pMse = pInfo->private;
|
|
||||||
pMse->protocol = protocol;
|
|
||||||
xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
|
|
||||||
|
|
||||||
/* Collect the options, and process the common options. */
|
|
||||||
xf86CollectInputOptions(pInfo, NULL, NULL);
|
|
||||||
xf86ProcessCommonOptions(pInfo, pInfo->options);
|
|
||||||
|
|
||||||
/* Check if the device can be opened. */
|
|
||||||
pInfo->fd = ev_initf(xf86Info.consoleFd);
|
|
||||||
if (pInfo->fd != -1) {
|
|
||||||
dmask_t dmask = (D_ABS | D_REL | D_BUTTON);
|
|
||||||
pInfo->fd = ev_open(&dmask);
|
|
||||||
} else {
|
|
||||||
pInfo->fd = -999;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pInfo->fd < 0) {
|
|
||||||
if (xf86GetAllowMouseOpenFail())
|
|
||||||
xf86Msg(X_WARNING, "%s: cannot open event manager (%s)\n",
|
|
||||||
pInfo->name, evtErrStr(pInfo->fd));
|
|
||||||
else {
|
|
||||||
xf86Msg(X_ERROR, "%s: cannot open event manager (%s)\n",
|
|
||||||
pInfo->name, evtErrStr(pInfo->fd));
|
|
||||||
xfree(pMse);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ev_close();
|
|
||||||
pInfo->fd = -1;
|
|
||||||
|
|
||||||
/* Process common mouse options (like Emulate3Buttons, etc). */
|
|
||||||
pMse->CommonOptions(pInfo);
|
|
||||||
|
|
||||||
/* Setup the local procs. */
|
|
||||||
pInfo->device_control = OsMouseProc;
|
|
||||||
pInfo->read_input = OsMouseReadInput;
|
|
||||||
|
|
||||||
pInfo->flags |= XI86_CONFIGURED;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT OSMouseInfoPtr
|
|
||||||
xf86OSMouseInit (int flags)
|
|
||||||
{
|
|
||||||
OSMouseInfoPtr p;
|
|
||||||
|
|
||||||
p = xcalloc(sizeof(OSMouseInfoRec), 1);
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
p->SupportedInterfaces = SupportedInterfaces;
|
|
||||||
p->BuiltinNames = BuiltinNames;
|
|
||||||
p->DefaultProtocol = DefaultProtocol;
|
|
||||||
p->CheckProtocol = CheckProtocol;
|
|
||||||
p->PreInit = OsMousePreInit;
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
|
@ -1,717 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 1999-2001 The XFree86 Project, 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, sublicense, and/or
|
|
||||||
* sell copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* XFREE86 PROJECT 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 XFree86 Project 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
|
|
||||||
* XFree86 Project.
|
|
||||||
*/
|
|
||||||
/* Copyright 2004-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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86_OSlib.h"
|
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
|
|
||||||
#if defined(__SOL8__) || !defined(__i386)
|
|
||||||
|
|
||||||
#include "xisb.h"
|
|
||||||
#include "mipointer.h"
|
|
||||||
#include <sys/stropts.h>
|
|
||||||
#include <sys/vuid_event.h>
|
|
||||||
#include <sys/msio.h>
|
|
||||||
|
|
||||||
/* Wheel mouse support in VUID drivers in Solaris 9 updates & Solaris 10 */
|
|
||||||
#ifdef WHEEL_DEVID /* Defined in vuid_event.h if VUID wheel support present */
|
|
||||||
# define HAVE_VUID_WHEEL
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_VUID_WHEEL
|
|
||||||
# include <sys/vuid_wheel.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Support for scaling absolute coordinates to screen size in
|
|
||||||
* Solaris 10 updates and beyond */
|
|
||||||
#if !defined(HAVE_ABSOLUTE_MOUSE_SCALING)
|
|
||||||
# ifdef MSIOSRESOLUTION /* Defined in msio.h if scaling support present */
|
|
||||||
# define HAVE_ABSOLUTE_MOUSE_SCALING
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Names of protocols that are handled internally here. */
|
|
||||||
|
|
||||||
static const char *internalNames[] = {
|
|
||||||
"VUID",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *solarisMouseDevs[] = {
|
|
||||||
/* Device file: Protocol: */
|
|
||||||
"/dev/mouse", "VUID", /* USB or SPARC */
|
|
||||||
#if defined(__i386) || defined(__x86)
|
|
||||||
"/dev/kdmouse", "PS/2", /* PS/2 */
|
|
||||||
#endif
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _VuidMseRec {
|
|
||||||
struct _VuidMseRec *next;
|
|
||||||
InputInfoPtr pInfo;
|
|
||||||
Firm_event event;
|
|
||||||
unsigned char * buffer;
|
|
||||||
char * strmod;
|
|
||||||
Bool(*wrapped_device_control)(DeviceIntPtr device, int what);
|
|
||||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
|
||||||
Ms_screen_resolution absres;
|
|
||||||
#endif
|
|
||||||
} VuidMseRec, *VuidMsePtr;
|
|
||||||
|
|
||||||
static VuidMsePtr vuidMouseList = NULL;
|
|
||||||
|
|
||||||
static int vuidMouseProc(DeviceIntPtr pPointer, int what);
|
|
||||||
static void vuidReadInput(InputInfoPtr pInfo);
|
|
||||||
|
|
||||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
|
||||||
static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse);
|
|
||||||
static void vuidMouseAdjustFrame(int index, int x, int y, int flags);
|
|
||||||
|
|
||||||
static int vuidMouseGeneration = 0;
|
|
||||||
static DevPrivateKey vuidMouseScreenKey = &vuidMouseScreenKey;
|
|
||||||
#define vuidMouseGetScreenPrivate(s) ( \
|
|
||||||
dixLookupPrivate(&(s)->devPrivates, vuidMouseScreenKey))
|
|
||||||
#define vuidMouseSetScreenPrivate(s,p) \
|
|
||||||
dixSetPrivate(&(s)->devPrivates, vuidMouseScreenKey, (void *) p)
|
|
||||||
#endif /* HAVE_ABSOLUTE_MOUSE_SCALING */
|
|
||||||
|
|
||||||
static inline
|
|
||||||
VuidMsePtr getVuidMsePriv(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
VuidMsePtr m = vuidMouseList;
|
|
||||||
|
|
||||||
while ((m != NULL) && (m->pInfo != pInfo)) {
|
|
||||||
m = m->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize and enable the mouse wheel, if present.
|
|
||||||
*
|
|
||||||
* Returns 1 if mouse wheel was successfully enabled.
|
|
||||||
* Returns 0 if an error occurred or if there is no mouse wheel.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
vuidMouseWheelInit(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_VUID_WHEEL
|
|
||||||
wheel_state wstate;
|
|
||||||
int nwheel = -1;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
wstate.vers = VUID_WHEEL_STATE_VERS;
|
|
||||||
wstate.id = 0;
|
|
||||||
wstate.stateflags = -1;
|
|
||||||
|
|
||||||
SYSCALL(i = ioctl(pInfo->fd, VUIDGWHEELCOUNT, &nwheel));
|
|
||||||
if (i != 0)
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
SYSCALL(i = ioctl(pInfo->fd, VUIDGWHEELSTATE, &wstate));
|
|
||||||
if (i != 0) {
|
|
||||||
xf86Msg(X_WARNING, "%s: couldn't get wheel state\n", pInfo->name);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
wstate.stateflags |= VUID_WHEEL_STATE_ENABLED;
|
|
||||||
|
|
||||||
SYSCALL(i = ioctl(pInfo->fd, VUIDSWHEELSTATE, &wstate));
|
|
||||||
if (i != 0) {
|
|
||||||
xf86Msg(X_WARNING, "%s: couldn't enable wheel\n", pInfo->name);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (1);
|
|
||||||
#else
|
|
||||||
return (0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* This function is called when the protocol is "VUID". */
|
|
||||||
static Bool
|
|
||||||
vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse = pInfo->private;
|
|
||||||
VuidMsePtr pVuidMse;
|
|
||||||
int buttons, i;
|
|
||||||
|
|
||||||
pVuidMse = xcalloc(sizeof(VuidMseRec), 1);
|
|
||||||
if (pVuidMse == NULL) {
|
|
||||||
xf86Msg(X_ERROR, "%s: cannot allocate VuidMouseRec\n", pInfo->name);
|
|
||||||
xfree(pMse);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
pMse->protocol = protocol;
|
|
||||||
xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
|
|
||||||
|
|
||||||
/* Collect the options, and process the common options. */
|
|
||||||
xf86CollectInputOptions(pInfo, NULL, NULL);
|
|
||||||
xf86ProcessCommonOptions(pInfo, pInfo->options);
|
|
||||||
|
|
||||||
/* Check if the device can be opened. */
|
|
||||||
pInfo->fd = xf86OpenSerial(pInfo->options);
|
|
||||||
if (pInfo->fd == -1) {
|
|
||||||
if (xf86GetAllowMouseOpenFail())
|
|
||||||
xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
|
|
||||||
else {
|
|
||||||
xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
|
|
||||||
xfree(pVuidMse);
|
|
||||||
xfree(pMse);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pVuidMse->buffer = (unsigned char *)&pVuidMse->event;
|
|
||||||
|
|
||||||
pVuidMse->strmod = xf86SetStrOption(pInfo->options, "StreamsModule", NULL);
|
|
||||||
if (pVuidMse->strmod) {
|
|
||||||
SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod));
|
|
||||||
if (i < 0) {
|
|
||||||
xf86Msg(X_ERROR,
|
|
||||||
"%s: cannot push module '%s' onto mouse device: %s\n",
|
|
||||||
pInfo->name, pVuidMse->strmod, strerror(errno));
|
|
||||||
xf86CloseSerial(pInfo->fd);
|
|
||||||
pInfo->fd = -1;
|
|
||||||
xfree(pVuidMse->strmod);
|
|
||||||
xfree(pVuidMse);
|
|
||||||
xfree(pMse);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buttons = xf86SetIntOption(pInfo->options, "Buttons", 0);
|
|
||||||
if (buttons == 0) {
|
|
||||||
SYSCALL(i = ioctl(pInfo->fd, MSIOBUTTONS, &buttons));
|
|
||||||
if (i == 0) {
|
|
||||||
pInfo->conf_idev->commonOptions =
|
|
||||||
xf86ReplaceIntOption(pInfo->conf_idev->commonOptions,
|
|
||||||
"Buttons", buttons);
|
|
||||||
xf86Msg(X_INFO, "%s: Setting Buttons option to \"%d\"\n",
|
|
||||||
pInfo->name, buttons);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pVuidMse->strmod) {
|
|
||||||
SYSCALL(i = ioctl(pInfo->fd, I_POP, pVuidMse->strmod));
|
|
||||||
if (i == -1) {
|
|
||||||
xf86Msg(X_WARNING,
|
|
||||||
"%s: cannot pop module '%s' off mouse device: %s\n",
|
|
||||||
pInfo->name, pVuidMse->strmod, strerror(errno));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xf86CloseSerial(pInfo->fd);
|
|
||||||
pInfo->fd = -1;
|
|
||||||
|
|
||||||
/* Process common mouse options (like Emulate3Buttons, etc). */
|
|
||||||
pMse->CommonOptions(pInfo);
|
|
||||||
|
|
||||||
/* Setup the local procs. */
|
|
||||||
pVuidMse->wrapped_device_control = pInfo->device_control;
|
|
||||||
pInfo->device_control = vuidMouseProc;
|
|
||||||
pInfo->read_input = vuidReadInput;
|
|
||||||
|
|
||||||
pMse->xisbscale = sizeof(Firm_event);
|
|
||||||
|
|
||||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
|
||||||
pVuidMse->absres.height = pVuidMse->absres.width = 0;
|
|
||||||
#endif
|
|
||||||
pVuidMse->pInfo = pInfo;
|
|
||||||
pVuidMse->next = vuidMouseList;
|
|
||||||
vuidMouseList = pVuidMse;
|
|
||||||
|
|
||||||
pInfo->flags |= XI86_CONFIGURED;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
vuidFlushAbsEvents(InputInfoPtr pInfo, int absX, int absY,
|
|
||||||
Bool *absXset, Bool *absYset)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("vuidFlushAbsEvents: %d,%d (set: %d, %d)\n", absX, absY,
|
|
||||||
*absXset, *absYset);
|
|
||||||
#endif
|
|
||||||
if ((*absXset) && (*absYset)) {
|
|
||||||
xf86PostMotionEvent(pInfo->dev,
|
|
||||||
/* is_absolute: */ TRUE,
|
|
||||||
/* first_valuator: */ 0,
|
|
||||||
/* num_valuators: */ 2,
|
|
||||||
absX, absY);
|
|
||||||
} else if (*absXset) {
|
|
||||||
xf86PostMotionEvent(pInfo->dev,
|
|
||||||
/* is_absolute: */ TRUE,
|
|
||||||
/* first_valuator: */ 0,
|
|
||||||
/* num_valuators: */ 1,
|
|
||||||
absX);
|
|
||||||
} else if (*absYset) {
|
|
||||||
xf86PostMotionEvent(pInfo->dev,
|
|
||||||
/* is_absolute: */ TRUE,
|
|
||||||
/* first_valuator: */ 1,
|
|
||||||
/* num_valuators: */ 1,
|
|
||||||
absY);
|
|
||||||
}
|
|
||||||
|
|
||||||
*absXset = FALSE;
|
|
||||||
*absYset = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
vuidReadInput(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
VuidMsePtr pVuidMse;
|
|
||||||
int buttons;
|
|
||||||
int dx = 0, dy = 0, dz = 0, dw = 0;
|
|
||||||
unsigned int n;
|
|
||||||
int c;
|
|
||||||
unsigned char *pBuf;
|
|
||||||
int wmask;
|
|
||||||
int absX, absY;
|
|
||||||
Bool absXset = FALSE, absYset = FALSE;
|
|
||||||
|
|
||||||
pMse = pInfo->private;
|
|
||||||
pVuidMse = getVuidMsePriv(pInfo);
|
|
||||||
buttons = pMse->lastButtons;
|
|
||||||
XisbBlockDuration(pMse->buffer, -1);
|
|
||||||
pBuf = pVuidMse->buffer;
|
|
||||||
n = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
while (n < sizeof(Firm_event) && (c = XisbRead(pMse->buffer)) >= 0) {
|
|
||||||
pBuf[n++] = (unsigned char)c;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (n != sizeof(Firm_event)) {
|
|
||||||
xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n",
|
|
||||||
pInfo->name, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("vuidReadInput: event type: %3d value: %5d\n",
|
|
||||||
pVuidMse->event.id, pVuidMse->event.value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pVuidMse->event.id >= BUT_FIRST && pVuidMse->event.id <= BUT_LAST) {
|
|
||||||
/* button */
|
|
||||||
int butnum = pVuidMse->event.id - BUT_FIRST;
|
|
||||||
|
|
||||||
if (butnum < 3)
|
|
||||||
butnum = 2 - butnum;
|
|
||||||
if (!pVuidMse->event.value)
|
|
||||||
buttons &= ~(1 << butnum);
|
|
||||||
else
|
|
||||||
buttons |= (1 << butnum);
|
|
||||||
} else if (pVuidMse->event.id >= VLOC_FIRST &&
|
|
||||||
pVuidMse->event.id <= VLOC_LAST) {
|
|
||||||
/* axis */
|
|
||||||
int delta = pVuidMse->event.value;
|
|
||||||
switch(pVuidMse->event.id) {
|
|
||||||
case LOC_X_DELTA:
|
|
||||||
dx += delta;
|
|
||||||
break;
|
|
||||||
case LOC_Y_DELTA:
|
|
||||||
dy -= delta;
|
|
||||||
break;
|
|
||||||
case LOC_X_ABSOLUTE:
|
|
||||||
if (absXset) {
|
|
||||||
vuidFlushAbsEvents(pInfo, absX, absY, &absXset, &absYset);
|
|
||||||
}
|
|
||||||
absX = delta;
|
|
||||||
absXset = TRUE;
|
|
||||||
break;
|
|
||||||
case LOC_Y_ABSOLUTE:
|
|
||||||
if (absYset) {
|
|
||||||
vuidFlushAbsEvents(pInfo, absX, absY, &absXset, &absYset);
|
|
||||||
}
|
|
||||||
absY = delta;
|
|
||||||
absYset = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef HAVE_VUID_WHEEL
|
|
||||||
else if (vuid_in_range(VUID_WHEEL, pVuidMse->event.id)) {
|
|
||||||
if (vuid_id_offset(pVuidMse->event.id) == 0)
|
|
||||||
dz -= VUID_WHEEL_GETDELTA(pVuidMse->event.value);
|
|
||||||
else
|
|
||||||
dw -= VUID_WHEEL_GETDELTA(pVuidMse->event.value);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
|
||||||
else if (pVuidMse->event.id == MOUSE_TYPE_ABSOLUTE) {
|
|
||||||
/* force sending absolute resolution scaling ioctl */
|
|
||||||
pVuidMse->absres.height = pVuidMse->absres.width = 0;
|
|
||||||
vuidMouseSendScreenSize(miPointerCurrentScreen(), pVuidMse);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
n = 0;
|
|
||||||
if ((c = XisbRead(pMse->buffer)) >= 0) {
|
|
||||||
/* Another packet. Handle it right away. */
|
|
||||||
pBuf[n++] = c;
|
|
||||||
}
|
|
||||||
} while (n != 0);
|
|
||||||
|
|
||||||
if (absXset || absYset) {
|
|
||||||
vuidFlushAbsEvents(pInfo, absX, absY, &absXset, &absYset);
|
|
||||||
}
|
|
||||||
|
|
||||||
pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
|
||||||
static void vuidMouseSendScreenSize(ScreenPtr pScreen, VuidMsePtr pVuidMse)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo = pVuidMse->pInfo;
|
|
||||||
ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
|
|
||||||
int result;
|
|
||||||
|
|
||||||
if ((pVuidMse->absres.width != pScr->currentMode->HDisplay) ||
|
|
||||||
(pVuidMse->absres.height != pScr->currentMode->VDisplay))
|
|
||||||
{
|
|
||||||
pVuidMse->absres.width = pScr->currentMode->HDisplay;
|
|
||||||
pVuidMse->absres.height = pScr->currentMode->VDisplay;
|
|
||||||
|
|
||||||
do {
|
|
||||||
result = ioctl(pInfo->fd, MSIOSRESOLUTION, &(pVuidMse->absres));
|
|
||||||
} while ( (result != 0) && (errno == EINTR) );
|
|
||||||
|
|
||||||
if (result != 0) {
|
|
||||||
xf86Msg(X_WARNING,
|
|
||||||
"%s: couldn't set absolute mouse scaling resolution: %s\n",
|
|
||||||
pInfo->name, strerror(errno));
|
|
||||||
#ifdef DEBUG
|
|
||||||
} else {
|
|
||||||
xf86Msg(X_INFO,
|
|
||||||
"%s: absolute mouse scaling resolution set to %d x %d\n",
|
|
||||||
pInfo->name,
|
|
||||||
pVuidMse->absres.width, pVuidMse->absres.height);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void vuidMouseAdjustFrame(int index, int x, int y, int flags)
|
|
||||||
{
|
|
||||||
ScrnInfoPtr pScrn = xf86Screens[index];
|
|
||||||
ScreenPtr pScreen = pScrn->pScreen;
|
|
||||||
xf86AdjustFrameProc *wrappedAdjustFrame
|
|
||||||
= (xf86AdjustFrameProc *) vuidMouseGetScreenPrivate(pScreen);
|
|
||||||
VuidMsePtr m;
|
|
||||||
|
|
||||||
if(wrappedAdjustFrame) {
|
|
||||||
pScrn->AdjustFrame = wrappedAdjustFrame;
|
|
||||||
(*pScrn->AdjustFrame)(index, x, y, flags);
|
|
||||||
pScrn->AdjustFrame = vuidMouseAdjustFrame;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (miPointerCurrentScreen() == pScreen) {
|
|
||||||
for (m = vuidMouseList; m != NULL ; m = m->next) {
|
|
||||||
vuidMouseSendScreenSize(pScreen, m);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* HAVE_ABSOLUTE_MOUSE_SCALING */
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
vuidMouseProc(DeviceIntPtr pPointer, int what)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo;
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
VuidMsePtr pVuidMse;
|
|
||||||
int ret = Success;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
pInfo = pPointer->public.devicePrivate;
|
|
||||||
pMse = pInfo->private;
|
|
||||||
pMse->device = pPointer;
|
|
||||||
|
|
||||||
pVuidMse = getVuidMsePriv(pInfo);
|
|
||||||
if (pVuidMse == NULL) {
|
|
||||||
return BadImplementation;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (what) {
|
|
||||||
|
|
||||||
case DEVICE_INIT:
|
|
||||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
|
||||||
if (vuidMouseGeneration != serverGeneration) {
|
|
||||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
|
||||||
ScreenPtr pScreen = screenInfo.screens[i];
|
|
||||||
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
|
|
||||||
vuidMouseSetScreenPrivate(pScreen, pScrn->AdjustFrame);
|
|
||||||
pScrn->AdjustFrame = vuidMouseAdjustFrame;
|
|
||||||
}
|
|
||||||
vuidMouseGeneration = serverGeneration;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ret = pVuidMse->wrapped_device_control(pPointer, what);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEVICE_ON:
|
|
||||||
ret = pVuidMse->wrapped_device_control(pPointer, DEVICE_ON);
|
|
||||||
|
|
||||||
if ((ret == Success) && (pInfo->fd != -1)) {
|
|
||||||
int fmt = VUID_FIRM_EVENT;
|
|
||||||
|
|
||||||
if (pVuidMse->strmod) {
|
|
||||||
SYSCALL(i = ioctl(pInfo->fd, I_PUSH, pVuidMse->strmod));
|
|
||||||
if (i < 0) {
|
|
||||||
xf86Msg(X_WARNING,
|
|
||||||
"%s: cannot push module '%s' onto mouse device: %s\n",
|
|
||||||
pInfo->name, pVuidMse->strmod, strerror(errno));
|
|
||||||
xfree(pVuidMse->strmod);
|
|
||||||
pVuidMse->strmod = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SYSCALL(i = ioctl(pInfo->fd, VUIDSFORMAT, &fmt));
|
|
||||||
if (i < 0) {
|
|
||||||
xf86Msg(X_WARNING,
|
|
||||||
"%s: cannot set mouse device to VUID mode: %s\n",
|
|
||||||
pInfo->name, strerror(errno));
|
|
||||||
}
|
|
||||||
vuidMouseWheelInit(pInfo);
|
|
||||||
#ifdef HAVE_ABSOLUTE_MOUSE_SCALING
|
|
||||||
vuidMouseSendScreenSize(screenInfo.screens[0], pVuidMse);
|
|
||||||
#endif
|
|
||||||
xf86FlushInput(pInfo->fd);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEVICE_OFF:
|
|
||||||
case DEVICE_CLOSE:
|
|
||||||
if (pInfo->fd != -1) {
|
|
||||||
if (pVuidMse->strmod) {
|
|
||||||
SYSCALL(i = ioctl(pInfo->fd, I_POP, pVuidMse->strmod));
|
|
||||||
if (i == -1) {
|
|
||||||
xf86Msg(X_WARNING,
|
|
||||||
"%s: cannot pop module '%s' off mouse device: %s\n",
|
|
||||||
pInfo->name, pVuidMse->strmod, strerror(errno));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret = pVuidMse->wrapped_device_control(pPointer, what);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: /* Should never be called, but just in case */
|
|
||||||
ret = pVuidMse->wrapped_device_control(pPointer, what);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
sunMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
/* The protocol is guaranteed to be one of the internalNames[] */
|
|
||||||
if (xf86NameCmp(protocol, "VUID") == 0) {
|
|
||||||
return vuidPreInit(pInfo, protocol, flags);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char **
|
|
||||||
BuiltinNames(void)
|
|
||||||
{
|
|
||||||
return internalNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
CheckProtocol(const char *protocol)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; internalNames[i]; i++)
|
|
||||||
if (xf86NameCmp(protocol, internalNames[i]) == 0)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
DefaultProtocol(void)
|
|
||||||
{
|
|
||||||
return "Auto";
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
solarisMouseAutoProbe(InputInfoPtr pInfo, const char **protocol,
|
|
||||||
const char **device)
|
|
||||||
{
|
|
||||||
const char **pdev, **pproto, *dev = NULL;
|
|
||||||
int fd = -1;
|
|
||||||
Bool found;
|
|
||||||
|
|
||||||
for (pdev = solarisMouseDevs; *pdev; pdev += 2) {
|
|
||||||
pproto = pdev + 1;
|
|
||||||
if ((*protocol != NULL) && (strcmp(*protocol, "Auto") != 0) &&
|
|
||||||
(*pproto != NULL) && (strcmp(*pproto, *protocol) != 0)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((*device != NULL) && (strcmp(*device, *pdev) != 0)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
SYSCALL (fd = open(*pdev, O_RDWR | O_NONBLOCK));
|
|
||||||
if (fd == -1) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
ErrorF("Cannot open %s (%s)\n", pdev, strerror(errno));
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
found = TRUE;
|
|
||||||
if ((*pproto != NULL) && (strcmp(*pproto, "VUID") == 0)) {
|
|
||||||
int i, r;
|
|
||||||
SYSCALL(r = ioctl(fd, VUIDGFORMAT, &i));
|
|
||||||
if (r < 0) {
|
|
||||||
found = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
if (found == TRUE) {
|
|
||||||
if (*pproto != NULL) {
|
|
||||||
*protocol = *pproto;
|
|
||||||
}
|
|
||||||
*device = *pdev;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
SetupAuto(InputInfoPtr pInfo, int *protoPara)
|
|
||||||
{
|
|
||||||
const char *pdev = NULL;
|
|
||||||
const char *pproto = NULL;
|
|
||||||
MouseDevPtr pMse = pInfo->private;
|
|
||||||
|
|
||||||
if (pInfo->fd == -1) {
|
|
||||||
/* probe to find device/protocol to use */
|
|
||||||
if (solarisMouseAutoProbe(pInfo, &pproto, &pdev) != FALSE) {
|
|
||||||
/* Set the Device option. */
|
|
||||||
pInfo->conf_idev->commonOptions =
|
|
||||||
xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", pdev);
|
|
||||||
xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
|
|
||||||
pInfo->name, pdev);
|
|
||||||
}
|
|
||||||
} else if (pMse->protocolID == PROT_AUTO) {
|
|
||||||
pdev = xf86CheckStrOption(pInfo->conf_idev->commonOptions,
|
|
||||||
"Device", NULL);
|
|
||||||
solarisMouseAutoProbe(pInfo, &pproto, &pdev);
|
|
||||||
}
|
|
||||||
return pproto;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
FindDevice(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
const char *pdev = NULL;
|
|
||||||
const char *pproto = protocol;
|
|
||||||
|
|
||||||
if (solarisMouseAutoProbe(pInfo, &pproto, &pdev) != FALSE) {
|
|
||||||
/* Set the Device option. */
|
|
||||||
pInfo->conf_idev->commonOptions =
|
|
||||||
xf86AddNewOption(pInfo->conf_idev->commonOptions, "Device", pdev);
|
|
||||||
xf86Msg(X_INFO, "%s: Setting Device option to \"%s\"\n",
|
|
||||||
pInfo->name, pdev);
|
|
||||||
}
|
|
||||||
return pdev;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* __SOL8__ || !__i386 */
|
|
||||||
|
|
||||||
#undef MSE_MISC
|
|
||||||
#define MSE_MISC 0
|
|
||||||
|
|
||||||
#endif /* !__SOL8__ && __i386 */
|
|
||||||
|
|
||||||
static int
|
|
||||||
SupportedInterfaces(void)
|
|
||||||
{
|
|
||||||
/* XXX This needs to be checked. */
|
|
||||||
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2 | MSE_MISC;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT OSMouseInfoPtr
|
|
||||||
xf86OSMouseInit(int flags)
|
|
||||||
{
|
|
||||||
OSMouseInfoPtr p;
|
|
||||||
|
|
||||||
p = xcalloc(sizeof(OSMouseInfoRec), 1);
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
p->SupportedInterfaces = SupportedInterfaces;
|
|
||||||
#if defined(__SOL8__) || !defined(__i386)
|
|
||||||
p->BuiltinNames = BuiltinNames;
|
|
||||||
p->CheckProtocol = CheckProtocol;
|
|
||||||
p->PreInit = sunMousePreInit;
|
|
||||||
p->DefaultProtocol = DefaultProtocol;
|
|
||||||
p->SetupAuto = SetupAuto;
|
|
||||||
p->FindDevice = FindDevice;
|
|
||||||
#endif
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 1999 by The XFree86 Project, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_XORG_CONFIG_H
|
|
||||||
#include <xorg-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Xinput.h"
|
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
|
|
||||||
static int
|
|
||||||
SupportedInterfaces(void)
|
|
||||||
{
|
|
||||||
/* XXX Need to check this. */
|
|
||||||
return MSE_SERIAL | MSE_AUTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef ISC
|
|
||||||
static const char *internalNames[] = {
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char **
|
|
||||||
BuiltinNames(void)
|
|
||||||
{
|
|
||||||
return internalNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
CheckProtocol(const char *protocol)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; internalNames[i]; i++)
|
|
||||||
if (xf86NameCmp(protocol, internalNames[i]) == 0)
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_X_EXPORT OSMouseInfoPtr
|
|
||||||
xf86OSMouseInit(int flags)
|
|
||||||
{
|
|
||||||
OSMouseInfoPtr p;
|
|
||||||
|
|
||||||
p = xcalloc(sizeof(OSMouseInfoRec), 1);
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
p->SupportedInterfaces = SupportedInterfaces;
|
|
||||||
#ifndef ISC
|
|
||||||
p->BuiltinNames = BuiltinNames;
|
|
||||||
p->CheckProtocol = CheckProtocol;
|
|
||||||
#endif
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,177 +0,0 @@
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright 2005 Kean Johnston
|
|
||||||
* Copyright 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 names of The XFree86 Project, Inc
|
|
||||||
* and Kean Johnston not be used in advertising or publicity pertaining to
|
|
||||||
* distribution of the software without specific, written prior permission.
|
|
||||||
* The XFree86 Project, Inc 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.
|
|
||||||
*
|
|
||||||
* THE XFREE86 PROJECT, INC 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "X.h"
|
|
||||||
#include "compiler.h"
|
|
||||||
#include "xf86.h"
|
|
||||||
#include "xf86Xinput.h"
|
|
||||||
#include "xf86OSmouse.h"
|
|
||||||
#include "xf86Priv.h"
|
|
||||||
#include "xf86_OSlib.h"
|
|
||||||
#include "mipointer.h"
|
|
||||||
|
|
||||||
static int
|
|
||||||
SupportedInterfaces(void)
|
|
||||||
{
|
|
||||||
return MSE_MISC;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *internalNames[] = {
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char **
|
|
||||||
BuiltinNames(void)
|
|
||||||
{
|
|
||||||
return internalNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
DefaultProtocol (void)
|
|
||||||
{
|
|
||||||
return "OSMouse";
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
CheckProtocol(const char *protocol)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; internalNames[i]; i++)
|
|
||||||
if (xf86NameCmp(protocol, internalNames[i]) == 0)
|
|
||||||
return TRUE;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
OsMouseProc(DeviceIntPtr pPointer, int what)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo;
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
unsigned char map[9];
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
pInfo = pPointer->public.devicePrivate;
|
|
||||||
pMse = pInfo->private;
|
|
||||||
pMse->device = pPointer;
|
|
||||||
|
|
||||||
switch (what) {
|
|
||||||
case DEVICE_INIT:
|
|
||||||
pPointer->public.on = FALSE;
|
|
||||||
|
|
||||||
for (ret = 0; ret <= 8; ret++)
|
|
||||||
map[ret] = ret;
|
|
||||||
|
|
||||||
InitPointerDeviceStruct((DevicePtr)pPointer, map, 8,
|
|
||||||
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);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEVICE_ON:
|
|
||||||
pMse->lastButtons = 0;
|
|
||||||
pMse->emulateState = 0;
|
|
||||||
pPointer->public.on = TRUE;
|
|
||||||
XqMseOnOff (pInfo, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEVICE_CLOSE:
|
|
||||||
case DEVICE_OFF:
|
|
||||||
pPointer->public.on = FALSE;
|
|
||||||
XqMseOnOff (pInfo, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
|
|
||||||
{
|
|
||||||
MouseDevPtr pMse;
|
|
||||||
|
|
||||||
pMse = pInfo->private;
|
|
||||||
pMse->protocol = protocol;
|
|
||||||
xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
|
|
||||||
|
|
||||||
/* Collect the options, and process the common options. */
|
|
||||||
xf86CollectInputOptions(pInfo, NULL, NULL);
|
|
||||||
xf86ProcessCommonOptions(pInfo, pInfo->options);
|
|
||||||
|
|
||||||
pInfo->fd = -1;
|
|
||||||
#if 0
|
|
||||||
/* Make sure we can open the mouse */
|
|
||||||
pInfo->fd = open ("/dev/mouse", O_RDONLY | O_NONBLOCK);
|
|
||||||
|
|
||||||
if (pInfo->fd < 0) {
|
|
||||||
if (xf86GetAllowMouseOpenFail()) {
|
|
||||||
xf86Msg(X_WARNING, "%s: cannot open /dev/mouse (%s)\n",
|
|
||||||
pInfo->name, strerror(errno));
|
|
||||||
} else {
|
|
||||||
xf86Msg(X_ERROR, "%s: cannot open /dev/mouse (%s)\n",
|
|
||||||
pInfo->name, strerror(errno));
|
|
||||||
xfree(pMse);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Process common mouse options (like Emulate3Buttons, etc). */
|
|
||||||
pMse->CommonOptions(pInfo);
|
|
||||||
|
|
||||||
/* Setup the local procs. */
|
|
||||||
pInfo->device_control = OsMouseProc;
|
|
||||||
pInfo->read_input = NULL;
|
|
||||||
|
|
||||||
pInfo->flags |= XI86_CONFIGURED;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_X_EXPORT OSMouseInfoPtr
|
|
||||||
xf86OSMouseInit(int flags)
|
|
||||||
{
|
|
||||||
OSMouseInfoPtr p;
|
|
||||||
|
|
||||||
p = xcalloc(sizeof(OSMouseInfoRec), 1);
|
|
||||||
if (!p)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
p->SupportedInterfaces = SupportedInterfaces;
|
|
||||||
p->BuiltinNames = BuiltinNames;
|
|
||||||
p->DefaultProtocol = DefaultProtocol;
|
|
||||||
p->CheckProtocol = CheckProtocol;
|
|
||||||
p->PreInit = OsMousePreInit;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,294 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 1999-2003 by The XFree86 Project, Inc.
|
|
||||||
*
|
|
||||||
* 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, sublicense,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
|
|
||||||
* and author(s) 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 copyright holder(s) and author(s).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Public interface to OS-specific mouse support. */
|
|
||||||
|
|
||||||
#ifndef _XF86OSMOUSE_H_
|
|
||||||
#define _XF86OSMOUSE_H_
|
|
||||||
|
|
||||||
#include "xf86Xinput.h"
|
|
||||||
|
|
||||||
/* Mouse interface classes */
|
|
||||||
#define MSE_NONE 0x00
|
|
||||||
#define MSE_SERIAL 0x01 /* serial port */
|
|
||||||
#define MSE_BUS 0x02 /* old bus mouse */
|
|
||||||
#define MSE_PS2 0x04 /* standard read-only PS/2 */
|
|
||||||
#define MSE_XPS2 0x08 /* extended PS/2 */
|
|
||||||
#define MSE_AUTO 0x10 /* auto-detect (PnP) */
|
|
||||||
#define MSE_MISC 0x20 /* The OS layer will identify the
|
|
||||||
* specific protocol names that are
|
|
||||||
* supported for this class. */
|
|
||||||
|
|
||||||
/* Mouse Protocol IDs. */
|
|
||||||
typedef enum {
|
|
||||||
PROT_UNKNOWN = -2,
|
|
||||||
PROT_UNSUP = -1, /* protocol is not supported */
|
|
||||||
PROT_MS = 0,
|
|
||||||
PROT_MSC,
|
|
||||||
PROT_MM,
|
|
||||||
PROT_LOGI,
|
|
||||||
PROT_LOGIMAN,
|
|
||||||
PROT_MMHIT,
|
|
||||||
PROT_GLIDE,
|
|
||||||
PROT_IMSERIAL,
|
|
||||||
PROT_THINKING,
|
|
||||||
PROT_ACECAD,
|
|
||||||
PROT_VALUMOUSESCROLL,
|
|
||||||
PROT_PS2,
|
|
||||||
PROT_GENPS2,
|
|
||||||
PROT_IMPS2,
|
|
||||||
PROT_EXPPS2,
|
|
||||||
PROT_THINKPS2,
|
|
||||||
PROT_MMPS2,
|
|
||||||
PROT_GLIDEPS2,
|
|
||||||
PROT_NETPS2,
|
|
||||||
PROT_NETSCPS2,
|
|
||||||
PROT_BM,
|
|
||||||
PROT_AUTO,
|
|
||||||
PROT_SYSMOUSE,
|
|
||||||
PROT_NUMPROTOS /* This must always be last. */
|
|
||||||
} MouseProtocolID;
|
|
||||||
|
|
||||||
struct _MouseDevRec;
|
|
||||||
|
|
||||||
typedef int (*GetInterfaceTypesProc)(void);
|
|
||||||
typedef const char **(*BuiltinNamesProc)(void);
|
|
||||||
typedef Bool (*CheckProtocolProc)(const char *protocol);
|
|
||||||
typedef Bool (*BuiltinPreInitProc)(InputInfoPtr pInfo, const char *protocol,
|
|
||||||
int flags);
|
|
||||||
typedef const char *(*DefaultProtocolProc)(void);
|
|
||||||
typedef const char *(*SetupAutoProc)(InputInfoPtr pInfo, int *protoPara);
|
|
||||||
typedef void (*SetResProc)(InputInfoPtr pInfo, const char* protocol, int rate,
|
|
||||||
int res);
|
|
||||||
typedef const char *(*FindDeviceProc)(InputInfoPtr pInfo, const char *protocol,
|
|
||||||
int flags);
|
|
||||||
typedef const char *(*GuessProtocolProc)(InputInfoPtr pInfo, int flags);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* OSMouseInfoRec is used to pass information from the OSMouse layer to the
|
|
||||||
* OS-independent mouse driver.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
GetInterfaceTypesProc SupportedInterfaces;
|
|
||||||
BuiltinNamesProc BuiltinNames;
|
|
||||||
CheckProtocolProc CheckProtocol;
|
|
||||||
BuiltinPreInitProc PreInit;
|
|
||||||
DefaultProtocolProc DefaultProtocol;
|
|
||||||
SetupAutoProc SetupAuto;
|
|
||||||
SetResProc SetPS2Res;
|
|
||||||
SetResProc SetBMRes;
|
|
||||||
SetResProc SetMiscRes;
|
|
||||||
FindDeviceProc FindDevice;
|
|
||||||
GuessProtocolProc GuessProtocol;
|
|
||||||
} OSMouseInfoRec, *OSMouseInfoPtr;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SupportedInterfaces: Returns the mouse interface types that the OS support.
|
|
||||||
* If MSE_MISC is returned, then the BuiltinNames and
|
|
||||||
* CheckProtocol should be set.
|
|
||||||
*
|
|
||||||
* BuiltinNames: Returns the names of the protocols that are fully handled
|
|
||||||
* in the OS-specific code. These are names that don't appear
|
|
||||||
* directly in the main "mouse" driver.
|
|
||||||
*
|
|
||||||
* CheckProtocol: Checks if the protocol name given is supported by the
|
|
||||||
* OS. It should return TRUE for both "builtin" protocols and
|
|
||||||
* protocols of type MSE_MISC that are supported by the OS.
|
|
||||||
*
|
|
||||||
* PreInit: The PreInit function for protocols that are builtin. This
|
|
||||||
* function is passed the protocol name.
|
|
||||||
*
|
|
||||||
* DefaultProtocol: Returns the name of a default protocol that should be used
|
|
||||||
* for the OS when none has been supplied in the config file.
|
|
||||||
* This should only be set when there is a reasonable default.
|
|
||||||
*
|
|
||||||
* SetupAuto: This function can be used to do OS-specific protocol
|
|
||||||
* auto-detection. It returns the name of the detected protocol,
|
|
||||||
* or NULL when detection fails. It may also adjust one or more
|
|
||||||
* of the "protoPara" values for the detected protocol by setting
|
|
||||||
* then to something other than -1. SetupAuto gets called in two
|
|
||||||
* ways. The first is before any devices have been opened. This
|
|
||||||
* can be used when the protocol "Auto" always maps to a single
|
|
||||||
* protocol type. The second is with the device open, allowing
|
|
||||||
* OS-specific probing to be done.
|
|
||||||
*
|
|
||||||
* SetPS2Res: Set the resolution and sample rate for MSE_PS2 and MSE_XPS2
|
|
||||||
* protocol types.
|
|
||||||
*
|
|
||||||
* SetBMRes: Set the resolution and sample rate for MSE_BM protocol types.
|
|
||||||
*
|
|
||||||
* SetMiscRes: Set the resolution and sample rate for MSE_MISC protocol types.
|
|
||||||
*
|
|
||||||
* FindDevice: This function gets called when no Device has been specified
|
|
||||||
* in the config file. OS-specific methods may be used to guess
|
|
||||||
* which input device to use. This function is called after the
|
|
||||||
* pre-open attempts at protocol discovery are done, but before
|
|
||||||
* the device is open. I.e., after the first SetupAuto() call,
|
|
||||||
* after the DefaultProtocol() call, but before the PreInit()
|
|
||||||
* call. Available protocol information may be used in locating
|
|
||||||
* the default input device.
|
|
||||||
*
|
|
||||||
* GuessProtocol: A last resort attempt at guessing the mouse protocol by
|
|
||||||
* whatever OS-specific means might be available. OS-independent
|
|
||||||
* things should be in the mouse driver. This function gets
|
|
||||||
* called after the mouse driver's OS-independent methods have
|
|
||||||
* failed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern OSMouseInfoPtr xf86OSMouseInit(int flags);
|
|
||||||
|
|
||||||
/* Adjust this when the mouse interface changes. */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* History:
|
|
||||||
*
|
|
||||||
* 1.0.0 - Everything up to when versioning was started.
|
|
||||||
* 1.1.0 - FindDevice and GuessProtocol added to OSMouseInfoRec
|
|
||||||
* 1.2.0 - xisbscale added to MouseDevRec
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define OS_MOUSE_VERSION_MAJOR 1
|
|
||||||
#define OS_MOUSE_VERSION_MINOR 2
|
|
||||||
#define OS_MOUSE_VERSION_PATCH 0
|
|
||||||
|
|
||||||
#define OS_MOUSE_VERSION_CURRENT \
|
|
||||||
BUILTIN_INTERFACE_VERSION_NUMERIC(OS_MOUSE_VERSION_MAJOR, \
|
|
||||||
OS_MOUSE_VERSION_MINOR, \
|
|
||||||
OS_MOUSE_VERSION_PATCH)
|
|
||||||
|
|
||||||
#define HAVE_GUESS_PROTOCOL \
|
|
||||||
(xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \
|
|
||||||
BUILTIN_INTERFACE_VERSION_NUMERIC(1, 1, 0))
|
|
||||||
|
|
||||||
#define HAVE_FIND_DEVICE \
|
|
||||||
(xf86GetBuiltinInterfaceVersion(BUILTIN_IF_OSMOUSE, 0) >= \
|
|
||||||
BUILTIN_INTERFACE_VERSION_NUMERIC(1, 1, 0))
|
|
||||||
|
|
||||||
/* Z axis mapping */
|
|
||||||
#define MSE_NOZMAP 0
|
|
||||||
#define MSE_MAPTOX -1
|
|
||||||
#define MSE_MAPTOY -2
|
|
||||||
#define MSE_MAPTOZ -3
|
|
||||||
#define MSE_MAPTOW -4
|
|
||||||
|
|
||||||
/* Generalize for other axes. */
|
|
||||||
#define MSE_NOAXISMAP MSE_NOZMAP
|
|
||||||
|
|
||||||
#define MSE_MAXBUTTONS 24
|
|
||||||
#define MSE_DFLTBUTTONS 3
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Mouse device record. This is shared by the mouse driver and the OSMouse
|
|
||||||
* layer.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef void (*checkMovementsProc)(InputInfoPtr,int, int);
|
|
||||||
typedef void (*autoProbeProc)(InputInfoPtr, Bool, Bool);
|
|
||||||
typedef Bool (*collectDataProc)(struct _MouseDevRec *, unsigned char);
|
|
||||||
typedef Bool (*dataGoodProc)(struct _MouseDevRec *);
|
|
||||||
|
|
||||||
typedef void (*PostMseEventProc)(InputInfoPtr pInfo, int buttons,
|
|
||||||
int dx, int dy, int dz, int dw);
|
|
||||||
typedef void (*MouseCommonOptProc)(InputInfoPtr pInfo);
|
|
||||||
|
|
||||||
typedef struct _MouseDevRec {
|
|
||||||
PtrCtrlProcPtr Ctrl;
|
|
||||||
PostMseEventProc PostEvent;
|
|
||||||
MouseCommonOptProc CommonOptions;
|
|
||||||
DeviceIntPtr device;
|
|
||||||
const char * mseDevice;
|
|
||||||
const char * protocol;
|
|
||||||
MouseProtocolID protocolID;
|
|
||||||
MouseProtocolID oldProtocolID; /* hack */
|
|
||||||
int class;
|
|
||||||
int mseModel;
|
|
||||||
int baudRate;
|
|
||||||
int oldBaudRate;
|
|
||||||
int sampleRate;
|
|
||||||
int lastButtons;
|
|
||||||
int threshold; /* acceleration */
|
|
||||||
int num;
|
|
||||||
int den;
|
|
||||||
int buttons; /* # of buttons */
|
|
||||||
int emulateState; /* automata state for 2 button mode */
|
|
||||||
Bool emulate3Buttons;
|
|
||||||
Bool emulate3ButtonsSoft;
|
|
||||||
int emulate3Timeout;/* Timeout for 3 button emulation */
|
|
||||||
Bool chordMiddle;
|
|
||||||
Bool flipXY;
|
|
||||||
int invX;
|
|
||||||
int invY;
|
|
||||||
int mouseFlags; /* Flags to Clear after opening
|
|
||||||
* mouse dev */
|
|
||||||
int truebuttons; /* (not used)
|
|
||||||
* Arg to maintain before
|
|
||||||
* emulate3buttons timer callback */
|
|
||||||
int resolution;
|
|
||||||
int negativeZ; /* button mask */
|
|
||||||
int positiveZ; /* button mask */
|
|
||||||
int negativeW; /* button mask */
|
|
||||||
int positiveW; /* button mask */
|
|
||||||
pointer buffer; /* usually an XISBuffer* */
|
|
||||||
int protoBufTail;
|
|
||||||
unsigned char protoBuf[8];
|
|
||||||
unsigned char protoPara[8];
|
|
||||||
unsigned char inSync; /* driver in sync with datastream */
|
|
||||||
pointer mousePriv; /* private area */
|
|
||||||
InputInfoPtr pInfo;
|
|
||||||
int origProtocolID;
|
|
||||||
const char * origProtocol;
|
|
||||||
Bool emulate3Pending;/* timer waiting */
|
|
||||||
CARD32 emulate3Expires;/* time to fire emulation code */
|
|
||||||
Bool emulateWheel;
|
|
||||||
int wheelInertia;
|
|
||||||
int wheelButton;
|
|
||||||
int negativeX; /* Button values. Unlike the Z and */
|
|
||||||
int positiveX; /* W equivalents, these are button */
|
|
||||||
int negativeY; /* values rather than button masks. */
|
|
||||||
int positiveY;
|
|
||||||
int wheelYDistance;
|
|
||||||
int wheelXDistance;
|
|
||||||
Bool autoProbe;
|
|
||||||
checkMovementsProc checkMovements;
|
|
||||||
autoProbeProc autoProbeMouse;
|
|
||||||
collectDataProc collectData;
|
|
||||||
dataGoodProc dataGood;
|
|
||||||
int angleOffset;
|
|
||||||
pointer pDragLock; /* drag lock area */
|
|
||||||
int xisbscale; /* buffer size for 1 event */
|
|
||||||
int wheelButtonTimeout;/* Timeout for the wheel button emulation */
|
|
||||||
CARD32 wheelButtonExpires;
|
|
||||||
int doubleClickSourceButtonMask;
|
|
||||||
int doubleClickTargetButton;
|
|
||||||
int doubleClickTargetButtonMask;
|
|
||||||
int doubleClickOldSourceState;
|
|
||||||
int lastMappedButtons;
|
|
||||||
int buttonMap[MSE_MAXBUTTONS];
|
|
||||||
} MouseDevRec, *MouseDevPtr;
|
|
||||||
|
|
||||||
#endif /* _XF86OSMOUSE_H_ */
|
|
|
@ -299,10 +299,6 @@
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
|
|
||||||
#ifdef __GNU__ /* GNU/Hurd */
|
|
||||||
# define USE_OSMOUSE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# ifdef __linux__
|
# ifdef __linux__
|
||||||
# include <termio.h>
|
# include <termio.h>
|
||||||
# else /* __GLIBC__ */
|
# else /* __GLIBC__ */
|
||||||
|
@ -553,8 +549,6 @@ extern int errno;
|
||||||
# define LED_SCR 0x01
|
# define LED_SCR 0x01
|
||||||
|
|
||||||
# define POSIX_TTY
|
# define POSIX_TTY
|
||||||
# define OSMOUSE_ONLY
|
|
||||||
# define MOUSE_PROTOCOL_IN_KERNEL
|
|
||||||
|
|
||||||
#define TIOCM_DTR 0x0001 /* data terminal ready */
|
#define TIOCM_DTR 0x0001 /* data terminal ready */
|
||||||
#define TIOCM_RTS 0x0002 /* request to send */
|
#define TIOCM_RTS 0x0002 /* request to send */
|
||||||
|
@ -665,12 +659,6 @@ double RInt(
|
||||||
#define VT_SYSREQ_DEFAULT FALSE
|
#define VT_SYSREQ_DEFAULT FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef OSMOUSE_ONLY
|
|
||||||
# ifndef MOUSE_PROTOCOL_IN_KERNEL
|
|
||||||
# define MOUSE_PROTOCOL_IN_KERNEL
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
|
#define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
|
||||||
|
|
||||||
#define XF86_OS_PRIVS
|
#define XF86_OS_PRIVS
|
||||||
|
|
Loading…
Reference in New Issue