mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
52 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f48abf89e4 | ||
|
|
87819fe86b | ||
|
|
ffa1fbc770 | ||
|
|
40bb3c69ce | ||
|
|
675218cbf5 | ||
|
|
ad834abd57 | ||
|
|
3549c3e5f0 | ||
|
|
5def56d2f4 | ||
|
|
b907c23d00 | ||
|
|
6c975917f8 | ||
|
|
ac421e536c | ||
|
|
bd55c2f021 | ||
|
|
11d506dce6 | ||
|
|
a34a2cd347 | ||
|
|
78c00bd77f | ||
|
|
760f1c6bb1 | ||
|
|
2db04ba3c3 | ||
|
|
363d0bdb9f | ||
|
|
16a26a1eca | ||
|
|
b879ae7351 | ||
|
|
53566b7d4d | ||
|
|
29c2765fc3 | ||
|
|
7ef4e2c5e1 | ||
|
|
dd0eeacc24 | ||
|
|
67c0ea6c94 | ||
|
|
6bcbbc0411 | ||
|
|
534a3734d0 | ||
|
|
215c230d5c | ||
|
|
8f96530449 | ||
|
|
4fb97edcd4 | ||
|
|
4e86393bc0 | ||
|
|
a64a78791f | ||
|
|
09b2a5e87b | ||
|
|
fa18a4a38d | ||
|
|
172523d745 | ||
|
|
8fb820ffaf | ||
|
|
c7893b212d | ||
|
|
e9dd721e2d | ||
|
|
cab104fd9e | ||
|
|
708eb34599 | ||
|
|
36a687796f | ||
|
|
26229df106 | ||
|
|
f4616d87fc | ||
|
|
2aa5ca8cdd | ||
|
|
39263dc65d | ||
|
|
57521e4e60 | ||
|
|
7da1522309 | ||
|
|
b4fcb825fc | ||
|
|
7c955ad050 | ||
|
|
4f80c0f2cb | ||
|
|
5070d64aa8 | ||
|
|
caacacf057 |
19
.cvsignore
Normal file
19
.cvsignore
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
aclocal.m4
|
||||||
|
autom4te.cache
|
||||||
|
config.guess
|
||||||
|
config.h
|
||||||
|
config.h.in
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
config.sub
|
||||||
|
configure
|
||||||
|
depcomp
|
||||||
|
install-sh
|
||||||
|
libtool
|
||||||
|
ltmain.sh
|
||||||
|
missing
|
||||||
|
stamp-h1
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -22,7 +22,6 @@ missing
|
|||||||
*.lo
|
*.lo
|
||||||
*.la
|
*.la
|
||||||
stamp-h1
|
stamp-h1
|
||||||
xf86-input-evdev-*.tar.*
|
*.bz2
|
||||||
|
*.gz
|
||||||
*.pc
|
*.pc
|
||||||
*~
|
|
||||||
tags
|
|
||||||
|
|||||||
15
Makefile.am
15
Makefile.am
@@ -19,26 +19,19 @@
|
|||||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
SUBDIRS = src man include
|
||||||
# Ensure headers are installed below $(prefix) for distcheck
|
|
||||||
DISTCHECK_CONFIGURE_FLAGS = --with-sdkdir='$${includedir}/xorg'
|
|
||||||
|
|
||||||
if BUILD_TEST
|
|
||||||
test_dir=test
|
|
||||||
endif
|
|
||||||
|
|
||||||
SUBDIRS = src man include $(test_dir)
|
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = xorg-evdev.pc
|
pkgconfig_DATA = xorg-evdev.pc
|
||||||
|
|
||||||
EXTRA_DIST = ChangeLog
|
EXTRA_DIST = ChangeLog autogen.sh
|
||||||
|
|
||||||
MAINTAINERCLEANFILES=ChangeLog
|
MAINTAINERCLEANFILES=ChangeLog
|
||||||
|
|
||||||
.PHONY: ChangeLog
|
.PHONY: ChangeLog
|
||||||
|
|
||||||
ChangeLog:
|
ChangeLog:
|
||||||
$(CHANGELOG_CMD)
|
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || \
|
||||||
|
(touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
|
||||||
|
|
||||||
dist-hook: ChangeLog
|
dist-hook: ChangeLog
|
||||||
|
|||||||
43
configure.ac
43
configure.ac
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
AC_PREREQ(2.57)
|
AC_PREREQ(2.57)
|
||||||
AC_INIT([xf86-input-evdev],
|
AC_INIT([xf86-input-evdev],
|
||||||
2.2.5,
|
2.1.3,
|
||||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||||
xf86-input-evdev)
|
xf86-input-evdev)
|
||||||
|
|
||||||
@@ -32,16 +32,15 @@ AM_INIT_AUTOMAKE([dist-bzip2])
|
|||||||
|
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
# Require xorg-macros: XORG_CWARNFLAGS, XORG_CHANGELOG
|
DRIVER_NAME=evdev
|
||||||
m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.2 or later before running autoconf/autogen])])
|
AC_SUBST([DRIVER_NAME])
|
||||||
XORG_MACROS_VERSION(1.2)
|
|
||||||
AM_CONFIG_HEADER([config.h])
|
AM_CONFIG_HEADER([config.h])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_DISABLE_STATIC
|
AC_DISABLE_STATIC
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
XORG_CWARNFLAGS
|
|
||||||
|
|
||||||
AH_TOP([#include "xorg-server.h"])
|
AH_TOP([#include "xorg-server.h"])
|
||||||
|
|
||||||
@@ -53,45 +52,27 @@ AC_ARG_WITH(xorg-module-dir,
|
|||||||
inputdir=${moduledir}/input
|
inputdir=${moduledir}/input
|
||||||
AC_SUBST(inputdir)
|
AC_SUBST(inputdir)
|
||||||
|
|
||||||
# Enable building everything in the test/ directory. These are uinput-based
|
# Checks for extensions
|
||||||
# devices that resemble random hardware that may or may not look like a mouse,
|
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
|
||||||
# keyboard, etc.
|
|
||||||
AC_ARG_ENABLE(testdevices,
|
|
||||||
AC_HELP_STRING([--enable-testdevices], [Build uinput-based test devices]),
|
|
||||||
[BUILD_TEST="yes"],
|
|
||||||
[BUILD_TEST="no"])
|
|
||||||
AM_CONDITIONAL([BUILD_TEST], [test "x$BUILD_TEST" = "xyes"])
|
|
||||||
|
|
||||||
if test "x$BUILD_TEST" = "xyes"; then
|
# Checks for pkg-config packages
|
||||||
AC_CHECK_FUNC([dlopen], [],
|
|
||||||
AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
|
|
||||||
AC_SUBST([DLOPEN_LIBS])
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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)
|
PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES)
|
||||||
XORG_CFLAGS="$CWARNFLAGS $XORG_CFLAGS"
|
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
|
||||||
AC_ARG_WITH([sdkdir], [],
|
AC_SUBST(sdkdir)
|
||||||
[sdkdir="$withval"],
|
|
||||||
[sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`])
|
CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src'
|
||||||
AC_SUBST([sdkdir])
|
AC_SUBST([CFLAGS])
|
||||||
|
|
||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
|
||||||
DRIVER_NAME=evdev
|
|
||||||
AC_SUBST([DRIVER_NAME])
|
|
||||||
|
|
||||||
XORG_MANPAGE_SECTIONS
|
XORG_MANPAGE_SECTIONS
|
||||||
XORG_RELEASE_VERSION
|
XORG_RELEASE_VERSION
|
||||||
XORG_CHANGELOG
|
|
||||||
|
|
||||||
AC_OUTPUT([Makefile
|
AC_OUTPUT([Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
man/Makefile
|
man/Makefile
|
||||||
include/Makefile
|
include/Makefile
|
||||||
test/Makefile
|
|
||||||
xorg-evdev.pc])
|
xorg-evdev.pc])
|
||||||
|
|||||||
2
man/.cvsignore
Normal file
2
man/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
110
man/evdev.man
110
man/evdev.man
@@ -44,6 +44,22 @@ The following driver
|
|||||||
.B Options
|
.B Options
|
||||||
are supported:
|
are supported:
|
||||||
.TP 7
|
.TP 7
|
||||||
|
.BI "Option \*qDevice\*q \*q" string \*q
|
||||||
|
Specifies the device through which the device can be accessed. This will
|
||||||
|
generally be of the form \*q/dev/input/eventX\*q, where X is some integer.
|
||||||
|
The mapping from device node to hardware is system-dependent.
|
||||||
|
.TP 7
|
||||||
|
.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".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
|
||||||
|
Sets the timeout (in milliseconds) that the driver waits before deciding
|
||||||
|
if two buttons where pressed "simultaneously" when 3 button emulation is
|
||||||
|
enabled. Default: 50. Property: "Evdev Middle Button Timeout".
|
||||||
|
.TP 7
|
||||||
.BI "Option \*qButtonMapping\*q \*q" string \*q
|
.BI "Option \*qButtonMapping\*q \*q" string \*q
|
||||||
Sets the button mapping for this device. The mapping is a space-separated list
|
Sets the button mapping for this device. The mapping is a space-separated list
|
||||||
of button mappings that correspond in order to the physical buttons on the
|
of button mappings that correspond in order to the physical buttons on the
|
||||||
@@ -54,11 +70,6 @@ For example, a left-handed mouse with deactivated scroll-wheel would use a
|
|||||||
mapping of "3 2 1 0 0". Invalid mappings are ignored and the default mapping
|
mapping of "3 2 1 0 0". Invalid mappings are ignored and the default mapping
|
||||||
is used. Buttons not specified in the user's mapping use the default mapping.
|
is used. Buttons not specified in the user's mapping use the default mapping.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qDevice\*q \*q" string \*q
|
|
||||||
Specifies the device through which the device can be accessed. This will
|
|
||||||
generally be of the form \*q/dev/input/eventX\*q, where X is some integer.
|
|
||||||
The mapping from device node to hardware is system-dependent.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
|
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
|
||||||
Sets \*qdrag lock buttons\*q that simulate holding a button down, so
|
Sets \*qdrag lock buttons\*q that simulate holding a button down, so
|
||||||
that low dexterity people do not have to hold a button down at the
|
that low dexterity people do not have to hold a button down at the
|
||||||
@@ -72,17 +83,6 @@ Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q
|
|||||||
indicating that the next button pressed is to be
|
indicating that the next button pressed is to be
|
||||||
\*qdrag locked\*q. Property: "Evdev Drag Lock Buttons".
|
\*qdrag locked\*q. Property: "Evdev Drag Lock Buttons".
|
||||||
.TP 7
|
.TP 7
|
||||||
.TP 7
|
|
||||||
.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".
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
|
|
||||||
Sets the timeout (in milliseconds) that the driver waits before deciding
|
|
||||||
if two buttons where pressed "simultaneously" when 3 button emulation is
|
|
||||||
enabled. Default: 50. Property: "Evdev Middle Button Timeout".
|
|
||||||
.BI "Option \*qEmulateWheel\*q \*q" boolean \*q
|
.BI "Option \*qEmulateWheel\*q \*q" boolean \*q
|
||||||
Enable/disable "wheel" emulation. Wheel emulation means emulating button
|
Enable/disable "wheel" emulation. Wheel emulation means emulating button
|
||||||
press/release events when the mouse is moved while a specific real button
|
press/release events when the mouse is moved while a specific real button
|
||||||
@@ -96,7 +96,7 @@ more buttons but no wheel. See the description of the
|
|||||||
.BR XAxisMapping ,
|
.BR XAxisMapping ,
|
||||||
and
|
and
|
||||||
.B YAxisMapping
|
.B YAxisMapping
|
||||||
options. Default: off. Property "Evdev Wheel Emulation".
|
options below. Default: off. Property "Evdev Wheel Emulation".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q
|
.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q
|
||||||
Specifies which button must be held down to enable wheel emulation mode.
|
Specifies which button must be held down to enable wheel emulation mode.
|
||||||
@@ -120,25 +120,6 @@ must be pressed before wheel emulation is started. If the
|
|||||||
is released before this timeout, the original button press/release event
|
is released before this timeout, the original button press/release event
|
||||||
is sent. Default: 200. Property: "Evdev Wheel Emulation Timeout".
|
is sent. Default: 200. Property: "Evdev Wheel Emulation Timeout".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qGrabDevice\*q \*q" boolean \*q
|
|
||||||
Force a grab on the event device. Doing so will ensure that no other driver
|
|
||||||
can initialise the same device and it will also stop the device from sending
|
|
||||||
events to /dev/kbd or /dev/input/mice. Events from this device will not be
|
|
||||||
sent to virtual devices (e.g. rfkill or the Macintosh mouse button emulation).
|
|
||||||
Default: disabled.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qInvertX\*q \*q" Bool \*q
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qInvertY\*q \*q" Bool \*q
|
|
||||||
Invert the given axis. Default: off. Property: "Evdev Axis Inversion".
|
|
||||||
.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 \*qSwapAxes\*q \*q" Bool \*q
|
|
||||||
Swap x/y axes. Default: off. Property: "Evdev Axes Swap".
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q
|
.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q
|
||||||
Specifies which buttons are mapped to motion in the X direction in wheel
|
Specifies which buttons are mapped to motion in the X direction in wheel
|
||||||
emulation mode. Button number
|
emulation mode. Button number
|
||||||
@@ -156,28 +137,31 @@ is mapped to the negative Y axis motion and button number
|
|||||||
.I N2
|
.I N2
|
||||||
is mapped to the positive Y axis motion. Default: "4 5". Property:
|
is mapped to the positive Y axis motion. Default: "4 5". Property:
|
||||||
"Evdev Wheel Emulation Axes".
|
"Evdev Wheel Emulation Axes".
|
||||||
|
.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 \*qInvertX\*q \*q" Bool \*q
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qInvertY\*q \*q" Bool \*q
|
||||||
|
Invert the given axis. Default: off. Property: "Evdev Axis Inversion".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qSwapAxes\*q \*q" Bool \*q
|
||||||
|
Swap x/y axes. Default: off. Property: "Evdev Axes Swap".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qGrabDevice\*q \*q" boolean \*q
|
||||||
|
Force a grab on the event device. Doing so will ensure that no other driver
|
||||||
|
can initialise the same device and it will also stop the device from sending
|
||||||
|
events to /dev/kbd or /dev/input/mice. Events from this device will not be
|
||||||
|
sent to virtual devices (e.g. rfkill or the Macintosh mouse button emulation).
|
||||||
|
Default: disabled.
|
||||||
|
|
||||||
.SH SUPPORTED PROPERTIES
|
.SH SUPPORTED PROPERTIES
|
||||||
The following properties are provided by the
|
The following properties are provided by the
|
||||||
.B evdev
|
.B evdev
|
||||||
driver.
|
driver.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Axis Calibration"
|
|
||||||
4 32-bit values, order min-x, max-x, min-y, max-y or 0 values to disable
|
|
||||||
run-time axis calibration. This feature is required for devices that need to
|
|
||||||
scale to a different coordinate system than originally reported to the X
|
|
||||||
server, such as touchscreens that require run-time calibration.
|
|
||||||
.TP 7
|
|
||||||
.BI "Evdev Axis Inversion"
|
|
||||||
2 boolean values (8 bit, 0 or 1), order X, Y. 1 inverts the axis.
|
|
||||||
.TP 7
|
|
||||||
.BI "Evdev Axes Swap"
|
|
||||||
1 boolean value (8 bit, 0 or 1). 1 swaps x/y axes.
|
|
||||||
.TP 7
|
|
||||||
.BI "Evdev Drag Lock Buttons"
|
|
||||||
8-bit. Either 1 value or pairs of values. Value range 0-32, 0 disables a
|
|
||||||
value.
|
|
||||||
.TP 7
|
|
||||||
.BI "Evdev Middle Button Emulation"
|
.BI "Evdev Middle Button Emulation"
|
||||||
1 boolean value (8 bit, 0 or 1).
|
1 boolean value (8 bit, 0 or 1).
|
||||||
.TP 7
|
.TP 7
|
||||||
@@ -190,14 +174,30 @@ value.
|
|||||||
.BI "Evdev Wheel Emulation Axes"
|
.BI "Evdev Wheel Emulation Axes"
|
||||||
4 8-bit values, order X up, X down, Y up, Y down. 0 disables a value.
|
4 8-bit values, order X up, X down, Y up, Y down. 0 disables a value.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Wheel Emulation Button"
|
|
||||||
1 8-bit value, allowed range 0-32, 0 disables the button.
|
|
||||||
.TP 7
|
|
||||||
.BI "Evdev Wheel Emulation Inertia"
|
.BI "Evdev Wheel Emulation Inertia"
|
||||||
1 16-bit positive value.
|
1 16-bit positive value.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Wheel Emulation Timeout"
|
.BI "Evdev Wheel Emulation Timeout"
|
||||||
1 16-bit positive value.
|
1 16-bit positive value.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Wheel Emulation Button"
|
||||||
|
1 8-bit value, allowed range 0-32, 0 disables the button.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Drag Lock Buttons"
|
||||||
|
8-bit. Either 1 value or pairs of values. Value range 0-32, 0 disables a
|
||||||
|
value.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Axis Inversion"
|
||||||
|
2 boolean values (8 bit, 0 or 1), order X, Y. 1 inverts the axis.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Axis Calibration"
|
||||||
|
4 32-bit values, order min-x, max-x, min-y, max-y or 0 values to disable
|
||||||
|
run-time axis calibration. This feature is required for devices that need to
|
||||||
|
scale to a different coordinate system than originally reported to the X
|
||||||
|
server, such as touchscreens that require run-time calibration.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Axis Swap"
|
||||||
|
1 boolean value (8 bit, 0 or 1). 1 swaps x/y axes.
|
||||||
|
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
Kristian Høgsberg.
|
Kristian Høgsberg.
|
||||||
|
|||||||
6
src/.cvsignore
Normal file
6
src/.cvsignore
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
.deps
|
||||||
|
.libs
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
@@ -24,8 +24,6 @@
|
|||||||
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
|
# -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
|
# _ladir passes a dummy rpath to libtool so the thing will actually link
|
||||||
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
||||||
AM_CFLAGS = $(XORG_CFLAGS)
|
|
||||||
|
|
||||||
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
|
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
|
||||||
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
|
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
|
||||||
@DRIVER_NAME@_drv_ladir = @inputdir@
|
@DRIVER_NAME@_drv_ladir = @inputdir@
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value)
|
|||||||
* for the pair. 0 disables a pair.
|
* for the pair. 0 disables a pair.
|
||||||
* i.e. to set bt 3 to draglock button 1, supply 0,0,1
|
* i.e. to set bt 3 to draglock button 1, supply 0,0,1
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
BOOL checkonly)
|
BOOL checkonly)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -327,9 +327,6 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
|||||||
void
|
void
|
||||||
EvdevMBEmuOn(InputInfoPtr pInfo)
|
EvdevMBEmuOn(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
if (!pInfo->dev->button) /* don't init for keyboards */
|
|
||||||
return;
|
|
||||||
|
|
||||||
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
EvdevMBEmuWakeupHandler,
|
EvdevMBEmuWakeupHandler,
|
||||||
(pointer)pInfo);
|
(pointer)pInfo);
|
||||||
@@ -338,9 +335,6 @@ EvdevMBEmuOn(InputInfoPtr pInfo)
|
|||||||
void
|
void
|
||||||
EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
if (!pInfo->dev->button) /* don't cleanup for keyboards */
|
|
||||||
return;
|
|
||||||
|
|
||||||
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
EvdevMBEmuWakeupHandler,
|
EvdevMBEmuWakeupHandler,
|
||||||
(pointer)pInfo);
|
(pointer)pInfo);
|
||||||
@@ -358,7 +352,7 @@ EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
#ifdef HAVE_PROPERTIES
|
||||||
static int
|
int
|
||||||
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
BOOL checkonly)
|
BOOL checkonly)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
#ifdef HAVE_PROPERTIES
|
||||||
static int
|
int
|
||||||
EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
BOOL checkonly)
|
BOOL checkonly)
|
||||||
{
|
{
|
||||||
@@ -337,6 +337,15 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|||||||
16, PropModeReplace, 1,
|
16, PropModeReplace, 1,
|
||||||
&pEvdev->emulateWheel.inertia, TRUE);
|
&pEvdev->emulateWheel.inertia, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Don't enable with negative timeout */
|
||||||
|
if (pEvdev->emulateWheel.timeout < 0)
|
||||||
|
{
|
||||||
|
pEvdev->emulateWheel.timeout = 200;
|
||||||
|
XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.timeout, TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (atom == prop_wheel_button)
|
else if (atom == prop_wheel_button)
|
||||||
|
|||||||
1116
src/evdev.c
1116
src/evdev.c
File diff suppressed because it is too large
Load Diff
48
src/evdev.h
48
src/evdev.h
@@ -35,7 +35,10 @@
|
|||||||
|
|
||||||
#include <xf86Xinput.h>
|
#include <xf86Xinput.h>
|
||||||
#include <xf86_OSproc.h>
|
#include <xf86_OSproc.h>
|
||||||
|
|
||||||
|
#ifdef XKB
|
||||||
#include <xkbstr.h>
|
#include <xkbstr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef EV_CNT /* linux 2.4 kernels and earlier lack _CNT defines */
|
#ifndef EV_CNT /* linux 2.4 kernels and earlier lack _CNT defines */
|
||||||
#define EV_CNT (EV_MAX+1)
|
#define EV_CNT (EV_MAX+1)
|
||||||
@@ -59,22 +62,6 @@
|
|||||||
#define HAVE_PROPERTIES 1
|
#define HAVE_PROPERTIES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MAX_VALUATORS
|
|
||||||
#define MAX_VALUATORS 36
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 5
|
|
||||||
typedef struct {
|
|
||||||
char *rules;
|
|
||||||
char *model;
|
|
||||||
char *layout;
|
|
||||||
char *variant;
|
|
||||||
char *options;
|
|
||||||
} XkbRMLVOSet;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define LONG_BITS (sizeof(long) * 8)
|
#define LONG_BITS (sizeof(long) * 8)
|
||||||
|
|
||||||
/* Number of longs needed to hold the given number of bits */
|
/* Number of longs needed to hold the given number of bits */
|
||||||
@@ -90,12 +77,9 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
const char *device;
|
const char *device;
|
||||||
int grabDevice; /* grab the event device? */
|
int grabDevice; /* grab the event device? */
|
||||||
|
int screen;
|
||||||
int num_vals; /* number of valuators */
|
int min_x, min_y, max_x, max_y;
|
||||||
int axis_map[max(ABS_CNT, REL_CNT)]; /* Map evdev <axis> to index */
|
int abs_x, abs_y, old_x, old_y;
|
||||||
int vals[MAX_VALUATORS];
|
|
||||||
int old_vals[MAX_VALUATORS]; /* Translate absolute inputs to relative */
|
|
||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
int tool;
|
int tool;
|
||||||
int buttons; /* number of buttons */
|
int buttons; /* number of buttons */
|
||||||
@@ -104,11 +88,15 @@ typedef struct {
|
|||||||
BOOL invert_y;
|
BOOL invert_y;
|
||||||
|
|
||||||
/* XKB stuff has to be per-device rather than per-driver */
|
/* XKB stuff has to be per-device rather than per-driver */
|
||||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 5
|
int noXkb;
|
||||||
|
#ifdef XKB
|
||||||
|
char *xkb_rules;
|
||||||
|
char *xkb_model;
|
||||||
|
char *xkb_layout;
|
||||||
|
char *xkb_variant;
|
||||||
|
char *xkb_options;
|
||||||
XkbComponentNamesRec xkbnames;
|
XkbComponentNamesRec xkbnames;
|
||||||
#endif
|
#endif
|
||||||
XkbRMLVOSet rmlvo;
|
|
||||||
|
|
||||||
/* Middle mouse button emulation */
|
/* Middle mouse button emulation */
|
||||||
struct {
|
struct {
|
||||||
BOOL enabled;
|
BOOL enabled;
|
||||||
@@ -150,11 +138,11 @@ typedef struct {
|
|||||||
|
|
||||||
/* Cached info from device. */
|
/* Cached info from device. */
|
||||||
char name[1024];
|
char name[1024];
|
||||||
unsigned long bitmask[NLONGS(EV_CNT)];
|
long bitmask[NLONGS(EV_CNT)];
|
||||||
unsigned long key_bitmask[NLONGS(KEY_CNT)];
|
long key_bitmask[NLONGS(KEY_CNT)];
|
||||||
unsigned long rel_bitmask[NLONGS(REL_CNT)];
|
long rel_bitmask[NLONGS(REL_CNT)];
|
||||||
unsigned long abs_bitmask[NLONGS(ABS_CNT)];
|
long abs_bitmask[NLONGS(ABS_CNT)];
|
||||||
unsigned long led_bitmask[NLONGS(LED_CNT)];
|
long led_bitmask[NLONGS(LED_CNT)];
|
||||||
struct input_absinfo absinfo[ABS_CNT];
|
struct input_absinfo absinfo[ABS_CNT];
|
||||||
|
|
||||||
/* minor/major number */
|
/* minor/major number */
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
# Copyright 2008 Red Hat, 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
|
|
||||||
# on the rights to use, copy, modify, merge, publish, distribute, sub
|
|
||||||
# license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
# THE AUTHORS 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.
|
|
||||||
AM_CFLAGS = $(XORG_CFLAGS)
|
|
||||||
|
|
||||||
noinst_PROGRAMS=fakedev btn0 absrel abs dummy
|
|
||||||
|
|
||||||
fakedev_SOURCES=fakedev.c fakedev.h
|
|
||||||
fakedev_LDFLAGS=$(DLOPEN_LIBS) -rdynamic
|
|
||||||
|
|
||||||
LFLAGS=-shared -fPIC
|
|
||||||
|
|
||||||
btn0_SOURCES=btn0.c
|
|
||||||
btn0_LDFLAGS=$(LFLAGS)
|
|
||||||
|
|
||||||
absrel_SOURCES=absrel.c
|
|
||||||
absrel_LDFLAGS=$(LFLAGS)
|
|
||||||
|
|
||||||
abs_SOURCES=abs.c
|
|
||||||
abs_LDFLAGS=$(LFLAGS)
|
|
||||||
|
|
||||||
dummy_SOURCES=dummy.c
|
|
||||||
dummy_LDFLAGS=$(LFLAGS)
|
|
||||||
84
test/abs.c
84
test/abs.c
@@ -1,84 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Peter Hutterer (peter.hutterer@redhat.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* creates a device with ABS_X, ABS_Y, BTN_LEFT, BTN_MIDDLE, BTN_RIGHT. */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <linux/input.h>
|
|
||||||
#include <linux/uinput.h>
|
|
||||||
|
|
||||||
#include "fakedev.h"
|
|
||||||
|
|
||||||
int abs_setup(struct uinput_user_dev* dev, int fd)
|
|
||||||
{
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_ABS) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_SYN) == -1) goto error;
|
|
||||||
|
|
||||||
/* buttons */
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_LEFT) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_MIDDLE) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_RIGHT) == -1) goto error;
|
|
||||||
|
|
||||||
/* axes */
|
|
||||||
if (ioctl(fd, UI_SET_ABSBIT, ABS_X) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_ABSBIT, ABS_Y) == -1) goto error;
|
|
||||||
|
|
||||||
|
|
||||||
dev->absmin[ABS_X] = 0;
|
|
||||||
dev->absmax[ABS_X] = 120;
|
|
||||||
|
|
||||||
dev->absmin[ABS_Y] = 0;
|
|
||||||
dev->absmax[ABS_Y] = 120;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
error:
|
|
||||||
perror("ioctl failed.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int abs_run(int fd)
|
|
||||||
{
|
|
||||||
absmove(fd, 100, 100);
|
|
||||||
sleep(1);
|
|
||||||
absmove(fd, 120, 120);
|
|
||||||
sleep(1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct test_device abs_dev = {
|
|
||||||
.name = "Abs test device",
|
|
||||||
.setup = abs_setup,
|
|
||||||
.run = abs_run,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct test_device* get_device()
|
|
||||||
{
|
|
||||||
return &abs_dev;
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Peter Hutterer (peter.hutterer@redhat.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* creates a device with ABS_X, ABS_Y, REL_X, REL_Y, BTN_LEFT, BTN_MIDDLE,
|
|
||||||
BTN_RIGHT. */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <linux/input.h>
|
|
||||||
#include <linux/uinput.h>
|
|
||||||
|
|
||||||
#include "fakedev.h"
|
|
||||||
|
|
||||||
int absrel_setup(struct uinput_user_dev* dev, int fd)
|
|
||||||
{
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_REL) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_ABS) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_SYN) == -1) goto error;
|
|
||||||
|
|
||||||
/* buttons */
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_LEFT) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_MIDDLE) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_RIGHT) == -1) goto error;
|
|
||||||
|
|
||||||
/* axes */
|
|
||||||
if (ioctl(fd, UI_SET_RELBIT, REL_X) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_RELBIT, REL_Y) == -1) goto error;
|
|
||||||
|
|
||||||
if (ioctl(fd, UI_SET_ABSBIT, ABS_X) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_ABSBIT, ABS_Y) == -1) goto error;
|
|
||||||
|
|
||||||
|
|
||||||
dev->absmin[ABS_X] = 0;
|
|
||||||
dev->absmax[ABS_X] = 1000;
|
|
||||||
|
|
||||||
dev->absmin[ABS_Y] = 0;
|
|
||||||
dev->absmax[ABS_Y] = 1000;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
error:
|
|
||||||
perror("ioctl failed.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int absrel_run(int fd)
|
|
||||||
{
|
|
||||||
absmove(fd, 100, 100);
|
|
||||||
sleep(1);
|
|
||||||
absmove(fd, 120, 120);
|
|
||||||
sleep(1);
|
|
||||||
move(fd, 10, 10);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct test_device absrel_dev = {
|
|
||||||
.name = "Abs/Rel test device",
|
|
||||||
.setup = absrel_setup,
|
|
||||||
.run = absrel_run,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct test_device* get_device()
|
|
||||||
{
|
|
||||||
return &absrel_dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
87
test/btn0.c
87
test/btn0.c
@@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Peter Hutterer (peter.hutterer@redhat.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Creates a device that has REL_X REL_Y BTN_0 BTN_1 BTN_2
|
|
||||||
*
|
|
||||||
* Moves the device around in a 10px square and clicks after each completed
|
|
||||||
* circle.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <linux/input.h>
|
|
||||||
#include <linux/uinput.h>
|
|
||||||
|
|
||||||
#include "fakedev.h"
|
|
||||||
|
|
||||||
int btn0_setup(struct uinput_user_dev *dev, int fd)
|
|
||||||
{
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_KEY) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_REL) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_SYN) == -1) goto error;
|
|
||||||
|
|
||||||
/* buttons */
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_0) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_1) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_2) == -1) goto error;
|
|
||||||
|
|
||||||
/* axes */
|
|
||||||
if (ioctl(fd, UI_SET_RELBIT, REL_X) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_RELBIT, REL_Y) == -1) goto error;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
error:
|
|
||||||
perror("ioctl failed.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int btn0_run(int fd)
|
|
||||||
{
|
|
||||||
move(fd, -10, 0);
|
|
||||||
usleep(1000);
|
|
||||||
move(fd, 0, -10);
|
|
||||||
usleep(1000);
|
|
||||||
move(fd, 10, 0);
|
|
||||||
usleep(1000);
|
|
||||||
move(fd, 0, 10);
|
|
||||||
usleep(1000);
|
|
||||||
click(fd, BTN_0, 1);
|
|
||||||
usleep(1000);
|
|
||||||
click(fd, BTN_0, 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct test_device btn0_dev = {
|
|
||||||
.name = "BTN_0 test device",
|
|
||||||
.setup = btn0_setup,
|
|
||||||
.run = btn0_run,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct test_device* get_device()
|
|
||||||
{
|
|
||||||
return &btn0_dev;
|
|
||||||
}
|
|
||||||
77
test/dummy.c
77
test/dummy.c
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Peter Hutterer (peter.hutterer@redhat.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* dummy device, looks like a mouse but doesn't do anything.
|
|
||||||
* Good for filling up the device list.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <linux/input.h>
|
|
||||||
#include <linux/uinput.h>
|
|
||||||
|
|
||||||
#include "fakedev.h"
|
|
||||||
|
|
||||||
int dummy_setup(struct uinput_user_dev *dev, int fd)
|
|
||||||
{
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_KEY) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_REL) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_EVBIT, EV_SYN) == -1) goto error;
|
|
||||||
|
|
||||||
/* buttons */
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_LEFT) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_MIDDLE) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_KEYBIT, BTN_RIGHT) == -1) goto error;
|
|
||||||
|
|
||||||
/* axes */
|
|
||||||
if (ioctl(fd, UI_SET_RELBIT, REL_X) == -1) goto error;
|
|
||||||
if (ioctl(fd, UI_SET_RELBIT, REL_Y) == -1) goto error;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
error:
|
|
||||||
perror("ioctl failed.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int dummy_run(int fd)
|
|
||||||
{
|
|
||||||
usleep(1000);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct test_device dummy_dev = {
|
|
||||||
.name = "dummy_ test device",
|
|
||||||
.setup = dummy_setup,
|
|
||||||
.run = dummy_run,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct test_device* get_device()
|
|
||||||
{
|
|
||||||
return &dummy_dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
199
test/fakedev.c
199
test/fakedev.c
@@ -1,199 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Peter Hutterer (peter.hutterer@redhat.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <linux/input.h>
|
|
||||||
#include <linux/uinput.h>
|
|
||||||
#include <dlfcn.h>
|
|
||||||
|
|
||||||
#include "fakedev.h"
|
|
||||||
|
|
||||||
/* "public interfaces" */
|
|
||||||
|
|
||||||
void send_event(int fd, int type, int code, int value)
|
|
||||||
{
|
|
||||||
struct input_event event;
|
|
||||||
|
|
||||||
event.type = type;
|
|
||||||
event.code = code;
|
|
||||||
event.value = value;
|
|
||||||
gettimeofday(&event.time, NULL);
|
|
||||||
|
|
||||||
if (write(fd, &event, sizeof(event)) < sizeof(event))
|
|
||||||
perror("Send event failed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void move(int fd, int x, int y)
|
|
||||||
{
|
|
||||||
if (!x && !y)
|
|
||||||
return;
|
|
||||||
|
|
||||||
send_event(fd, EV_REL, REL_X, x);
|
|
||||||
send_event(fd, EV_REL, REL_Y, y);
|
|
||||||
send_event(fd, EV_SYN, SYN_REPORT, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void absmove(int fd, int x, int y)
|
|
||||||
{
|
|
||||||
send_event(fd, EV_ABS, ABS_X, x);
|
|
||||||
send_event(fd, EV_ABS, ABS_Y, y);
|
|
||||||
send_event(fd, EV_SYN, SYN_REPORT, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void click(int fd, int btn, int down)
|
|
||||||
{
|
|
||||||
send_event(fd, EV_KEY, btn, down);
|
|
||||||
send_event(fd, EV_SYN, SYN_REPORT, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* end public interfaces */
|
|
||||||
|
|
||||||
static int fd = -1;
|
|
||||||
static int stop = 0;
|
|
||||||
|
|
||||||
static void sighandler(int signum)
|
|
||||||
{
|
|
||||||
printf("Stopping.\n");
|
|
||||||
stop = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_signal(void)
|
|
||||||
{
|
|
||||||
struct sigaction action;
|
|
||||||
sigset_t mask;
|
|
||||||
|
|
||||||
sigfillset(&mask);
|
|
||||||
|
|
||||||
action.sa_handler = sighandler;
|
|
||||||
action.sa_mask = mask;
|
|
||||||
action.sa_flags = 0;
|
|
||||||
|
|
||||||
sigaction(SIGTERM, &action, NULL);
|
|
||||||
sigaction(SIGINT, &action, NULL);
|
|
||||||
sigprocmask(SIG_UNBLOCK, &mask, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int init_uinput(struct test_device* test_dev)
|
|
||||||
{
|
|
||||||
struct uinput_user_dev dev;
|
|
||||||
|
|
||||||
fd = open("/dev/input/uinput", O_RDWR);
|
|
||||||
if (fd < 0)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
memset(&dev, 0, sizeof(dev));
|
|
||||||
strcpy(dev.name, test_dev->name);
|
|
||||||
dev.id.bustype = 0;
|
|
||||||
dev.id.vendor = 0x1F;
|
|
||||||
dev.id.product = 0x1F;
|
|
||||||
dev.id.version = 0;
|
|
||||||
|
|
||||||
|
|
||||||
test_dev->setup(&dev, fd);
|
|
||||||
|
|
||||||
if (write(fd, &dev, sizeof(dev)) < sizeof(dev))
|
|
||||||
goto error;
|
|
||||||
if (ioctl(fd, UI_DEV_CREATE, NULL) == -1) goto error;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
error:
|
|
||||||
fprintf(stderr, "Error: %s\n", strerror(errno));
|
|
||||||
|
|
||||||
if (fd != -1)
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cleanup_uinput(void)
|
|
||||||
{
|
|
||||||
if (fd == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ioctl(fd, UI_DEV_DESTROY, NULL);
|
|
||||||
close(fd);
|
|
||||||
fd = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
|
||||||
{
|
|
||||||
struct test_device *dev;
|
|
||||||
void *dlhandle = NULL;
|
|
||||||
struct test_device* (*get_device)(void);
|
|
||||||
|
|
||||||
if (argc <= 1)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Usage: %s test_dev\n", argv[0]);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Loading %s.\n", argv[1]);
|
|
||||||
|
|
||||||
dlhandle = dlopen(argv[1], RTLD_NOW | RTLD_GLOBAL);
|
|
||||||
if (!dlhandle)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Error: %s\n", dlerror());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*(void**)(&get_device) = dlsym(dlhandle, "get_device");
|
|
||||||
if (!get_device)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Error getting the symbol: %s.\n", dlerror());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev = (*get_device)();
|
|
||||||
|
|
||||||
if (init_uinput(dev) < 0) {
|
|
||||||
fprintf(stderr, "Failed to initialize /dev/uinput. Exiting.\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
init_signal();
|
|
||||||
|
|
||||||
printf("Device created. Press CTRL+C to terminate.\n");
|
|
||||||
while (!stop) {
|
|
||||||
if (dev->run(fd))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup_uinput();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Peter Hutterer (peter.hutterer@redhat.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _EVDEV_TEST_H
|
|
||||||
#define _EVDEV_TEST_H
|
|
||||||
#include <linux/uinput.h>
|
|
||||||
|
|
||||||
struct test_device {
|
|
||||||
char *name; /* device name */
|
|
||||||
/**
|
|
||||||
* Called to setup the device. Call ioctls to set your EVBITs, KEYBITs,
|
|
||||||
* etc. here. Return 0 on success or non-zero to exit.
|
|
||||||
*/
|
|
||||||
int (*setup)(struct uinput_user_dev* dev, int fd);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called during each run of the main loop. Generate events by calling
|
|
||||||
* move(), click(), etc.
|
|
||||||
* Return 0 on success, or non-zero to stop the main loop.
|
|
||||||
*/
|
|
||||||
int (*run)(int fd);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern void move (int fd, int x, int y);
|
|
||||||
extern void absmove (int fd, int x, int y);
|
|
||||||
extern void click (int fd, int btn, int down);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user