mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
68 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
990540fa19 | ||
|
|
b8945e61eb | ||
|
|
97dc45b769 | ||
|
|
ec6cb31cc4 | ||
|
|
ed47c7f33e | ||
|
|
899218e181 | ||
|
|
421585fda6 | ||
|
|
8697811f56 | ||
|
|
b06bffdc97 | ||
|
|
9410e452d2 | ||
|
|
516e538da4 | ||
|
|
1f38e1bc11 | ||
|
|
456579ba30 | ||
|
|
21a2ac818e | ||
|
|
4c21624240 | ||
|
|
6e244b1098 | ||
|
|
e7c301563a | ||
|
|
ffc2c9961f | ||
|
|
7c01cff1fa | ||
|
|
e6e20c1b3e | ||
|
|
b27d03b248 | ||
|
|
ba78428ed5 | ||
|
|
041a1f246a | ||
|
|
44b80d177f | ||
|
|
7bbbce9a83 | ||
|
|
35b6085bf8 | ||
|
|
539d67505c | ||
|
|
a77dea1caa | ||
|
|
5fb1e841eb | ||
|
|
a4f2d12cd8 | ||
|
|
6b5c0401e2 | ||
|
|
993e011b91 | ||
|
|
2d5e922a6d | ||
|
|
41a38ec886 | ||
|
|
b31c00efea | ||
|
|
b48dcfa3f2 | ||
|
|
44baa36b99 | ||
|
|
7fa5982d47 | ||
|
|
fe8d0fa11a | ||
|
|
09b918db86 | ||
|
|
9dbace89be | ||
|
|
aaf65e7bfa | ||
|
|
8eede7ea8d | ||
|
|
1936632cb0 | ||
|
|
0dc931e1ac | ||
|
|
d525b48a2f | ||
|
|
801778c310 | ||
|
|
99505011d1 | ||
|
|
fd036680c2 | ||
|
|
e81cd935cf | ||
|
|
0b5844ce67 | ||
|
|
d6beb16be2 | ||
|
|
2f5a0fb698 | ||
|
|
1b0df04abe | ||
|
|
2ca24a16f0 | ||
|
|
7b285a802b | ||
|
|
f187badb71 | ||
|
|
0e9d75ba68 | ||
|
|
3a6d27b83d | ||
|
|
886e303af1 | ||
|
|
3d23ef4888 | ||
|
|
c0473e4921 | ||
|
|
afc9e91765 | ||
|
|
c1f16a4f59 | ||
|
|
a0f7f34dc5 | ||
|
|
11669d8279 | ||
|
|
9cbffda910 | ||
|
|
59056e656c |
76
.gitignore
vendored
76
.gitignore
vendored
@@ -1,28 +1,78 @@
|
||||
*.patch
|
||||
ChangeLog
|
||||
Makefile
|
||||
Makefile.in
|
||||
#
|
||||
# X.Org module default exclusion patterns
|
||||
# The next section if for module specific patterns
|
||||
#
|
||||
# Do not edit the following section
|
||||
# GNU Build System (Autotools)
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
autom4te.cache/
|
||||
autoscan.log
|
||||
ChangeLog
|
||||
compile
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config-ml.in
|
||||
config.py
|
||||
config.status
|
||||
config.status.lineno
|
||||
config.sub
|
||||
configure
|
||||
configure.scan
|
||||
depcomp
|
||||
.deps/
|
||||
INSTALL
|
||||
install-sh
|
||||
.libs/
|
||||
libtool
|
||||
libtool.m4
|
||||
ltmain.sh
|
||||
man/evdev.4
|
||||
lt~obsolete.m4
|
||||
ltoptions.m4
|
||||
ltsugar.m4
|
||||
ltversion.m4
|
||||
Makefile
|
||||
Makefile.in
|
||||
mdate-sh
|
||||
missing
|
||||
.deps
|
||||
.libs
|
||||
*.lo
|
||||
*.la
|
||||
stamp-h1
|
||||
xf86-input-evdev-*.tar.*
|
||||
mkinstalldirs
|
||||
*.pc
|
||||
py-compile
|
||||
stamp-h?
|
||||
symlink-tree
|
||||
texinfo.tex
|
||||
ylwrap
|
||||
|
||||
# Do not edit the following section
|
||||
# Edit Compile Debug Document Distribute
|
||||
*~
|
||||
tags
|
||||
*.[0-9]
|
||||
*.[0-9]x
|
||||
*.bak
|
||||
*.bin
|
||||
core
|
||||
*.dll
|
||||
*.exe
|
||||
*-ISO*.bdf
|
||||
*-JIS*.bdf
|
||||
*-KOI8*.bdf
|
||||
*.kld
|
||||
*.ko
|
||||
*.ko.cmd
|
||||
*.lai
|
||||
*.l[oa]
|
||||
*.[oa]
|
||||
*.obj
|
||||
*.patch
|
||||
*.so
|
||||
*.pcf.gz
|
||||
*.pdb
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
#
|
||||
# Add & Override patterns for xf86-input-evdev
|
||||
#
|
||||
# Edit the following section as needed
|
||||
# For example, !report.pc overrides *.pc. See 'man gitignore'
|
||||
#
|
||||
|
||||
72
COPYING
72
COPYING
@@ -1,57 +1,11 @@
|
||||
Various copyright notices found in this driver:
|
||||
|
||||
Copyright © 2004-2008 Red Hat, Inc.
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software
|
||||
and its documentation for any purpose is hereby granted without
|
||||
fee, provided that the above copyright notice appear in all copies
|
||||
and that both that copyright notice and this permission notice
|
||||
appear in supporting documentation, and that the name of Red Hat
|
||||
not be used in advertising or publicity pertaining to distribution
|
||||
of the software without specific, written prior permission. Red
|
||||
Hat makes no representations about the suitability of this software
|
||||
for any purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of the copyright holders 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 holders.
|
||||
|
||||
Copyright © 2008 University of South Australia
|
||||
copyrights taken from xf86-input-mouse, partly valid for this driver.
|
||||
Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
||||
Copyright 1993 by David Dawes <dawes@xfree86.org>
|
||||
Copyright 2002 by SuSE Linux AG, Author: Egbert Eich
|
||||
Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||
Copyright 2002 by Paul Elliott
|
||||
Copyright © 2008 University of South Australia
|
||||
Copyright 2008 by Chris Salch
|
||||
Copyright © 2008 Red Hat, Inc.
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software
|
||||
and its documentation for any purpose is hereby granted without
|
||||
@@ -72,6 +26,26 @@ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, 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 (including the next
|
||||
paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
|
||||
Copyright 2005 Adam Jackson.
|
||||
|
||||
|
||||
12
Makefile.am
12
Makefile.am
@@ -18,23 +18,23 @@
|
||||
# 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.
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
# Ensure headers are installed below $(prefix) for distcheck
|
||||
# Provide an sdk location that is writable by the evdev module
|
||||
DISTCHECK_CONFIGURE_FLAGS = --with-sdkdir='$${includedir}/xorg'
|
||||
|
||||
SUBDIRS = src man include
|
||||
MAINTAINERCLEANFILES = ChangeLog INSTALL
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = xorg-evdev.pc
|
||||
|
||||
EXTRA_DIST = ChangeLog
|
||||
|
||||
MAINTAINERCLEANFILES=ChangeLog
|
||||
.PHONY: ChangeLog INSTALL
|
||||
|
||||
.PHONY: ChangeLog
|
||||
INSTALL:
|
||||
$(INSTALL_CMD)
|
||||
|
||||
ChangeLog:
|
||||
$(CHANGELOG_CMD)
|
||||
|
||||
dist-hook: ChangeLog
|
||||
dist-hook: ChangeLog INSTALL
|
||||
|
||||
59
configure.ac
59
configure.ac
@@ -20,31 +20,34 @@
|
||||
#
|
||||
# Process this file with autoconf to produce a configure script
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
# Initialize Autoconf
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([xf86-input-evdev],
|
||||
2.3.3,
|
||||
[2.5.0],
|
||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||
xf86-input-evdev)
|
||||
|
||||
[xf86-input-evdev])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_AUX_DIR(.)
|
||||
AM_INIT_AUTOMAKE([dist-bzip2])
|
||||
|
||||
# Initialize Automake
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
# Require xorg-macros: XORG_DEFAULT_OPTIONS
|
||||
m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.3 or later before running autoconf/autogen])])
|
||||
XORG_MACROS_VERSION(1.3)
|
||||
AM_CONFIG_HEADER([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
# Initialize libtool
|
||||
AC_DISABLE_STATIC
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_CC
|
||||
|
||||
# Initialize X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
|
||||
m4_ifndef([XORG_MACROS_VERSION],
|
||||
[m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
|
||||
XORG_MACROS_VERSION(1.8)
|
||||
XORG_DEFAULT_OPTIONS
|
||||
|
||||
AH_TOP([#include "xorg-server.h"])
|
||||
# Obtain compiler/linker options from server and required extensions
|
||||
PKG_CHECK_MODULES(XORG, xorg-server xproto inputproto)
|
||||
|
||||
# Define a configure option for an alternate input module directory
|
||||
AC_ARG_WITH(xorg-module-dir,
|
||||
AC_HELP_STRING([--with-xorg-module-dir=DIR],
|
||||
[Default xorg module directory [[default=$libdir/xorg/modules]]]),
|
||||
@@ -53,25 +56,21 @@ AC_ARG_WITH(xorg-module-dir,
|
||||
inputdir=${moduledir}/input
|
||||
AC_SUBST(inputdir)
|
||||
|
||||
# Checks for pkg-config packages. We need to be able to override sdkdir
|
||||
# to satisfy silly distcheck requirements.
|
||||
PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES)
|
||||
XORG_CFLAGS="$CWARNFLAGS $XORG_CFLAGS"
|
||||
AC_ARG_WITH([sdkdir], [],
|
||||
[sdkdir="$withval"],
|
||||
[sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`])
|
||||
# X Server SDK location is required to install evdev header files
|
||||
# This location is also relayed in the xorg-evdev.pc file
|
||||
sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
|
||||
|
||||
# Workaround overriding sdkdir to be able to create a tarball when user has no
|
||||
# write permission in sdkdir. See DISTCHECK_CONFIGURE_FLAGS in Makefile.am
|
||||
AC_ARG_WITH([sdkdir], [], [sdkdir="$withval"])
|
||||
AC_SUBST([sdkdir])
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
DRIVER_NAME=evdev
|
||||
AC_SUBST([DRIVER_NAME])
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
src/Makefile
|
||||
man/Makefile
|
||||
include/Makefile
|
||||
xorg-evdev.pc])
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
man/Makefile
|
||||
include/Makefile
|
||||
xorg-evdev.pc])
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
EXTRA_DIST = evdev-properties.h
|
||||
sdk_HEADERS = evdev-properties.h
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
/* Reopen attempts. */
|
||||
/* CARD8 */
|
||||
#define EVDEV_PROP_REOPEN "Evdev Reopen Attempts"
|
||||
#define EVDEV_PROP_REOPEN "Evdev Reopen Attempts" /* OBSOLETE */
|
||||
|
||||
/* Run-time calibration */
|
||||
/* CARD32, 4 values [minx, maxx, miny, maxy], or no values for unset */
|
||||
|
||||
@@ -1,57 +1,37 @@
|
||||
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation.
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the copyright holders 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 holders.
|
||||
#
|
||||
# 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 (including the next
|
||||
# paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
#
|
||||
|
||||
drivermandir = $(DRIVER_MAN_DIR)
|
||||
|
||||
driverman_PRE = @DRIVER_NAME@.man
|
||||
driverman_PRE = $(DRIVER_NAME).man
|
||||
|
||||
driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
|
||||
driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX))
|
||||
|
||||
EXTRA_DIST = @DRIVER_NAME@.man
|
||||
EXTRA_DIST = $(DRIVER_NAME).man
|
||||
|
||||
CLEANFILES = $(driverman_DATA)
|
||||
|
||||
SED = sed
|
||||
|
||||
# Strings to replace in man pages
|
||||
XORGRELSTRING = @PACKAGE_STRING@
|
||||
XORGMANNAME = X Version 11
|
||||
|
||||
MAN_SUBSTS = \
|
||||
-e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
|
||||
-e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
|
||||
-e 's|__xservername__|Xorg|g' \
|
||||
-e 's|__xconfigfile__|xorg.conf|g' \
|
||||
-e 's|__projectroot__|$(prefix)|g' \
|
||||
-e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
|
||||
-e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
|
||||
-e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
|
||||
-e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
|
||||
-e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
|
||||
|
||||
SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
|
||||
|
||||
# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
|
||||
.man.$(DRIVER_MAN_SUFFIX):
|
||||
sed $(MAN_SUBSTS) < $< > $@
|
||||
$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
|
||||
|
||||
@@ -19,15 +19,24 @@ evdev \- Generic Linux input driver
|
||||
.B evdev
|
||||
is an __xservername__ input driver for Linux\'s generic event devices. It
|
||||
therefore supports all input devices that the kernel knows about, including
|
||||
most mice and keyboards.
|
||||
most mice, keyboards, tablets and touchscreens.
|
||||
.B evdev
|
||||
is the default driver on the major Linux distributions.
|
||||
.PP
|
||||
The
|
||||
.B evdev
|
||||
driver can serve as both a pointer and a keyboard input device, and may be
|
||||
used as both the core keyboard and the core pointer. Multiple input devices
|
||||
are supported by multiple instances of this driver, with one Load
|
||||
directive for evdev in the Module section of your __xconfigfile__ for each
|
||||
input device that will use this driver.
|
||||
driver can serve as both a pointer and a keyboard input device. Multiple
|
||||
input devices are supported by multiple instances of this driver, with one
|
||||
InputDevice section of your __xconfigfile__ for each input device that will
|
||||
use this driver.
|
||||
.PP
|
||||
It is recommended that
|
||||
.B evdev
|
||||
devices are configured through the
|
||||
.B InputClass
|
||||
directive (refer to __xconfigfile__(__filemansuffix__)) instead of manual
|
||||
per-device configuration. Devices configured in the
|
||||
__xconfigfile__(__filemansuffix__) are not hot-plug capable.
|
||||
.PP
|
||||
.SH SUPPORTED HARDWARE
|
||||
In general, any input device that the kernel has a driver for can be accessed
|
||||
@@ -76,8 +85,8 @@ indicating that the next button pressed is to be
|
||||
.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q
|
||||
Enable/disable the emulation of the third (middle) mouse button for mice
|
||||
which only have two physical buttons. The third button is emulated by
|
||||
pressing both buttons simultaneously. Default: on, until a middle mouse
|
||||
button event is registered. Property: "Evdev Middle Button Emulation".
|
||||
pressing both buttons simultaneously. Default: off. Property: "Evdev Middle
|
||||
Button Emulation".
|
||||
.TP 7
|
||||
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
|
||||
Sets the timeout (in milliseconds) that the driver waits before deciding
|
||||
@@ -152,10 +161,6 @@ axes regardless of the presence of other axes. This may trigger buggy
|
||||
behavior and events from this axis are always forwarded. Users are
|
||||
discouraged from setting this option.
|
||||
.TP 7
|
||||
.BI "Option \*qReopenAttempts\*q \*q" integer \*q
|
||||
Number of reopen attempts after a read error occurs on the device (e.g. after
|
||||
waking up from suspend). In between each attempt is a 100ms wait. Default: 10.
|
||||
.TP 7
|
||||
.BI "Option \*qCalibration\*q \*q" "min-x max-x min-y max-y" \*q
|
||||
Calibrates the X and Y axes for devices that need to scale to a different
|
||||
coordinate system than reported to the X server. This feature is required
|
||||
@@ -164,6 +169,11 @@ originally reported by the kernel (e.g. touchscreens). The scaling to the
|
||||
custom coordinate system is done in-driver and the X server is unaware of
|
||||
the transformation. Property: "Evdev Axis Calibration".
|
||||
.TP 7
|
||||
.B Option \*qMode\*q \*qRelative\*q\fP|\fP\*qAbsolute\*q
|
||||
Sets the mode of the device if device has absolute axes.
|
||||
The default value for touchpads is relative, for other absolute.
|
||||
This option has no effect on devices without absolute axes.
|
||||
.TP 7
|
||||
.BI "Option \*qSwapAxes\*q \*q" Bool \*q
|
||||
Swap x/y axes. Default: off. Property: "Evdev Axes Swap".
|
||||
.TP 7
|
||||
@@ -226,7 +236,6 @@ value.
|
||||
1 16-bit positive value.
|
||||
|
||||
.SH AUTHORS
|
||||
Kristian Høgsberg.
|
||||
Kristian Høgsberg, Peter Hutterer
|
||||
.SH "SEE ALSO"
|
||||
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
|
||||
README.mouse.
|
||||
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
|
||||
# _ladir passes a dummy rpath to libtool so the thing will actually link
|
||||
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
||||
AM_CFLAGS = $(XORG_CFLAGS)
|
||||
|
||||
AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
|
||||
AM_CPPFLAGS =-I$(top_srcdir)/include
|
||||
|
||||
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
|
||||
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
|
||||
@DRIVER_NAME@_drv_ladir = @inputdir@
|
||||
|
||||
INCLUDES=-I$(top_srcdir)/include/
|
||||
|
||||
@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \
|
||||
@DRIVER_NAME@.h \
|
||||
emuMB.c \
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "evdev.h"
|
||||
|
||||
#include <xf86.h>
|
||||
#include <xf86Xinput.h>
|
||||
@@ -42,7 +43,6 @@
|
||||
#include <exevents.h>
|
||||
|
||||
#include <evdev-properties.h>
|
||||
#include "evdev.h"
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
static Atom prop_dlock = 0; /* Drag lock buttons. */
|
||||
@@ -145,6 +145,8 @@ EvdevDragLockPreInit(InputInfoPtr pInfo)
|
||||
if (next_num != NULL && *next_num == '\0')
|
||||
next_num = NULL;
|
||||
}
|
||||
|
||||
free(option_string);
|
||||
}
|
||||
|
||||
/* Updates DragLock button state and fires button event messges */
|
||||
|
||||
37
src/emuMB.c
37
src/emuMB.c
@@ -34,19 +34,14 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "evdev.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
#include <xf86.h>
|
||||
#include <xf86Xinput.h>
|
||||
#include <exevents.h>
|
||||
|
||||
#include <evdev-properties.h>
|
||||
#include "evdev.h"
|
||||
|
||||
enum {
|
||||
MBEMU_DISABLED = 0,
|
||||
MBEMU_ENABLED,
|
||||
MBEMU_AUTO
|
||||
};
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
static Atom prop_mbemu = 0; /* Middle button emulation on/off property */
|
||||
@@ -231,11 +226,6 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
||||
if (!pEvdev->emulateMB.enabled)
|
||||
return ret;
|
||||
|
||||
if (button == 2) {
|
||||
EvdevMBEmuEnable(pInfo, FALSE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* don't care about other buttons */
|
||||
if (button != 1 && button != 3)
|
||||
return ret;
|
||||
@@ -309,17 +299,10 @@ void
|
||||
EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
||||
{
|
||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||
pEvdev->emulateMB.enabled = MBEMU_AUTO;
|
||||
|
||||
if (xf86FindOption(pInfo->options, "Emulate3Buttons"))
|
||||
{
|
||||
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
|
||||
"Emulate3Buttons",
|
||||
MBEMU_ENABLED);
|
||||
xf86Msg(X_INFO, "%s: Forcing middle mouse button emulation %s.\n",
|
||||
pInfo->name, (pEvdev->emulateMB.enabled) ? "on" : "off");
|
||||
}
|
||||
|
||||
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
|
||||
"Emulate3Buttons",
|
||||
FALSE);
|
||||
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
|
||||
"Emulate3Timeout", 50);
|
||||
}
|
||||
@@ -347,16 +330,6 @@ EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
||||
|
||||
}
|
||||
|
||||
/* Enable/disable middle mouse button emulation. */
|
||||
void
|
||||
EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
|
||||
{
|
||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||
if (pEvdev->emulateMB.enabled == MBEMU_AUTO)
|
||||
pEvdev->emulateMB.enabled = enable;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
static int
|
||||
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "evdev.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
#include <xf86.h>
|
||||
@@ -40,7 +41,6 @@
|
||||
#include <exevents.h>
|
||||
|
||||
#include <evdev-properties.h>
|
||||
#include "evdev.h"
|
||||
|
||||
#define WHEEL_NOT_CONFIGURED 0
|
||||
|
||||
@@ -100,6 +100,7 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||
WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
|
||||
int value = pEv->value;
|
||||
int oldValue;
|
||||
|
||||
/* Has wheel emulation been configured to be enabled? */
|
||||
if (!pEvdev->emulateWheel.enabled)
|
||||
@@ -118,12 +119,21 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
}
|
||||
|
||||
/* We don't want to intercept real mouse wheel events */
|
||||
if(pEv->type == EV_ABS) {
|
||||
oldValue = pEvdev->vals[pEvdev->axis_map[pEv->code]];
|
||||
pEvdev->vals[pEvdev->axis_map[pEv->code]] = value;
|
||||
value -= oldValue; /* make value into a differential measurement */
|
||||
}
|
||||
|
||||
switch(pEv->code) {
|
||||
|
||||
/* ABS_X has the same value as REL_X, so this case catches both */
|
||||
case REL_X:
|
||||
pAxis = &(pEvdev->emulateWheel.X);
|
||||
pOtherAxis = &(pEvdev->emulateWheel.Y);
|
||||
break;
|
||||
|
||||
/* ABS_Y has the same value as REL_Y, so this case catches both */
|
||||
case REL_Y:
|
||||
pAxis = &(pEvdev->emulateWheel.Y);
|
||||
pOtherAxis = &(pEvdev->emulateWheel.X);
|
||||
@@ -133,11 +143,11 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we found REL_X or REL_Y, emulate a mouse wheel.
|
||||
Reset the inertia of the other axis when a scroll event was sent
|
||||
to avoid the buildup of erroneous scroll events if the user
|
||||
doesn't move in a perfectly straight line.
|
||||
*/
|
||||
/* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
|
||||
wheel. Reset the inertia of the other axis when a scroll event
|
||||
was sent to avoid the buildup of erroneous scroll events if the
|
||||
user doesn't move in a perfectly straight line.
|
||||
*/
|
||||
if (pAxis)
|
||||
{
|
||||
if (EvdevWheelEmuInertia(pInfo, pAxis, value))
|
||||
@@ -222,13 +232,13 @@ EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char* axis_
|
||||
} else {
|
||||
xf86Msg(X_WARNING, "%s: Invalid %s value:\"%s\"\n",
|
||||
pInfo->name, axis_name, option_string);
|
||||
|
||||
}
|
||||
free(option_string);
|
||||
|
||||
/* Clean up and log what happened */
|
||||
if (msg) {
|
||||
xf86Msg(X_CONFIG, "%s: %s: %s\n",pInfo->name, axis_name, msg);
|
||||
xfree(msg);
|
||||
free(msg);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
547
src/evdev.c
547
src/evdev.c
@@ -31,8 +31,12 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include "evdev.h"
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/extensions/XI.h>
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
@@ -44,8 +48,6 @@
|
||||
#include <xorgVersion.h>
|
||||
#include <xkbsrv.h>
|
||||
|
||||
#include "evdev.h"
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
#include <X11/Xatom.h>
|
||||
#include <evdev-properties.h>
|
||||
@@ -64,35 +66,8 @@
|
||||
#define MAXDEVICES MAX_DEVICES
|
||||
#endif
|
||||
|
||||
/* 2.4 compatibility */
|
||||
#ifndef EVIOCGRAB
|
||||
#define EVIOCGRAB _IOW('E', 0x90, int)
|
||||
#endif
|
||||
|
||||
#ifndef BTN_TASK
|
||||
#define BTN_TASK 0x117
|
||||
#endif
|
||||
|
||||
#ifndef EV_SYN
|
||||
#define EV_SYN EV_RST
|
||||
#endif
|
||||
/* end compat */
|
||||
|
||||
#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
|
||||
|
||||
/* evdev flags */
|
||||
#define EVDEV_KEYBOARD_EVENTS (1 << 0)
|
||||
#define EVDEV_BUTTON_EVENTS (1 << 1)
|
||||
#define EVDEV_RELATIVE_EVENTS (1 << 2)
|
||||
#define EVDEV_ABSOLUTE_EVENTS (1 << 3)
|
||||
#define EVDEV_TOUCHPAD (1 << 4)
|
||||
#define EVDEV_INITIALIZED (1 << 5) /* WheelInit etc. called already? */
|
||||
#define EVDEV_TOUCHSCREEN (1 << 6)
|
||||
#define EVDEV_CALIBRATED (1 << 7) /* run-time calibrated? */
|
||||
#define EVDEV_TABLET (1 << 8) /* device looks like a tablet? */
|
||||
#define EVDEV_UNIGNORE_ABSOLUTE (1 << 9) /* explicitly unignore abs axes */
|
||||
#define EVDEV_UNIGNORE_RELATIVE (1 << 10) /* explicitly unignore rel axes */
|
||||
|
||||
#define MIN_KEYCODE 8
|
||||
#define GLYPHS_PER_KEY 2
|
||||
#define AltMask Mod1Mask
|
||||
@@ -117,6 +92,10 @@ static const char *evdevDefaults[] = {
|
||||
static int EvdevOn(DeviceIntPtr);
|
||||
static int EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare);
|
||||
static void EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
|
||||
static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode);
|
||||
static BOOL EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab);
|
||||
static void EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4]);
|
||||
static BOOL EvdevOpenDevice(InputInfoPtr pInfo);
|
||||
|
||||
#ifdef HAVE_PROPERTIES
|
||||
static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms);
|
||||
@@ -125,7 +104,6 @@ static void EvdevInitProperty(DeviceIntPtr dev);
|
||||
static int EvdevSetProperty(DeviceIntPtr dev, Atom atom,
|
||||
XIPropertyValuePtr val, BOOL checkonly);
|
||||
static Atom prop_invert = 0;
|
||||
static Atom prop_reopen = 0;
|
||||
static Atom prop_calibration = 0;
|
||||
static Atom prop_swap = 0;
|
||||
static Atom prop_axis_label = 0;
|
||||
@@ -137,6 +115,38 @@ static Atom prop_btn_label = 0;
|
||||
* cannot be used by evdev, leaving us with a space of 2 at the end. */
|
||||
static EvdevPtr evdev_devices[MAXDEVICES] = {NULL};
|
||||
|
||||
static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode)
|
||||
{
|
||||
InputInfoPtr pInfo;
|
||||
EvdevPtr pEvdev;
|
||||
|
||||
pInfo = device->public.devicePrivate;
|
||||
pEvdev = pInfo->private;
|
||||
|
||||
if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
|
||||
{
|
||||
if (mode == Relative)
|
||||
return Success;
|
||||
else
|
||||
return XI_BadMode;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case Absolute:
|
||||
pEvdev->flags &= ~EVDEV_RELATIVE_MODE;
|
||||
break;
|
||||
|
||||
case Relative:
|
||||
pEvdev->flags |= EVDEV_RELATIVE_MODE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return XI_BadMode;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static size_t CountBits(unsigned long *array, size_t nlongs)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -239,7 +249,7 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
|
||||
|
||||
if ((s = xf86SetStrOption(pInfo->options, name, NULL))) {
|
||||
if (!s[0]) {
|
||||
xfree(s);
|
||||
free(s);
|
||||
*option = NULL;
|
||||
} else {
|
||||
*option = s;
|
||||
@@ -256,7 +266,6 @@ void
|
||||
EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
|
||||
{
|
||||
int code = ev->code + MIN_KEYCODE;
|
||||
static char warned[KEY_CNT];
|
||||
EventQueuePtr pQueue;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
@@ -274,19 +283,6 @@ EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value)
|
||||
)
|
||||
return;
|
||||
|
||||
if (code > 255)
|
||||
{
|
||||
if (ev->code <= KEY_MAX && !warned[ev->code])
|
||||
{
|
||||
xf86Msg(X_WARNING, "%s: unable to handle keycode %d\n",
|
||||
pInfo->name, ev->code);
|
||||
warned[ev->code] = 1;
|
||||
}
|
||||
|
||||
/* The X server can't handle keycodes > 255. */
|
||||
return;
|
||||
}
|
||||
|
||||
if (pEvdev->num_queue >= EVDEV_MAXQUEUE)
|
||||
{
|
||||
xf86Msg(X_NONE, "%s: dropping event due to full queue!\n", pInfo->name);
|
||||
@@ -340,56 +336,6 @@ EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Coming back from resume may leave us with a file descriptor that can be
|
||||
* opened but fails on the first read (ENODEV).
|
||||
* In this case, try to open the device until it becomes available or until
|
||||
* the predefined count expires.
|
||||
*/
|
||||
static CARD32
|
||||
EvdevReopenTimer(OsTimerPtr timer, CARD32 time, pointer arg)
|
||||
{
|
||||
InputInfoPtr pInfo = (InputInfoPtr)arg;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
do {
|
||||
pInfo->fd = open(pEvdev->device, O_RDWR | O_NONBLOCK, 0);
|
||||
} while (pInfo->fd < 0 && errno == EINTR);
|
||||
|
||||
if (pInfo->fd != -1)
|
||||
{
|
||||
if (EvdevCacheCompare(pInfo, TRUE) == Success)
|
||||
{
|
||||
xf86Msg(X_INFO, "%s: Device reopened after %d attempts.\n", pInfo->name,
|
||||
pEvdev->reopen_attempts - pEvdev->reopen_left + 1);
|
||||
EvdevOn(pInfo->dev);
|
||||
} else
|
||||
{
|
||||
xf86Msg(X_ERROR, "%s: Device has changed - disabling.\n",
|
||||
pInfo->name);
|
||||
xf86DisableDevice(pInfo->dev, FALSE);
|
||||
close(pInfo->fd);
|
||||
pInfo->fd = -1;
|
||||
pEvdev->min_maj = 0; /* don't hog the device */
|
||||
}
|
||||
pEvdev->reopen_left = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
pEvdev->reopen_left--;
|
||||
|
||||
if (pEvdev->reopen_left <= 0)
|
||||
{
|
||||
xf86Msg(X_ERROR, "%s: Failed to reopen device after %d attempts.\n",
|
||||
pInfo->name, pEvdev->reopen_attempts);
|
||||
xf86DisableDevice(pInfo->dev, FALSE);
|
||||
pEvdev->min_maj = 0; /* don't hog the device */
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 100; /* come back in 100 ms */
|
||||
}
|
||||
|
||||
#define ABS_X_VALUE 0x1
|
||||
#define ABS_Y_VALUE 0x2
|
||||
#define ABS_VALUE 0x4
|
||||
@@ -406,7 +352,7 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
|
||||
*num_v = *first_v = 0;
|
||||
|
||||
/* convert to relative motion for touchpads */
|
||||
if (pEvdev->abs && (pEvdev->flags & EVDEV_TOUCHPAD)) {
|
||||
if (pEvdev->abs && (pEvdev->flags & EVDEV_RELATIVE_MODE)) {
|
||||
if (pEvdev->tool) { /* meaning, touch is active */
|
||||
if (pEvdev->old_vals[0] != -1)
|
||||
pEvdev->delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0];
|
||||
@@ -440,7 +386,7 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
|
||||
for (i = 0; i < REL_CNT; i++)
|
||||
{
|
||||
int map = pEvdev->axis_map[i];
|
||||
if (map != -1)
|
||||
if (pEvdev->delta[i] && map != -1)
|
||||
{
|
||||
v[map] = pEvdev->delta[i];
|
||||
if (map < first)
|
||||
@@ -532,14 +478,12 @@ EvdevProcessButtonEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
static void
|
||||
EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
{
|
||||
static int value;
|
||||
int value;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
/* Get the signed value, earlier kernels had this as unsigned */
|
||||
value = ev->value;
|
||||
|
||||
pEvdev->rel = 1;
|
||||
|
||||
switch (ev->code) {
|
||||
case REL_WHEEL:
|
||||
if (value > 0)
|
||||
@@ -566,6 +510,7 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
if (EvdevWheelEmuFilterMotion(pInfo, ev))
|
||||
return;
|
||||
|
||||
pEvdev->rel = 1;
|
||||
pEvdev->delta[ev->code] += value;
|
||||
break;
|
||||
}
|
||||
@@ -577,7 +522,7 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
static void
|
||||
EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
{
|
||||
static int value;
|
||||
int value;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
/* Get the signed value, earlier kernels had this as unsigned */
|
||||
@@ -590,6 +535,9 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
if (ev->code > ABS_MAX)
|
||||
return;
|
||||
|
||||
if (EvdevWheelEmuFilterMotion(pInfo, ev))
|
||||
return;
|
||||
|
||||
pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
|
||||
if (ev->code == ABS_X)
|
||||
pEvdev->abs |= ABS_X_VALUE;
|
||||
@@ -605,7 +553,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
static void
|
||||
EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
{
|
||||
static int value;
|
||||
int value;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
/* Get the signed value, earlier kernels had this as unsigned */
|
||||
@@ -629,7 +577,6 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
break;
|
||||
|
||||
case BTN_TOUCH:
|
||||
pEvdev->tool = value ? ev->code : 0;
|
||||
if (!(pEvdev->flags & (EVDEV_TOUCHSCREEN | EVDEV_TABLET)))
|
||||
break;
|
||||
/* Treat BTN_TOUCH from devices that only have BTN_TOUCH as
|
||||
@@ -671,9 +618,9 @@ EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
|
||||
* pressed. On wacom tablets, this means that the pen is in
|
||||
* proximity of the tablet. After the pen is removed, BTN_DIGI is
|
||||
* released, and a (0, 0) absolute event is generated. Checking
|
||||
* pEvdev->digi here, lets us ignore that event. pEvdev is
|
||||
* initialized to 1 so devices that doesn't use this scheme still
|
||||
* just works.
|
||||
* pEvdev->tool here, lets us ignore that event. pEvdev->tool is
|
||||
* initialized to 1 so devices that don't use this scheme still
|
||||
* just work.
|
||||
*/
|
||||
if (pEvdev->abs && pEvdev->tool) {
|
||||
xf86PostMotionEventP(pInfo->dev, TRUE, *first_v, *num_v, v);
|
||||
@@ -714,7 +661,7 @@ static void
|
||||
EvdevProcessSyncEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
{
|
||||
int num_v = 0, first_v = 0;
|
||||
int v[MAX_VALUATORS];
|
||||
int v[MAX_VALUATORS] = {};
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
EvdevProcessValuators(pInfo, v, &num_v, &first_v);
|
||||
@@ -765,7 +712,6 @@ EvdevReadInput(InputInfoPtr pInfo)
|
||||
{
|
||||
struct input_event ev[NUM_EVENTS];
|
||||
int i, len = sizeof(ev);
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
while (len == sizeof(ev))
|
||||
{
|
||||
@@ -778,11 +724,6 @@ EvdevReadInput(InputInfoPtr pInfo)
|
||||
xf86RemoveEnabledDevice(pInfo);
|
||||
close(pInfo->fd);
|
||||
pInfo->fd = -1;
|
||||
if (pEvdev->reopen_timer)
|
||||
{
|
||||
pEvdev->reopen_left = pEvdev->reopen_attempts;
|
||||
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo);
|
||||
}
|
||||
} else if (errno != EAGAIN)
|
||||
{
|
||||
/* We use X_NONE here because it doesn't alloc */
|
||||
@@ -1207,12 +1148,18 @@ EvdevAddAbsClass(DeviceIntPtr device)
|
||||
num_axes = CountBits(pEvdev->abs_bitmask, NLONGS(ABS_MAX));
|
||||
if (num_axes < 1)
|
||||
return !Success;
|
||||
|
||||
if (num_axes > MAX_VALUATORS) {
|
||||
xf86Msg(X_WARNING, "%s: found %d axes, limiting to %d.\n", device->name, num_axes, MAX_VALUATORS);
|
||||
num_axes = MAX_VALUATORS;
|
||||
}
|
||||
|
||||
pEvdev->num_vals = num_axes;
|
||||
memset(pEvdev->vals, 0, num_axes * sizeof(int));
|
||||
memset(pEvdev->old_vals, -1, num_axes * sizeof(int));
|
||||
atoms = xalloc(pEvdev->num_vals * sizeof(Atom));
|
||||
atoms = malloc(pEvdev->num_vals * sizeof(Atom));
|
||||
|
||||
for (axis = ABS_X; axis <= ABS_MAX; axis++) {
|
||||
for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) {
|
||||
pEvdev->axis_map[axis] = -1;
|
||||
if (!TestBit(axis, pEvdev->abs_bitmask))
|
||||
continue;
|
||||
@@ -1234,20 +1181,29 @@ EvdevAddAbsClass(DeviceIntPtr device)
|
||||
|
||||
for (axis = ABS_X; axis <= ABS_MAX; axis++) {
|
||||
int axnum = pEvdev->axis_map[axis];
|
||||
int resolution = 10000;
|
||||
|
||||
if (axnum == -1)
|
||||
continue;
|
||||
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 30)
|
||||
/* Kernel provides units/mm, X wants units/m */
|
||||
if (pEvdev->absinfo[axis].resolution)
|
||||
resolution = pEvdev->absinfo[axis].resolution * 1000;
|
||||
#endif
|
||||
|
||||
xf86InitValuatorAxisStruct(device, axnum,
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
|
||||
atoms[axnum],
|
||||
#endif
|
||||
pEvdev->absinfo[axis].minimum,
|
||||
pEvdev->absinfo[axis].maximum,
|
||||
10000, 0, 10000);
|
||||
resolution, 0, resolution);
|
||||
xf86InitValuatorDefaults(device, axnum);
|
||||
pEvdev->old_vals[axnum] = -1;
|
||||
}
|
||||
|
||||
xfree(atoms);
|
||||
free(atoms);
|
||||
|
||||
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
|
||||
return !Success;
|
||||
@@ -1268,6 +1224,24 @@ EvdevAddAbsClass(DeviceIntPtr device)
|
||||
TestBit(ABS_TILT_Y, pEvdev->abs_bitmask)))
|
||||
pInfo->flags |= XI86_POINTER_CAPABLE;
|
||||
|
||||
if (pEvdev->flags & EVDEV_TOUCHPAD)
|
||||
pEvdev->flags |= EVDEV_RELATIVE_MODE;
|
||||
else
|
||||
pEvdev->flags &= ~EVDEV_RELATIVE_MODE;
|
||||
|
||||
if (xf86FindOption(pInfo->options, "Mode"))
|
||||
{
|
||||
char *mode;
|
||||
mode = xf86SetStrOption(pInfo->options, "Mode", NULL);
|
||||
if (!strcasecmp("absolute", mode))
|
||||
pEvdev->flags &= ~EVDEV_RELATIVE_MODE;
|
||||
else if (!strcasecmp("relative", mode))
|
||||
pEvdev->flags |= EVDEV_RELATIVE_MODE;
|
||||
else
|
||||
xf86Msg(X_INFO, "%s: unknown mode, use default\n", pInfo->name);
|
||||
free(mode);
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -1301,11 +1275,16 @@ EvdevAddRelClass(DeviceIntPtr device)
|
||||
if (num_axes <= 0)
|
||||
return !Success;
|
||||
|
||||
if (num_axes > MAX_VALUATORS) {
|
||||
xf86Msg(X_WARNING, "%s: found %d axes, limiting to %d.\n", device->name, num_axes, MAX_VALUATORS);
|
||||
num_axes = MAX_VALUATORS;
|
||||
}
|
||||
|
||||
pEvdev->num_vals = num_axes;
|
||||
memset(pEvdev->vals, 0, num_axes * sizeof(int));
|
||||
atoms = xalloc(pEvdev->num_vals * sizeof(Atom));
|
||||
atoms = malloc(pEvdev->num_vals * sizeof(Atom));
|
||||
|
||||
for (axis = REL_X; axis <= REL_MAX; axis++)
|
||||
for (axis = REL_X; i < MAX_VALUATORS && axis <= REL_MAX; axis++)
|
||||
{
|
||||
pEvdev->axis_map[axis] = -1;
|
||||
/* We don't post wheel events, so ignore them here too */
|
||||
@@ -1329,6 +1308,9 @@ EvdevAddRelClass(DeviceIntPtr device)
|
||||
GetMotionHistorySize(), Relative))
|
||||
return !Success;
|
||||
|
||||
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
|
||||
return !Success;
|
||||
|
||||
for (axis = REL_X; axis <= REL_MAX; axis++)
|
||||
{
|
||||
int axnum = pEvdev->axis_map[axis];
|
||||
@@ -1343,10 +1325,7 @@ EvdevAddRelClass(DeviceIntPtr device)
|
||||
xf86InitValuatorDefaults(device, axnum);
|
||||
}
|
||||
|
||||
xfree(atoms);
|
||||
|
||||
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
|
||||
return !Success;
|
||||
free(atoms);
|
||||
|
||||
pInfo->flags |= XI86_POINTER_CAPABLE;
|
||||
|
||||
@@ -1363,7 +1342,7 @@ EvdevAddButtonClass(DeviceIntPtr device)
|
||||
pInfo = device->public.devicePrivate;
|
||||
pEvdev = pInfo->private;
|
||||
|
||||
labels = xalloc(pEvdev->num_buttons * sizeof(Atom));
|
||||
labels = malloc(pEvdev->num_buttons * sizeof(Atom));
|
||||
EvdevInitButtonLabels(pEvdev, pEvdev->num_buttons, labels);
|
||||
|
||||
if (!InitButtonClassDeviceStruct(device, pEvdev->num_buttons,
|
||||
@@ -1373,7 +1352,7 @@ EvdevAddButtonClass(DeviceIntPtr device)
|
||||
pEvdev->btnmap))
|
||||
return !Success;
|
||||
|
||||
xfree(labels);
|
||||
free(labels);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -1401,15 +1380,16 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
|
||||
/* Check for user-defined button mapping */
|
||||
if ((mapping = xf86CheckStrOption(pInfo->options, "ButtonMapping", NULL)))
|
||||
{
|
||||
char *s = " ";
|
||||
char *map, *s = " ";
|
||||
int btn = 0;
|
||||
|
||||
xf86Msg(X_CONFIG, "%s: ButtonMapping '%s'\n", pInfo->name, mapping);
|
||||
map = mapping;
|
||||
while (s && *s != '\0' && nbuttons < EVDEV_MAXBUTTONS)
|
||||
{
|
||||
btn = strtol(mapping, &s, 10);
|
||||
btn = strtol(map, &s, 10);
|
||||
|
||||
if (s == mapping || btn < 0 || btn > EVDEV_MAXBUTTONS)
|
||||
if (s == map || btn < 0 || btn > EVDEV_MAXBUTTONS)
|
||||
{
|
||||
xf86Msg(X_ERROR,
|
||||
"%s: ... Invalid button mapping. Using defaults\n",
|
||||
@@ -1419,8 +1399,9 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
|
||||
}
|
||||
|
||||
pEvdev->btnmap[nbuttons++] = btn;
|
||||
mapping = s;
|
||||
map = s;
|
||||
}
|
||||
free(mapping);
|
||||
}
|
||||
|
||||
for (i = nbuttons; i < ArrayLength(pEvdev->btnmap); i++)
|
||||
@@ -1555,56 +1536,26 @@ EvdevInit(DeviceIntPtr device)
|
||||
|
||||
/**
|
||||
* Init all extras (wheel emulation, etc.) and grab the device.
|
||||
*
|
||||
* Coming from a resume, the grab may fail with ENODEV. In this case, we set a
|
||||
* timer to wake up and try to reopen the device later.
|
||||
*/
|
||||
static int
|
||||
EvdevOn(DeviceIntPtr device)
|
||||
{
|
||||
InputInfoPtr pInfo;
|
||||
EvdevPtr pEvdev;
|
||||
int rc = 0;
|
||||
|
||||
pInfo = device->public.devicePrivate;
|
||||
pEvdev = pInfo->private;
|
||||
/* after PreInit fd is still open */
|
||||
if (!EvdevOpenDevice(pInfo))
|
||||
return !Success;
|
||||
|
||||
if (pInfo->fd != -1 && pEvdev->grabDevice &&
|
||||
(rc = ioctl(pInfo->fd, EVIOCGRAB, (void *)1)))
|
||||
{
|
||||
xf86Msg(X_WARNING, "%s: Grab failed (%s)\n", pInfo->name,
|
||||
strerror(errno));
|
||||
EvdevGrabDevice(pInfo, 1, 0);
|
||||
|
||||
/* ENODEV - device has disappeared after resume */
|
||||
if (rc && errno == ENODEV)
|
||||
{
|
||||
close(pInfo->fd);
|
||||
pInfo->fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (pInfo->fd == -1)
|
||||
{
|
||||
pEvdev->reopen_left = pEvdev->reopen_attempts;
|
||||
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 100, EvdevReopenTimer, pInfo);
|
||||
} else
|
||||
{
|
||||
pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
|
||||
if (EvdevIsDuplicate(pInfo))
|
||||
{
|
||||
xf86Msg(X_WARNING, "%s: Refusing to enable duplicate device.\n",
|
||||
pInfo->name);
|
||||
return !Success;
|
||||
}
|
||||
|
||||
pEvdev->reopen_timer = TimerSet(pEvdev->reopen_timer, 0, 0, NULL, NULL);
|
||||
|
||||
xf86FlushInput(pInfo->fd);
|
||||
xf86AddEnabledDevice(pInfo);
|
||||
EvdevMBEmuOn(pInfo);
|
||||
pEvdev->flags |= EVDEV_INITIALIZED;
|
||||
device->public.on = TRUE;
|
||||
}
|
||||
xf86FlushInput(pInfo->fd);
|
||||
xf86AddEnabledDevice(pInfo);
|
||||
EvdevMBEmuOn(pInfo);
|
||||
pEvdev->flags |= EVDEV_INITIALIZED;
|
||||
device->public.on = TRUE;
|
||||
|
||||
return Success;
|
||||
}
|
||||
@@ -1632,9 +1583,7 @@ EvdevProc(DeviceIntPtr device, int what)
|
||||
EvdevMBEmuFinalize(pInfo);
|
||||
if (pInfo->fd != -1)
|
||||
{
|
||||
if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)0))
|
||||
xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name,
|
||||
strerror(errno));
|
||||
EvdevGrabDevice(pInfo, 0, 1);
|
||||
xf86RemoveEnabledDevice(pInfo);
|
||||
close(pInfo->fd);
|
||||
pInfo->fd = -1;
|
||||
@@ -1642,11 +1591,6 @@ EvdevProc(DeviceIntPtr device, int what)
|
||||
pEvdev->min_maj = 0;
|
||||
pEvdev->flags &= ~EVDEV_INITIALIZED;
|
||||
device->public.on = FALSE;
|
||||
if (pEvdev->reopen_timer)
|
||||
{
|
||||
TimerFree(pEvdev->reopen_timer);
|
||||
pEvdev->reopen_timer = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
case DEVICE_CLOSE:
|
||||
@@ -1675,8 +1619,7 @@ static int
|
||||
EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare)
|
||||
{
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
size_t len;
|
||||
int i;
|
||||
int i, len;
|
||||
|
||||
char name[1024] = {0};
|
||||
unsigned long bitmask[NLONGS(EV_CNT)] = {0};
|
||||
@@ -1807,27 +1750,39 @@ error:
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Issue an EVIOCGRAB on the device file, either as a grab or to ungrab, or
|
||||
* both. Return TRUE on success, otherwise FALSE. Failing the release is a
|
||||
* still considered a success, because it's not as if you could do anything
|
||||
* about it.
|
||||
*/
|
||||
static BOOL
|
||||
EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab)
|
||||
{
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
if (pEvdev->grabDevice)
|
||||
{
|
||||
if (grab && ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
|
||||
xf86Msg(X_WARNING, "%s: Grab failed (%s)\n", pInfo->name,
|
||||
strerror(errno));
|
||||
return FALSE;
|
||||
} else if (ungrab && ioctl(pInfo->fd, EVIOCGRAB, (void *)0))
|
||||
xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name,
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
EvdevProbe(InputInfoPtr pInfo)
|
||||
{
|
||||
int i, has_rel_axes, has_abs_axes, has_keys, num_buttons, has_scroll;
|
||||
int kernel24 = 0;
|
||||
int has_lmr; /* left middle right */
|
||||
int ignore_abs = 0, ignore_rel = 0;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
|
||||
if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
|
||||
if (errno == EINVAL) {
|
||||
/* keyboards are unsafe in 2.4 */
|
||||
kernel24 = 1;
|
||||
pEvdev->grabDevice = 0;
|
||||
} else {
|
||||
xf86Msg(X_ERROR, "Grab failed. Device already configured?\n");
|
||||
return 1;
|
||||
}
|
||||
} else if (pEvdev->grabDevice) {
|
||||
ioctl(pInfo->fd, EVIOCGRAB, (void *)0);
|
||||
}
|
||||
|
||||
/* Trinary state for ignoring axes:
|
||||
- unset: do the normal thing.
|
||||
- TRUE: explicitly ignore them.
|
||||
@@ -1853,6 +1808,7 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
has_abs_axes = FALSE;
|
||||
has_keys = FALSE;
|
||||
has_scroll = FALSE;
|
||||
has_lmr = FALSE;
|
||||
num_buttons = 0;
|
||||
|
||||
/* count all buttons */
|
||||
@@ -1867,11 +1823,15 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
}
|
||||
}
|
||||
|
||||
has_lmr = TestBit(BTN_LEFT, pEvdev->key_bitmask) ||
|
||||
TestBit(BTN_MIDDLE, pEvdev->key_bitmask) ||
|
||||
TestBit(BTN_RIGHT, pEvdev->key_bitmask);
|
||||
|
||||
if (num_buttons)
|
||||
{
|
||||
pEvdev->flags |= EVDEV_BUTTON_EVENTS;
|
||||
pEvdev->num_buttons = num_buttons;
|
||||
xf86Msg(X_INFO, "%s: Found %d mouse buttons\n", pInfo->name,
|
||||
xf86Msg(X_PROBED, "%s: Found %d mouse buttons\n", pInfo->name,
|
||||
num_buttons);
|
||||
}
|
||||
|
||||
@@ -1886,7 +1846,7 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
if (TestBit(REL_WHEEL, pEvdev->rel_bitmask) ||
|
||||
TestBit(REL_HWHEEL, pEvdev->rel_bitmask) ||
|
||||
TestBit(REL_DIAL, pEvdev->rel_bitmask)) {
|
||||
xf86Msg(X_INFO, "%s: Found scroll wheel(s)\n", pInfo->name);
|
||||
xf86Msg(X_PROBED, "%s: Found scroll wheel(s)\n", pInfo->name);
|
||||
has_scroll = TRUE;
|
||||
if (!num_buttons)
|
||||
xf86Msg(X_INFO, "%s: Forcing buttons for scroll wheel(s)\n",
|
||||
@@ -1897,12 +1857,12 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
|
||||
if (!ignore_rel)
|
||||
{
|
||||
xf86Msg(X_INFO, "%s: Found relative axes\n", pInfo->name);
|
||||
xf86Msg(X_PROBED, "%s: Found relative axes\n", pInfo->name);
|
||||
pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
|
||||
|
||||
if (TestBit(REL_X, pEvdev->rel_bitmask) &&
|
||||
TestBit(REL_Y, pEvdev->rel_bitmask)) {
|
||||
xf86Msg(X_INFO, "%s: Found x and y relative axes\n", pInfo->name);
|
||||
xf86Msg(X_PROBED, "%s: Found x and y relative axes\n", pInfo->name);
|
||||
}
|
||||
} else {
|
||||
xf86Msg(X_INFO, "%s: Relative axes present but ignored.\n", pInfo->name);
|
||||
@@ -1922,15 +1882,15 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
xf86Msg(X_INFO, "%s: Absolute axes present but ignored.\n", pInfo->name);
|
||||
has_abs_axes = FALSE;
|
||||
} else if (has_abs_axes) {
|
||||
xf86Msg(X_INFO, "%s: Found absolute axes\n", pInfo->name);
|
||||
xf86Msg(X_PROBED, "%s: Found absolute axes\n", pInfo->name);
|
||||
pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;
|
||||
|
||||
if ((TestBit(ABS_X, pEvdev->abs_bitmask) &&
|
||||
TestBit(ABS_Y, pEvdev->abs_bitmask))) {
|
||||
xf86Msg(X_INFO, "%s: Found x and y absolute axes\n", pInfo->name);
|
||||
xf86Msg(X_PROBED, "%s: Found x and y absolute axes\n", pInfo->name);
|
||||
if (TestBit(BTN_TOOL_PEN, pEvdev->key_bitmask))
|
||||
{
|
||||
xf86Msg(X_INFO, "%s: Found absolute tablet.\n", pInfo->name);
|
||||
xf86Msg(X_PROBED, "%s: Found absolute tablet.\n", pInfo->name);
|
||||
pEvdev->flags |= EVDEV_TABLET;
|
||||
if (!pEvdev->num_buttons)
|
||||
{
|
||||
@@ -1939,12 +1899,12 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
}
|
||||
} else if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) ||
|
||||
TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
|
||||
if (num_buttons || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
|
||||
xf86Msg(X_INFO, "%s: Found absolute touchpad.\n", pInfo->name);
|
||||
if (has_lmr || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
|
||||
xf86Msg(X_PROBED, "%s: Found absolute touchpad.\n", pInfo->name);
|
||||
pEvdev->flags |= EVDEV_TOUCHPAD;
|
||||
memset(pEvdev->old_vals, -1, sizeof(int) * pEvdev->num_vals);
|
||||
} else {
|
||||
xf86Msg(X_INFO, "%s: Found absolute touchscreen\n", pInfo->name);
|
||||
xf86Msg(X_PROBED, "%s: Found absolute touchscreen\n", pInfo->name);
|
||||
pEvdev->flags |= EVDEV_TOUCHSCREEN;
|
||||
pEvdev->flags |= EVDEV_BUTTON_EVENTS;
|
||||
}
|
||||
@@ -1954,13 +1914,37 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
|
||||
for (i = 0; i < BTN_MISC; i++) {
|
||||
if (TestBit(i, pEvdev->key_bitmask)) {
|
||||
xf86Msg(X_INFO, "%s: Found keys\n", pInfo->name);
|
||||
xf86Msg(X_PROBED, "%s: Found keys\n", pInfo->name);
|
||||
pEvdev->flags |= EVDEV_KEYBOARD_EVENTS;
|
||||
has_keys = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (has_rel_axes || has_abs_axes)
|
||||
{
|
||||
char *str;
|
||||
int num_calibration = 0, calibration[4] = { 0, 0, 0, 0 };
|
||||
|
||||
pEvdev->invert_x = xf86SetBoolOption(pInfo->options, "InvertX", FALSE);
|
||||
pEvdev->invert_y = xf86SetBoolOption(pInfo->options, "InvertY", FALSE);
|
||||
pEvdev->swap_axes = xf86SetBoolOption(pInfo->options, "SwapAxes", FALSE);
|
||||
|
||||
str = xf86CheckStrOption(pInfo->options, "Calibration", NULL);
|
||||
if (str) {
|
||||
num_calibration = sscanf(str, "%d %d %d %d",
|
||||
&calibration[0], &calibration[1],
|
||||
&calibration[2], &calibration[3]);
|
||||
free(str);
|
||||
if (num_calibration == 4)
|
||||
EvdevSetCalibration(pInfo, num_calibration, calibration);
|
||||
else
|
||||
xf86Msg(X_ERROR,
|
||||
"%s: Insufficient calibration factors (%d). Ignoring calibration\n",
|
||||
pInfo->name, num_calibration);
|
||||
}
|
||||
}
|
||||
|
||||
if (has_rel_axes || has_abs_axes || num_buttons) {
|
||||
pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |
|
||||
XI86_CONFIGURED;
|
||||
@@ -1980,14 +1964,9 @@ EvdevProbe(InputInfoPtr pInfo)
|
||||
}
|
||||
|
||||
if (has_keys) {
|
||||
if (kernel24) {
|
||||
xf86Msg(X_INFO, "%s: Kernel < 2.6 is too old, ignoring keyboard\n",
|
||||
pInfo->name);
|
||||
} else {
|
||||
xf86Msg(X_INFO, "%s: Configuring as keyboard\n", pInfo->name);
|
||||
pInfo->flags |= XI86_KEYBOARD_CAPABLE | XI86_CONFIGURED;
|
||||
pInfo->type_name = XI_KEYBOARD;
|
||||
}
|
||||
xf86Msg(X_INFO, "%s: Configuring as keyboard\n", pInfo->name);
|
||||
pInfo->flags |= XI86_KEYBOARD_CAPABLE | XI86_CONFIGURED;
|
||||
pInfo->type_name = XI_KEYBOARD;
|
||||
}
|
||||
|
||||
if (has_scroll && (pInfo->flags & XI86_CONFIGURED) &&
|
||||
@@ -2028,18 +2007,60 @@ EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4])
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL
|
||||
EvdevOpenDevice(InputInfoPtr pInfo)
|
||||
{
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
char *device = (char*)pEvdev->device;
|
||||
|
||||
if (!device)
|
||||
{
|
||||
device = xf86CheckStrOption(pInfo->options, "Device", NULL);
|
||||
if (!device) {
|
||||
xf86Msg(X_ERROR, "%s: No device specified.\n", pInfo->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pEvdev->device = device;
|
||||
xf86Msg(X_CONFIG, "%s: Device: \"%s\"\n", pInfo->name, device);
|
||||
}
|
||||
|
||||
if (pInfo->fd < 0)
|
||||
{
|
||||
do {
|
||||
pInfo->fd = open(device, O_RDWR | O_NONBLOCK, 0);
|
||||
} while (pInfo->fd < 0 && errno == EINTR);
|
||||
|
||||
if (pInfo->fd < 0) {
|
||||
xf86Msg(X_ERROR, "Unable to open evdev device \"%s\".\n", device);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check major/minor of device node to avoid adding duplicate devices. */
|
||||
pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
|
||||
if (EvdevIsDuplicate(pInfo))
|
||||
{
|
||||
xf86Msg(X_WARNING, "%s: device file is duplicate. Ignoring.\n",
|
||||
pInfo->name);
|
||||
close(pInfo->fd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static InputInfoPtr
|
||||
EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
||||
{
|
||||
InputInfoPtr pInfo;
|
||||
const char *device, *str;
|
||||
int num_calibration = 0, calibration[4] = { 0, 0, 0, 0 };
|
||||
EvdevPtr pEvdev;
|
||||
|
||||
if (!(pInfo = xf86AllocateInput(drv, 0)))
|
||||
return NULL;
|
||||
|
||||
/* Initialise the InputInfoRec. */
|
||||
pInfo->fd = -1;
|
||||
pInfo->name = dev->identifier;
|
||||
pInfo->flags = 0;
|
||||
pInfo->type_name = "UNKNOWN";
|
||||
@@ -2048,89 +2069,52 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
||||
pInfo->history_size = 0;
|
||||
pInfo->control_proc = NULL;
|
||||
pInfo->close_proc = NULL;
|
||||
pInfo->switch_mode = NULL;
|
||||
pInfo->switch_mode = EvdevSwitchMode;
|
||||
pInfo->conversion_proc = NULL;
|
||||
pInfo->reverse_conversion_proc = NULL;
|
||||
pInfo->dev = NULL;
|
||||
pInfo->private_flags = 0;
|
||||
pInfo->always_core_feedback = NULL;
|
||||
pInfo->conf_idev = dev;
|
||||
pInfo->private = NULL;
|
||||
|
||||
if (!(pEvdev = xcalloc(sizeof(EvdevRec), 1)))
|
||||
return pInfo;
|
||||
if (!(pEvdev = calloc(sizeof(EvdevRec), 1)))
|
||||
goto error;
|
||||
|
||||
pInfo->private = pEvdev;
|
||||
|
||||
xf86CollectInputOptions(pInfo, evdevDefaults, NULL);
|
||||
xf86ProcessCommonOptions(pInfo, pInfo->options);
|
||||
|
||||
if (!EvdevOpenDevice(pInfo))
|
||||
goto error;
|
||||
|
||||
/*
|
||||
* We initialize pEvdev->tool to 1 so that device that doesn't use
|
||||
* proximity will still report events.
|
||||
*/
|
||||
pEvdev->tool = 1;
|
||||
|
||||
device = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
|
||||
if (!device) {
|
||||
xf86Msg(X_ERROR, "%s: No device specified.\n", pInfo->name);
|
||||
xf86DeleteInput(pInfo, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pEvdev->device = device;
|
||||
|
||||
xf86Msg(X_CONFIG, "%s: Device: \"%s\"\n", pInfo->name, device);
|
||||
do {
|
||||
pInfo->fd = open(device, O_RDWR | O_NONBLOCK, 0);
|
||||
} while (pInfo->fd < 0 && errno == EINTR);
|
||||
|
||||
if (pInfo->fd < 0) {
|
||||
xf86Msg(X_ERROR, "Unable to open evdev device \"%s\".\n", device);
|
||||
xf86DeleteInput(pInfo, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check major/minor of device node to avoid adding duplicate devices. */
|
||||
pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
|
||||
if (EvdevIsDuplicate(pInfo))
|
||||
{
|
||||
xf86Msg(X_WARNING, "%s: device file already in use. Ignoring.\n",
|
||||
pInfo->name);
|
||||
close(pInfo->fd);
|
||||
xf86DeleteInput(pInfo, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pEvdev->reopen_attempts = xf86SetIntOption(pInfo->options, "ReopenAttempts", 10);
|
||||
pEvdev->invert_x = xf86SetBoolOption(pInfo->options, "InvertX", FALSE);
|
||||
pEvdev->invert_y = xf86SetBoolOption(pInfo->options, "InvertY", FALSE);
|
||||
pEvdev->swap_axes = xf86SetBoolOption(pInfo->options, "SwapAxes", FALSE);
|
||||
|
||||
str = xf86CheckStrOption(pInfo->options, "Calibration", NULL);
|
||||
if (str) {
|
||||
num_calibration = sscanf(str, "%d %d %d %d",
|
||||
&calibration[0], &calibration[1],
|
||||
&calibration[2], &calibration[3]);
|
||||
if (num_calibration == 4)
|
||||
EvdevSetCalibration(pInfo, num_calibration, calibration);
|
||||
else
|
||||
xf86Msg(X_ERROR,
|
||||
"%s: Insufficient calibration factors (%d). Ignoring calibration\n",
|
||||
pInfo->name, num_calibration);
|
||||
}
|
||||
|
||||
/* Grabbing the event device stops in-kernel event forwarding. In other
|
||||
words, it disables rfkill and the "Macintosh mouse button emulation".
|
||||
Note that this needs a server that sets the console to RAW mode. */
|
||||
pEvdev->grabDevice = xf86CheckBoolOption(dev->commonOptions, "GrabDevice", 0);
|
||||
|
||||
/* If grabDevice is set, ungrab immediately since we only want to grab
|
||||
* between DEVICE_ON and DEVICE_OFF. If we never get DEVICE_ON, don't
|
||||
* hold a grab. */
|
||||
if (!EvdevGrabDevice(pInfo, 1, 1))
|
||||
{
|
||||
xf86Msg(X_WARNING, "%s: Device may already be configured.\n",
|
||||
pInfo->name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
EvdevInitButtonMapping(pInfo);
|
||||
|
||||
if (EvdevCacheCompare(pInfo, FALSE) ||
|
||||
EvdevProbe(pInfo)) {
|
||||
close(pInfo->fd);
|
||||
xf86DeleteInput(pInfo, 0);
|
||||
return NULL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
EvdevAddDevice(pInfo);
|
||||
@@ -2143,6 +2127,12 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
|
||||
}
|
||||
|
||||
return pInfo;
|
||||
|
||||
error:
|
||||
if (pInfo->fd >= 0)
|
||||
close(pInfo->fd);
|
||||
xf86DeleteInput(pInfo, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_X_EXPORT InputDriverRec EVDEV = {
|
||||
@@ -2489,18 +2479,6 @@ EvdevInitProperty(DeviceIntPtr dev)
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
int rc;
|
||||
BOOL invert[2];
|
||||
char reopen;
|
||||
|
||||
prop_reopen = MakeAtom(EVDEV_PROP_REOPEN, strlen(EVDEV_PROP_REOPEN),
|
||||
TRUE);
|
||||
|
||||
reopen = pEvdev->reopen_attempts;
|
||||
rc = XIChangeDeviceProperty(dev, prop_reopen, XA_INTEGER, 8,
|
||||
PropModeReplace, 1, &reopen, FALSE);
|
||||
if (rc != Success)
|
||||
return;
|
||||
|
||||
XISetDevicePropertyDeletable(dev, prop_reopen, FALSE);
|
||||
|
||||
if (pEvdev->flags & (EVDEV_RELATIVE_EVENTS | EVDEV_ABSOLUTE_EVENTS))
|
||||
{
|
||||
@@ -2593,13 +2571,6 @@ EvdevSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
pEvdev->invert_x = data[0];
|
||||
pEvdev->invert_y = data[1];
|
||||
}
|
||||
} else if (atom == prop_reopen)
|
||||
{
|
||||
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
if (!checkonly)
|
||||
pEvdev->reopen_attempts = *((CARD8*)val->data);
|
||||
} else if (atom == prop_calibration)
|
||||
{
|
||||
if (val->format != 32 || val->type != XA_INTEGER)
|
||||
|
||||
18
src/evdev.h
18
src/evdev.h
@@ -34,11 +34,12 @@
|
||||
#include <linux/input.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <xorg-server.h>
|
||||
#include <xf86Xinput.h>
|
||||
#include <xf86_OSproc.h>
|
||||
#include <xkbstr.h>
|
||||
|
||||
#ifndef EV_CNT /* linux 2.4 kernels and earlier lack _CNT defines */
|
||||
#ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */
|
||||
#define EV_CNT (EV_MAX+1)
|
||||
#endif
|
||||
#ifndef KEY_CNT
|
||||
@@ -57,6 +58,20 @@
|
||||
#define EVDEV_MAXBUTTONS 32
|
||||
#define EVDEV_MAXQUEUE 32
|
||||
|
||||
/* evdev flags */
|
||||
#define EVDEV_KEYBOARD_EVENTS (1 << 0)
|
||||
#define EVDEV_BUTTON_EVENTS (1 << 1)
|
||||
#define EVDEV_RELATIVE_EVENTS (1 << 2)
|
||||
#define EVDEV_ABSOLUTE_EVENTS (1 << 3)
|
||||
#define EVDEV_TOUCHPAD (1 << 4)
|
||||
#define EVDEV_INITIALIZED (1 << 5) /* WheelInit etc. called already? */
|
||||
#define EVDEV_TOUCHSCREEN (1 << 6)
|
||||
#define EVDEV_CALIBRATED (1 << 7) /* run-time calibrated? */
|
||||
#define EVDEV_TABLET (1 << 8) /* device looks like a tablet? */
|
||||
#define EVDEV_UNIGNORE_ABSOLUTE (1 << 9) /* explicitly unignore abs axes */
|
||||
#define EVDEV_UNIGNORE_RELATIVE (1 << 10) /* explicitly unignore rel axes */
|
||||
#define EVDEV_RELATIVE_MODE (1 << 11) /* Force relative events for devices with absolute axes */
|
||||
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
|
||||
#define HAVE_PROPERTIES 1
|
||||
#endif
|
||||
@@ -199,7 +214,6 @@ void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
|
||||
void EvdevMBEmuPreInit(InputInfoPtr);
|
||||
void EvdevMBEmuOn(InputInfoPtr);
|
||||
void EvdevMBEmuFinalize(InputInfoPtr);
|
||||
void EvdevMBEmuEnable(InputInfoPtr, BOOL);
|
||||
|
||||
/* Mouse Wheel emulation */
|
||||
void EvdevWheelEmuPreInit(InputInfoPtr pInfo);
|
||||
|
||||
Reference in New Issue
Block a user