Compare commits

...

558 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult
8bdf7f1d44 configure.ac: use AC_CONFIG_FILES() macro
passing output file names directly to AC_OUTPUT() is deprecated.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-12 12:15:59 +01:00
Enrico Weigelt, metux IT consult
f32592af5b configure.ac: query input_drivers_dir from xlibre-server.pc
Use new pkg-config name and variable for retrieving the input
driver installation directory.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-12 09:11:29 +01:00
Enrico Weigelt, metux IT consult
3c37d58f21 man: use autoconf instead of extra sed run
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-08 16:56:17 +01:00
Enrico Weigelt, metux IT consult
83d7cfecfd replace obsolete "pointer" typedef by void*
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-01-02 18:03:28 +01:00
Enrico Weigelt, metux IT consult
93d89e4374 .github: update action version
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-30 15:45:35 +01:00
Enrico Weigelt, metux IT consult
87f04d892f .github: add freebsd and dragonfly bsd build
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-27 14:19:17 +01:00
Enrico Weigelt, metux IT consult
173cdfa20a .github: use new common driver build actions
Using the new driver build actions in X11Libre/actions-build-driver repo,
instead of having lots of duplicated pipeline and script in all the
individual driver repos.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-23 10:09:07 +01:00
polaris
4d30b39c0a configure.ac: make libudev optional 2025-12-22 22:20:26 +01:00
Enrico Weigelt, metux IT consult
0f8cbdff4f configure.ac: query xserver directories via pkg-config
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-19 17:01:10 +01:00
Enrico Weigelt, metux IT consult
77129e1138 evdev-properties: drop unused EVDEV_PROP_REOPEN
Not used for 16 years now. See 59056e656c.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-19 15:25:50 +01:00
Enrico Weigelt, metux IT consult
114073c225 don't install header file anymore
Nothing's compiling against this driver, so it shouldn't install
header files. If these constants are considered a public spec,
then they should go to some appropriate proto package.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-19 15:25:48 +01:00
Enrico Weigelt, metux IT consult
13fb800c0c drop compat with xserver < 24.0
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-19 15:13:01 +01:00
Enrico Weigelt, metux IT consult
cfac96b809 drop compat with Xserver < 21.0
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-19 15:09:52 +01:00
Enrico Weigelt, metux IT consult
5c74de60b3 drop compat with ancient xservers
Relying on xserver >= 1.18, which has XINPUT 22.1

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-19 15:08:12 +01:00
Enrico Weigelt, metux IT consult
679c6cb77f configure.ac: increase minimum xserver version to 25.0.0
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-19 15:05:38 +01:00
Enrico Weigelt, metux IT consult
298e61e566 release 25.0.0
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-18 18:24:09 +01:00
Enrico Weigelt, metux IT consult
1a80d31ed7 configure.ac: tiny formatting cleanups
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-18 18:23:38 +01:00
Enrico Weigelt, metux IT consult
e8a08514f6 drop obsolete #ifdef HAVE_CONFIG_H
config.h is always present

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-17 18:55:18 +01:00
Enrico Weigelt, metux IT consult
a413634da8 replace DRIVER_NAME autotools symbol by fixed string
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-17 18:49:52 +01:00
Enrico Weigelt, metux IT consult
0eb641f218 drop xorg-evdec.pc
Nothing's ever trying to compile against the driver, so no
pkgconfig descriptor needed here.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-17 18:43:47 +01:00
Enrico Weigelt, metux IT consult
c59ba05346 drop .gitlab-ci.yml
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-17 18:39:12 +01:00
Enrico Weigelt, metux IT consult
0981f96cdc man: replace Xorg by XLibre
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-16 13:40:10 +01:00
Enrico Weigelt, metux IT consult
b1320d6f02 README.md: fix URLs
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-16 12:22:27 +01:00
Enrico Weigelt, metux IT consult
26dde8fc21 release 2.11.1
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-15 13:28:10 +01:00
Enrico Weigelt, metux IT consult
51d93c47f7 configure.ac: fix package name and issue tracker URL
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-15 13:22:48 +01:00
Enrico Weigelt, metux IT consult
3801a36ec9 emuWheel: use strdup() instead of xstrdup()
Never passing NULL here, so no need to call xstrdup() / Xstrdup()

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-12-10 19:06:32 +01:00
SuperPuiu
e361cfad9f Transform an if-else statement into a conditional operator
Signed-off-by: SuperPuiu <SuperPuiu@proton.me>
2025-07-29 19:00:18 +02:00
b-aaz
4570407894 configure: Automatically detect the default xorg-module-dir.
The module directory has changed to a per ABI folder in the xlibre-xserver.
Now the default value of `xorg-module-dir` will be detected from the `moduledir` variable in xorg-server.pc.

Signed-off-by: b-aaz <b-aazbsd.proton.me>
2025-07-29 18:54:05 +02:00
Enrico Weigelt, metux IT consult
9ee18e3450 .github: add CI pipeline
This pipeline builds the driver against the latest Xserver stable
release as well as current master.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-07-28 20:04:48 +02:00
callmetango
e518cb19bd .github: Add issue forms
Add the following forms for issue creation:

* Bug report
* Feature request
* Code change
* Documentation update
* Organizational task

* add issue type selection page on "New Issue" call
* mention Github Discussions and the mailing list where appropriate

Part-of: X11Libre/misc#156
Signed-off-by: callmetango <callmetango@users.noreply.github.com>
2025-07-07 17:00:04 +02:00
Alan Coopersmith
0b5b97bc6b man page: Replace __xservername__ & __xconfigfile__ with Xorg & xorg.conf
These were originally to allow distros to build using XFree86 & XF86config
names, but we haven't supported that in nearly two decades now.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/13>
2025-06-01 15:33:56 -07:00
Alan Coopersmith
96a4dc7565 Improve man page formatting
More closely follow common style as described on
https://man7.org/linux/man-pages/man7/man-pages.7.html
and fix warnings raised by  `mandoc -T lint` and `groff -rCHECKSTYLE=10`

Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/13>
2025-05-31 15:53:11 -07:00
Peter Hutterer
abcafeede7 xf86-input-evdev 2.11.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2024-10-15 14:32:50 +10:00
Peter Hutterer
d893fc74d2 Map some specific high keycodes into the FK20-23 range
These mappings have been part of xkeyboard-config for over a decade and
the likely reason they were introduced is that the corresponding evdev
keycode is > 255.

Let's forcibly remap those in the driver here so the rest of the system
can switch to the real keycodes instead of having to map them to the
whatever X expects.

See https://github.com/systemd/systemd/pull/34325/

Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/10>
2024-10-09 14:33:05 +10:00
Martin Rys
b9327e6b28 Swap Compose and Kana values to conform to USB HID spec
Should fix https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/issues/204

Current state conflicts with XKB which defines them correctly.

NUM and CAPS are still incorrectly swapped, but it's equally wrong on
XKB's side and everywhere else, so it's just cosmetic and a breaking
change just to satisfy USB HID ordering is not worth it, since the keys
work fine this way anyway.

Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/8>
2024-09-05 11:32:21 +10:00
Peter Hutterer
917c2ea204 gitlab CI: set the standard workflow rules for an fdo project 2024-09-03 13:49:04 +10:00
Enrico Weigelt, metux IT consult
b48c2b7028 dont spam xserver with false-positives
It's not necessary to spam the xserver log with error messages of
just temporary read failures that aren't actually errors.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/6>
2024-06-10 19:05:58 +02:00
Enrico Weigelt, metux IT consult
aac329fd2a fix FTBS on non-udev target platforms (eg. FreeBSD)
On platforms that don't have libudev at all (eg. FreeBSD), the build
breaks. The only consumer, EvdevDeviceIsVirtual(), can live well with
just bailing out directly if libudev isn't present.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/6>
2024-06-10 19:05:54 +02:00
Enrico Weigelt, metux IT consult
fbfb16edfe tolerate including linux/input.h
On some platforms (eg. FreeBSD) we're running into a name clash between
xf86str.h and linux/input.h. Since we don't actually need those symbols
here, an easy workaround is #undef'ing them.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/6>
2024-06-10 18:42:22 +02:00
Enrico Weigelt, metux IT consult
409e8205e8 fix unportable linux-only include
including <linux/types.h> obviously isn't portable - instead using
<sys/types.h> is the right choice for us.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/6>
2024-06-10 18:38:12 +02:00
Enrico Weigelt, metux IT consult
7fc0d51f70 drop quirk for ancient linux kernel version (<2.6.30)
This kernel had been released 1.5 decades ago - probably no need to have
special quirks for such an ancient kernel version anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-06-10 18:05:40 +02:00
Enrico Weigelt, metux IT consult
7c48b6225b bump minimal xorg version to 1.18
1.18 was released a decade ago, so it seems reasonable stop supporting
older ones.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/-/merge_requests/5>
2024-05-14 10:59:46 +02:00
Alan Coopersmith
8edcb2b9e8 gitlab CI: ensure libtool is installed in build container
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-10-01 11:22:19 -07:00
Alan Coopersmith
84b2740814 gitlab CI: stop requiring Signed-off-by in commits
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-02-09 12:06:53 -08:00
Alan Coopersmith
469a30f158 Convert src/draglock.c from ISO-8859-1 to UTF-8
Fixes flawfinder error in CI:
Error: encoding error in ./src/draglock.c
'utf-8' codec can't decode byte 0xa9 in position 343: invalid start byte

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16 11:11:01 -08:00
Alan Coopersmith
23909c35a4 gitlab CI: add a basic build test
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16 10:55:36 -08:00
Alan Coopersmith
abf0fa611e Fix spelling/wording issues
Found by using:
    codespell --builtin clear,rare,usage,informal,code,names

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16 10:51:03 -08:00
Alan Coopersmith
6609d352f3 Build xz tarballs instead of bzip2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-16 10:49:21 -08:00
Alan Coopersmith
71036116be Update configure.ac bug URL for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-11-25 12:45:55 -08:00
Alan Coopersmith
b6b36166bd Update README for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-11-18 11:30:58 -08:00
Peter Hutterer
67a97afbc0 evdev 2.10.6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 10:05:22 +10:00
Andrey Zabolotnyi
2fb95783e0 Fix generation of proximity-in/out events.
Invoking xf86PostProximityEvent with no valuators does nothing, so we
have to provide a valid valuator set to the call.

https://bugs.freedesktop.org/show_bug.cgi?id=104562

[whot: slight change from 104562
abs_vals is reset on every frame but old_vals is kept around to remember the
last value of the valuator (and is updated to the current values before
processing the frame). We expect the prox in to have x/y, so let's just
unconditionally use old_vals for proximity events.]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 10:00:26 +10:00
Peter Hutterer
456f23cbbd Ignore x/y axis changes on proximity out
Wacom tablets send a farewell reset to 0 on all axes when the tool goes out of
proximity. Ignore those so we can rely on our various valuator masks always
having the correct coordinates.

Possible false positive if you manage to go out of proximity right above the
zero datum but meh.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 10:00:05 +10:00
Christian Gmeiner
ab1d9adfd3 Print cause of a failed open(..) call
This is quite helpful for debugging.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-30 13:37:57 +10:00
Andrey Zabolotnyi
192fdb0690 Fix handling of devices with only buttons (e.g. tablet pads).
When transforming 'only buttons' device into a pseudo-mouse by adding
relative X and Y axes, EVDEV_RELATIVE_EVENTS flag  must be set on device,
otherwise it gets classified as a keyboard by X11.

https://bugs.freedesktop.org/show_bug.cgi?id=104630

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-16 16:30:59 +10:00
Mihail Konev
8c1058f2eb autogen: add default patch prefix
Signed-off-by: Mihail Konev <k.mvc@ya.ru>
2017-01-26 14:00:21 +10:00
Emil Velikov
4921912374 autogen.sh: use quoted string variables
Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent
fall-outs, when they contain space.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 11:13:25 +10:00
Peter Hutterer
67681097b8 autogen.sh: use exec instead of waiting for configure to finish
Syncs the invocation of configure with the one from the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-26 11:13:25 +10:00
Peter Hutterer
1dd61111ad evdev 2.10.5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-18 13:14:29 +10:00
Alexander Volkov
231061d004 Don't send pointer events in addition to touch events
Updating abs_vals for touch events since d24431a186
leads to posting Motion events with updated coordinates to the X server,
which in turn resends them to clients.

Don't queue Motion events for touch events, the X server should
synthesize them itself.

Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-03 11:28:17 +10:00
David Strobach
425ed6017a Middle emulation - make the emulated button number configurable
Sometimes it may be desirable to remap physical middle button
to something else and use emulation instead. The emulation is
however hardcoded to emulate physical button 2, so the emulated
button gets remapped together with the physical one. This patch
adds the Emulate3Button configuration option to allow for user
selection of the emulated button number and a configuration
like this:

Section "InputClass"
    Identifier "Middle button emulation config"
    MatchProduct ".... some device ..."
    MatchDriver "evdev"
    Option "Emulate3Buttons" "on"
    Option "Emulate3Button" "9"
EndSection

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-21 15:26:58 +10:00
Peter Hutterer
7251e42dfb Fix off-by-one error counting axes
We stopped counting one too early, but still initialized that axis later,
leading to a bug macro to trigger.

https://bugs.freedesktop.org/show_bug.cgi?id=97956

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-10-24 08:27:24 +10:00
Peter Hutterer
551db5b86e evdev 2.10.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-10-01 17:49:10 +10:00
Keith Packard
bb8bde7456 Support XINPUT ABI 24 (remove select mask from block/wakeup handlers)
The evdev driver wasn't using the select mask arguments, so this
change just involves adjusting the argument lists.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-09-06 13:51:21 +10:00
Keith Packard
7b1267f7f1 Support XINPUT ABI version 23 (threaded input)
Use input_lock/input_unlock calls instead of SIGIO functions

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-02 09:42:05 +10:00
Keith Packard
e08b033276 Report errors when attempting to write keyboard controls
This is mostly to eliminate a compiler warning.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-02 09:41:25 +10:00
Peter Hutterer
7c1971d9e7 evdev 2.10.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-06-01 11:41:03 +10:00
Peter Hutterer
9a6952dafe Restore non-xy axes updates
This broke in d24431a186 Restore wheel emulation for absolute devices,
last hunk when the valuator update was moved to before any early exit
condition. But that new update only applies to valuator maps < 2, i.e. x/y
only. Other valuators are now ignored and remain on 0 forever.

Restore the valuator update.

https://bugs.freedesktop.org/show_bug.cgi?id=95315

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-05-12 15:29:55 +10:00
Peter Hutterer
f12eca9f83 evdev 2.10.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29 09:13:35 +10:00
Peter Hutterer
33dc3d7128 Prevent buffer overrun accessing btn_labels
We go up to BTN_JOYSTICK, hence group can have a value of up to including 15.
The actual btn_labels only has 6 elements though.

Found by coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-27 09:11:03 +10:00
Peter Hutterer
7b0a65d989 Don't reset the other axis on wheel emulation scroll buildup
The idea was that of a direction lock: as we move vertically we should not
build up any horizontal scroll motion even if we move slightly diagonally.

The effect was though that the axis would be reset completely as soon as an
event from the other axis occured. With the default threshold of 10, if one in
ten events was a REL_X, we'd never get a wheel event.

Drop this code, it's not needed. By default wheel emulation doesn't do
horizontal scrolling, if a config snippet sets XAxisMapping the user wants
horizontal scrolling. And since we just add the value anyway, as long as the
user does a roughly vertical motion we won't get over the threshold anyway.

https://bugs.freedesktop.org/show_bug.cgi?id=93617

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 10:48:36 +10:00
Peter Hutterer
d24431a186 Restore wheel emulation for absolute devices
Wheel emulation relies on oldVals, which stopped updating in 3dcf6f123c.

Since wheel emulation may filter the abs event, store the event before we do
anything with it. If we really want the abs_event, abs_queued will be set to
1, otherwise the value will be ignored.

And now that we know abs_value is always valied, we can copy its value into
old_vals, so that wheel emulation can calculate the delta correctly.

https://bugs.freedesktop.org/show_bug.cgi?id=93617

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 10:48:35 +10:00
Peter Hutterer
ce7d8fdebc man: add a warning that wheel emu inertia must be set and it isn't inertia
First, it's not actually inertia, it's simply the scroll distance, yay for the
misnomer.

And it needs to be set for any device that is more fine-grained than a
mouse, especially absolute devices. For example the VirtualBox device has an
abs max of 32767, so a simple motion may have a delta of to 2000 units and
that results in 200 scroll events. That's a bit excessive.

Related to: https://bugs.freedesktop.org/show_bug.cgi?id=93617

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-14 11:53:56 +10:00
Peter Hutterer
6a3beab613 evdev 2.10.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-08 15:11:59 +10:00
Peter Hutterer
d7e61a7074 Only map x and y to axes 0 and 1
The Logitech G600 has one device with all axes north of ABS_MISC. The current
code assigns ABS_MISC as first axis to map to axis 0, i.e. x. On button press,
one node sends the BTN_LEFT but the other node sends an ABS_MISC with a 1 0
value. ABS_MISC is mapped to axis 0, this moves the pointer to (0, y) on
every button click.

Avoid this by simply mapping any axis other than x/y to at least axis 3, and
make sure we only override the MT 0/1 axes when we actually have MT axes.

https://bugs.freedesktop.org/show_bug.cgi?id=92856

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-11-13 06:50:28 +10:00
Peter Hutterer
01e7ac4854 evdev 2.10.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-28 14:28:20 +10:00
Thomas Hindoe Paaboel Andersen
034be31159 Add "Resolution" option for mice to the evdev driver
It can be used to scale the resolution of a mouse to that of a 1000 DPI
mouse. This can be useful to make high resolution mice less sensitive
without turning off acceleration. The target of 1000 DPI is used as the
same default is used in libinput. If the option is not set no scaling
will be done.

https://bugs.freedesktop.org/show_bug.cgi?id=88134
Signed-off-by: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-27 14:59:27 +10:00
Peter Hutterer
66c9978864 Add the default evdev config
This used to be part of the server but now that we have two drivers doing the
same thing (libinput, evdev) shift the configuration defaults to the driver.
This way you get what you install.

https://bugs.freedesktop.org/show_bug.cgi?id=89023

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-18 13:39:37 +10:00
Peter Hutterer
0d3494eadf Bump to 2.9.99
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-27 11:41:50 +10:00
Peter Hutterer
56a5e67162 Unconditionally require mtdev
Missing from 2c9f4f0380

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-16 07:57:38 +10:00
Peter Hutterer
74433f788a Always check for a return value on creating a property
Mostly to make static analyzers happy

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-16 07:57:26 +10:00
Peter Hutterer
fdc33809de Invert a condition to reduce nesting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-13 10:58:01 +10:00
Peter Hutterer
38e107a39f Disable axis faking and MT event processing on fake MT devices
This effectively disables all axes >= ABS_MT_SLOT on those devices. But at
least the device comes up without an error and it didn't work correctly
beforehand anyway.

https://bugs.freedesktop.org/show_bug.cgi?id=89473

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:21:09 +10:00
Peter Hutterer
b6176cff5a Invert two conditions to reduce nesting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:02:12 +10:00
Peter Hutterer
37afebfb67 Factor out MT axis counting into a separate function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:02:11 +10:00
Peter Hutterer
5b5ae1786c Split android axis simulation into a helper function
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:02:11 +10:00
Peter Hutterer
2c9f4f0380 Require multitouch/smooth scrolling dependencies
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-11 15:02:11 +10:00
Peter Hutterer
39ef4444a2 Drop evdev-specific XKB defaults
Just use the server defaults instead. This has very little effect, on most
systems there was some sort of default configuration applied anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-13 09:06:44 +10:00
Tobias Himmer
abc4a8b603 Check for incoming MT slot indices exceeding the allocated number of slots.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=88715

Signed-off-by: Tobias Himmer <provisorisch@online.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-23 12:05:28 +10:00
Colin B. Macdonald
b370ccdff8 Workaround lack of ABS_X on MT devices (#80470)
Often on Android, we have ABS_MT_POSITION_X without ABS_X (which is contrary
to spec). We add fake ABS_X axis in that case.

X.Org Bug 80470 <http://bugs.freedesktop.org/show_bug.cgi?id=80470>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 10:40:25 +10:00
Éric Brunet
511498478b Move EVDEV_RELATIVE_MODE logic earlier
When in EVDEV_RELATIVE_MODE, after converting the absolute valuators, the
code unsets pEvdev->abs_queued. This is wrong if there are some absolute
valuators which are not positions, such as a pressure valuators, because
events on these valuators would be lost.

This patch fixes the problem by doing the absolute->relative translation
early. This way, abs_queued is not set and then unset when receiving
absolute valuators representing positions. Other absolute events now set abs_queued
and will be processed.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:42:11 +10:00
Éric Brunet
3dcf6f123c Don't update old_vals when not in EVDEV_RELATIVE_MODE
When not in EVDEV_RELATIVE_MODE, absolute position is stored in old_vals. This serves
no purpose except that old_vals is ready when the device is switched to
EVDEV_RELATIVE_MODE. It is however better to make the copy between old_vals
and abs_vals at the time of the switch rather than all the time.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:37:38 +10:00
Éric Brunet
f59585b367 Change the logic concerning EVDEV_RELATIVE_MODE and in_proximity
When not in_proximity, we don't really trust data, even though a valuator
sent just before a in_proximity event might actually be important. The
present code for EVDEV_RELATIVE_MODE throws away all data if not
in_proximity, which is a little bit too much. This patch allows for
relative values to be calculated and old_vals to be updated even if not
in_proximity, but will prevent evdev to sending (presumably) wrong
information to the X server. But at least, old_vals will be correctly
filled when the device comes into proximity again.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:33:17 +10:00
Éric Brunet
593bbc6390 drop the pEvdev->delta array
Now that relative events have their own valuator mask, use it instead of
delta

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:32:41 +10:00
Éric Brunet
e0e2587a95 Split pEvdev->vals into pEvdev->abs_vals and pEvdev->rel_vals
This should hopefully fix bug 84445.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-17 14:26:25 +10:00
Peter Hutterer
cb3b023783 evdev 2.9.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-26 09:23:39 +10:00
Peter Hutterer
124eff9ba2 Remove three unused #defines
Obsolete since 768c25a99b

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-07 13:41:06 +10:00
Éric Brunet
605047613c Don't pass superfluous arguments to EvdevPost*Events
The functions EvdevPostProximityEvents, EvdevPostRelativeMotionEvents,
EvdevPostAbsoluteMotionEvents and EvdevPostQueuedEvents are only called
by EvdevProcessSyncEvent. These functions take as arguments an array of
valuators which is set by EvdevProcessSyncEvent to contain ... nothing.
This patch changes the prototype of the four functions, their definitions
and the way they are called  to remove the useless array of valuators.

Signed-off-by: Éric Brunet <Eric.Brunet@lps.ens.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-29 11:18:16 +10:00
Peter Hutterer
3ee98d0b7f Drop some unused #defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-29 13:14:56 +10:00
Peter Hutterer
977588d24a If only IgnoreRelativeAxes is set, init like a normal relative device
In the current code, if only IgnoreRelativeAxes is set, the code would go on
and force absolute axes to initialize even if the relative axes were
successfully initialized.

Evdev gives precedence to relative axes anyway, initializing absolute axes if
the relative axes failed. Thus, if we explicitely want relative axes but leave
the abs axes as-is, proceed as normal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 10:02:00 +10:00
Peter Hutterer
291b60172d Fix axis initialization for devices with abs x/y and rel scrollwheels
The Xen Virtual Pointer device has ABS_X, ABS_Y and REL_WHEEL. If smooth
scrolling is detected, the current code would first initialize relative axes
for scrolling and immediately overwrite those axes when the abs valuators are
written out.

This patch fixes the default case only, in the case of a device setting the
two Ignore*Axis options both to "off", the axes are still overwritten. The
wheels will work, other axes only if the same number of abs axes exists. And
it keeps the current memory leak too, but it's marked with a FIXME now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 10:02:00 +10:00
Peter Hutterer
8ce06c96e4 Make the slot-state per slot
The previous approach only had the slot state for the current slot. If we
changed slots, that means we lost the information if the slot was ever
initialized. If the ABS_MT_TRACKING_ID was never received, the slot would
still update and try to send events (which the server refused with a warning).

Avoid this by having a per-slot state and a dirty bit that tells us if the
current slot updated at all. If we don't get the tracking ID, leave the slot
empty and refuse any further events from that touch.

This quashes the various "unable to find touch point 0" warnings caused if a
touchpoint starts before the device is enabled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Walter Harms <wharms@bfs.de>
2014-08-18 10:01:47 +10:00
Peter Hutterer
5d239ceb26 evdev 2.9.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-05-20 15:41:08 +10:00
Peter Hutterer
13dea90bc8 Use the server's device list for duplicate detection (#78309)
EvdevAddDevice/EvdevRemoveDevice keep a reference to the device to detect
duplicate devices based on the dev_t.

EvdevAddDevices was called during PreInit, EvdevRemoveDevice was called during
DEVICE_CLOSE. That makes it imbalanced if the device succeeds PreInit but the
server skips everything else because MAX_DEVICES is exceeded. So for all
devices after MAX_DEVICES, we'd add a reference but never remove it,
eventually reading/writing past evdev_devices.

The server keeps the list of devices for us anyway, so remove the copy of all
the pointers and instead run through the device list the server gives us.

X.Org Bug 78309 <http://bugs.freedesktop.org/show_bug.cgi?id=78309>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-05-07 07:27:29 +10:00
Peter Hutterer
b25d716165 evdev 2.8.99.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-29 10:20:50 +10:00
Peter Hutterer
41cf9212d0 Map REL_DIAL to horizontal scrolling (#73105)
This was the original behavior introduced in
f77410e1f9 and stayed that way until smooth
scrolling erroneously added it as vertical axis in
b450efdf95. Revert to horizontal scrolling to
restore the previous behaviour - which unbreaks scrolling on Microsoft mice.

This effectively reverts 54a3120e33 too.

X.Org Bug 73105 <http://bugs.freedesktop.org/show_bug.cgi?id=73105>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-29 09:52:31 +10:00
Peter Hutterer
75368052b5 Revert "Map REL_DIAL to horizontal scrolling (#73105)"
Whoops, the vertical axis is swapped, so when changing the axis we also need
to change the direction.

This reverts commit 16c85cbeac.
2014-04-29 09:52:31 +10:00
Peter Hutterer
16c85cbeac Map REL_DIAL to horizontal scrolling (#73105)
This was the original behavior introduced in
f77410e1f9 and stayed that way until smooth
scrolling erroneously added it as vertical axis in
b450efdf95. Revert to horizontal scrolling to
restore the previous behaviour - which unbreaks scrolling on Microsoft mice.

This effectively reverts 54a3120e33 too.

X.Org Bug 73105 <http://bugs.freedesktop.org/show_bug.cgi?id=73105>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-29 09:39:12 +10:00
Hans de Goede
ae67f64f02 evdev: Add support for server managed fds
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-10 11:58:43 +10:00
Peter Hutterer
f6fcad8b10 Fix wheel emulation for absolute device (#68415)
wheel emulation, for some reasons beyond time, got the value from
pEvdev->vals, then set the value back into pEvdev->vals. Alas, that value is
always 0, hence oldValue is zero and the delta is nil.

If we're not in relative (touchpad) mode, store the current value in
old_vals, so they're retrievable for the next event.

X.Org Bug 68415 <http://bugs.freedesktop.org/show_bug.cgi?id=68415>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-22 13:59:46 +10:00
Peter De Wachter
d171b3d919 Export smooth scroll settings as an XInput property.
A new property "Evdev Scrolling Distance" is created that holds three values
(vertical, horizontal and dial).

Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-21 16:39:59 +10:00
Peter De Wachter
c3251deb4b Add configuration options for smooth scrolling.
This patch creates three new xorg.conf options, VertScrollDelta,
HorizScrollDelta and DialDelta, which adjust the sensitivity of
smooth scrolling. These options take a positive integer, default
value is 1.

Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-21 15:47:54 +10:00
Peter Hutterer
cabed4bbb6 Use num_slots where appropriate
This was supposed to be added in 43e270fb7a, but
got lost somehow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-14 11:49:29 +10:00
Peter Hutterer
a75c43830e Merge branch 'libevdev' 2013-10-07 09:22:09 +11:00
Peter Hutterer
d9aadfd5f0 bump to 2.8.99
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-07 09:21:57 +11:00
Peter De Wachter
54a3120e33 Map REL_DIAL to vertical scrolling
This makes the absolute axis codepath behave the same as the relative axis
path.

Signed-off-by: Peter De Wachter <pdewacht@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-10-07 09:21:07 +11:00
Peter Hutterer
164c62a975 Use libevdev as backend
Removes the need to ioctl manually and check bits, with all the dangers that
come with that. libevdev is much better prepared for invalid values, OOB
checks, etc.

Plus, we get almost free SYN_DROPPED handling as well which we didn't have
before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-10-04 16:19:19 +10:00
Peter Hutterer
43e270fb7a Use helper function for counting slots
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-09-10 15:06:38 +10:00
Peter Hutterer
4ca57716ca Drop ABS_MT_SLOT minimum - the kernel guarantees a minimum of 0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-09-10 15:04:40 +10:00
Peter Hutterer
0f16065b00 Remove a comment
This comment is now in the wrong place. It was moved when abs support for
wheel emulation was added but is now only confusing. Remove it altogether,
the code is quite obvious what it does.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-28 14:37:26 +10:00
Peter Hutterer
cae1478781 Don't use mtdev for protocol B devices
If a device has ABS_MT_SLOT, mtdev merely reads the events and returns them
to the caller as-is. For this we don't need mtdev, we can just handle those
events ourselves.

This patch switches to the mtdev plumbing layer that takes events and
converts them instead of reading them off the fd.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-28 10:38:40 +10:00
Peter Hutterer
27926b3763 Write a SYN_REPORT after the last LED
When writing LED values to the device, append a SYN_REPORT to the list to
ensure other clients are updated immediately. Otherwise, the LED events
will be queued and not sent to other clients until the next input event
arrives.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2013-08-13 19:34:16 +10:00
Peter Hutterer
8a9b1ec6b5 evdev 2.8.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-07-11 11:09:24 +10:00
Peter Hutterer
356565111a Don't allow a wheel emulation inertia of 0 (#66125)
Inertia of 0 results in an infinite loop of events being sent to the server.

X.Org Bug 66125 <http://bugs.freedesktop.org/show_bug.cgi?id=66125>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-06-27 06:58:27 +10:00
Peter Hutterer
fff3a60fbf Use EvdevBitIsSet, not the server's BitIsOn
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-31 06:57:22 +10:00
Peter Hutterer
8f209ac60d Drop cached name and led_bitmask - nothing reads this
Both fields are write-only as of xf86-input-evdev-2.5.99.902-1-g1ced7ec

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-05-31 06:57:22 +10:00
Peter Hutterer
a0d41af896 Switch default model to pc104.
As of xkeyboard-config 1.9, the evdev model is hidden (c887d2876)
The server switched to pc105 with version 1.8 (1df4bd601).

The evdev model resolves to pc104 anyway, so this commit has no real effect
other than to switch from a catch-all rule to explicit.
Use pc104 so this is easy to find for those investigating the code and
wondering why. pc104 is the 'correct' geometry for the us layout, which is
the default after all. Switching to pc105 would show keys missing if no
model is set (e.g. on uk/de layouts) but it would be the wrong layout for
the default.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
2013-05-31 06:57:16 +10:00
Peter Hutterer
dea1d1a390 Fail to set up axes for devices that only have MT axes but no ABS_X/Y equivalents (#64029)
The kernel should give us ABS_X/Y for backwards compat but some devices
don't. For now, ignore these devices as evdev is not suited to handle this
yet and will crash if a device is set up without axes (i.e.
pEvdev->vals == NULL) and later receives an event from an MT axis.

X.Org Bug 64029 <http://bugs.freedesktop.org/show_bug.cgi?id=64029>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2013-05-01 15:05:43 +10:00
Peter Hutterer
b59a1a25da Add option TypeName (#62831)
evdev tries to assign the right XI 1.x type-name based on various device
capabilities. In some cases, that fails. e.g. the Mionix Naos 5000 mouse
looks like a keyboard. And we assign a keyboard type in that case since
there are plenty of keyboards that also advertise some axes or others.

Add a new option TypeName to allow for system-wide configuration of such
devices in a quirks file.

This can also be used to address #55867

X.Org Bug 62831 <http://bugs.freedesktop.org/show_bug.cgi?id=62831>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-04-16 10:25:02 +10:00
Peter Hutterer
5138cd2ff4 evdev 2.8.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-03-26 16:01:39 +10:00
Peter Hutterer
c085c8b6c1 Return BadValue if EvdevOpenMTDev fails
FALSE == Success, so if we fail during EvdevOpenMTDev, the caller thinks
that everything worked fine, proceeds to set up the fd, etc.

This may later cause a crash, when a device comes back later as different
device and posts axis events where we didn't configure axes in the first
place.

Note: Unclear why there was no udev event received for the device being
removed and coming back as different device though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-02-12 13:19:49 +10:00
Peter Hutterer
2b675f85ae Make errors on EVIOCGBIT more obvious
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-02-12 13:19:47 +10:00
Peter Hutterer
2b8b0df62e Always init axis mapping for the first two rel axes (#59784)
Fixes regression introduced in 2f67509b53.

If evdev is used for touchpads, the abs axis movement is converted to a rel
movement. Without the two relative axes initialized, the events are
discarded.

Axes 0 and 1 are always x/y anyway unless specifically configured otherwise.

X.Org Bug 59784 <http://bugs.freedesktop.org/show_bug.cgi?id=59784>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-25 11:13:41 +10:00
Peter Hutterer
bb9b4146cb Merge branch 'touch-axis-swap' 2013-01-25 11:12:05 +10:00
Peter Hutterer
f5fe533f1b Allow relative scroll valuators on absolute devices (#54387)
Special-case RHEL_WHEEL, RHEL_HWHEEL and REL_DIAL to add scroll valuators
for those axes in addition to the absolute axes.

X.Org Bug 54387 <http://bugs.freedesktop.org/show_bug.cgi?id=54387>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-23 17:33:10 +10:00
Peter Hutterer
2f67509b53 Split rel and abs axis mapping into two separate arrays
This will enable a device to have relative scrolling axes in addition to
absolute axes (required by the QEMU tablet).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-23 17:33:10 +10:00
Peter Hutterer
ffc0a34642 Move some stuff into the new alloc function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-23 17:33:10 +10:00
Peter Hutterer
93de7b0b73 Move allocation of EvdevRec into a helper function
Makes it easier to initialise everything to the right values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-23 17:33:10 +10:00
Colin Walters
9ec9d214d0 autogen.sh: Implement GNOME Build API
http://people.gnome.org/~walters/docs/build-api.txt

Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-01-16 13:16:22 -05:00
Adam Jackson
94e6df8f5f configure: Drop AM_MAINTAINER_MODE
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-01-16 13:11:11 -05:00
Peter Hutterer
67e5376aaa Handle axis swap, calibration, and inversion for touch events (#59340)
X.Org Bug 59340 <http://bugs.freedesktop.org/show_bug.cgi?id=59340>

Reported-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-14 15:30:46 +10:00
Peter Hutterer
2432626b70 Move calibration adjustments to helper function
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-14 15:28:34 +10:00
Peter Hutterer
069c035ab0 Move valuator swapping into a helper function
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-14 15:28:34 +10:00
Peter Hutterer
3b7ba39fca Localise tmp variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-14 15:28:34 +10:00
Mauro Carvalho Chehab
454194f4b5 Force a button if MT axes are present and it is not a gamepad
We expect at least BTN_TOUCH for anything with MT axes, but devices that
don't have that need a button class regardless. Some gamepads define
MT axes but no buttons, causing a bug in the server when they post a
TouchBegin.

[ 97436.293] (EE) BUG: triggered 'if (!b || !v)'
[ 97436.293] (EE) BUG: exevents.c:929 in UpdateDeviceState()

So, ignore it, if it is a joystick (e. g. if it have BTN_JOYSTICK defined).
Otherwise, fake a button.

This patch basically merges two patches written by Peter Hutterer
<peter.hutterer@who-t.net>.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-08 15:07:04 +10:00
Peter Hutterer
00341e632c Drop special XKB option handling
This isn't actually needed at all.

xf86nameCompare() will skip over underscores and is case-independent. So
xf86SetStrOption("foo_bar") will return an Option "FooBar" and vice versa.

The server won't return a zero-length string either, it'll return
NULL and spit a warning to the log.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-08 15:07:03 +10:00
Peter Hutterer
f2d2b65343 Localise XKB initialization
No need to store this in the evdev struct.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-01-08 15:07:03 +10:00
Peter Hutterer
0d6c6b59c1 If stat fails, pretend it's not a virtual device
If stat fails while checking if the device is virtual, just say "no, it's
not virtual" and continue. If the device really went away, it'll be removed
through other means.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-05 17:12:34 +10:00
Benjamin Tissoires
c263d6e46d Add missing mt axis labels
update evdev according to latest changes in input.h

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-11-30 08:47:19 +10:00
Peter Hutterer
5af11b6752 Use LogMessageVerbSigSafe if available
Messages logged during the signal handler should use LogMessageVerbSigSafe
as of ABI 18.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-10 17:38:35 +10:00
Peter Hutterer
33e7831b5f Fix broken ButtonMapping option (#53168)
Regression introduced in 8af0e6f1eb.
s is now initialized to NULL, so we never entered the loop.

X.Org Bug 53168 <http://bugs.freedesktop.org/show_bug.cgi?id=53168>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-08-08 12:34:25 +10:00
Peter Hutterer
bc8997e812 Link against libudev
Fixes /usr/bin/Xorg: symbol lookup error:
/usr/lib64/xorg/modules/input/evdev_drv.so: undefined symbol: udev_new

This doesn't appear in the default configuration as Xorg links against
libudev and the symbol is defined when evdev is loaded. It can be reproduced
with a HAL-enabled server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-07 07:38:28 +10:00
Peter Hutterer
1cb8f074df Don't delete the device on ENODEV
This is signal handler code and we cannot clean up properly while in the
signal handler. So reduce the code to removing the signal handler and let
the device be cleaned up later.

If hotplugging is on, the server will remove it when the config backend says
so and if it is off, the server will remove it on shutdown.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-07 07:38:26 +10:00
Peter Hutterer
4eacb581fb Only use mtdev for multitouch devices
mtdev uses a chunk of memory per device (~41kB), mainly for for its
internal event buffers. The average box these days can easily have 10
devices, but only few of those are multitouch. So check if we have
ABS_MT_POSITION axes and only create an mtdev instance if we do.

If a device has multitouch axes but not x/y, we will ignore events from this
device now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-07-27 10:14:04 +10:00
Peter Hutterer
98af2003d4 Don't re-open mtdev after PreInit
==16557== 388,240 (3,520 direct, 384,720 indirect) bytes in 10 blocks are definitely lost in loss record 1,669 of 1,671
==16557==    at 0x4A06F18: calloc (vg_replace_malloc.c:566)
==16557==    by 0xC3EAD4D: mtdev_new (core.c:345)
==16557==    by 0xC3EAE6B: mtdev_new_open (core.c:383)
==16557==    by 0xC1E0452: EvdevOpenDevice (evdev.c:2365)
==16557==    by 0xC1E068C: EvdevPreInit (evdev.c:2431)
==16557==    by 0x4B8304: xf86NewInputDevice (xf86Xinput.c:846)
==16557==    by 0x4B8857: NewInputDeviceRequest (xf86Xinput.c:989)
==16557==    by 0x4CCB4C: device_added (udev.c:211)
==16557==    by 0x4CCFA6: config_udev_init (udev.c:342)
==16557==    by 0x4CBE81: config_init (config.c:48)
==16557==    by 0x4A8A9A: InitInput (xf86Init.c:918)
==16557==    by 0x4921EE: main (main.c:258)

After PreInit, the fd and mtdev pointer are still valid. We check for the
fd, but unconditionally allocated another mtdev struct for each device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-07-25 09:23:53 +10:00
Daniel Stone
f5ede98085 Fix compilation warnings for non-multitouch builds
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-13 16:23:58 +10:00
Peter Hutterer
ff926d15b8 Move axis labels into a separate header file
Just to unclutter the code

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-15 16:05:19 +10:00
Peter Hutterer
b0e3c8f978 Split initializing one axis label out into a helper function
We need this for mixed axis devices. No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-15 16:05:16 +10:00
Peter Hutterer
9624f4e2ba Constify InputDriverRec->default_options
Removes a warning, and with the input ABI 18 this is forced to const in the
server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-08 09:12:14 +10:00
Peter Hutterer
047955f51e Move duplicate check up before mtdev allocation
No need to alloc mtdev if we then find out the fd is a duplicate one anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-08 09:12:14 +10:00
Peter Hutterer
8251d7a8ec Close the fd when mtdev open fails
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-08 09:12:14 +10:00
Peter Hutterer
ac5173163d Release mtdev data whenever we close the fd
Add a new EvdevCloseDevice() function to unify this.
We used to leak data
- PreInit allocates mtdev, but nothing except one error path released it.
- each DEVICE_ON re-allocates mtdev but it is never released

Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-08 09:12:14 +10:00
Peter Hutterer
61faf2e6e7 strtol doesn't need a empty string, NULL is good enough.
Fixes:
evdev.c: In function 'EvdevInitButtonMapping':
evdev.c:1659:25: warning: initialization discards 'const' qualifier from
pointer target type [enabled by default]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-08 09:12:14 +10:00
Peter Hutterer
7f3f98be7f Use xf86IDrvMsg in emuMB.c instead of ErrorF
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-06-08 09:12:14 +10:00
Chase Douglas
4145fe1c08 Fix buffer overrun when populating axis label property array
The axis label property array currently only has enough elements for the
non-multitouch axes. This change allocates enough space for all axes,
which prevents an array overrun write. This may manifest as stack
corruption on some platforms.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-07 11:31:57 +10:00
Chase Douglas
9ce068e760 Report the correct number of touches for MT protocol B devices
Protocol B devices report the number of touches by giving a maximum and
minimum slot value. The current code ignores the minimum value, which is
usually 0, and underreports the number of touches by 1.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-25 09:33:52 +10:00
Marcin Slusarz
2c8da280b3 Fix some obvious constness-related compile warnings.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-21 16:53:36 +10:00
Peter Hutterer
f28507e8ce Devices configured as mice need REL_X/Y
Some keyboards export scroll axes and any absolute axis possible in 11
dimensions. All these axes are mute, except possibly for the scroll wheels.

So if a device has a scroll axis, and we're configuring it as mouse, force
the x/y axes into existence. This stops the logspam complaining about not
enough axes on pointer movement after a xrandr change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-01 11:25:00 +10:00
Peter Hutterer
99340147b9 Fix inverted horizontal scroll (#46205)
REL_HWHEEL has a positive increment, not a negative one like REL_WHEEL.

X.Org Bug 46205 <http://bugs.freedesktop.org/show_bug.cgi?id=46205>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-16 07:11:30 +10:00
Peter Hutterer
76b1d58a97 evdev 2.7.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-07 20:39:09 +10:00
Peter Hutterer
224a28de25 Only force REL_X/Y if no ABS_X/Y exists
5c5b2c8db8 added forced x/y axes if a device
has any axes of the same mode. This was too broad a brush, some devices have
a relative wheel but absolute x/y axes and would now get misdetected as
purely relative device.

Only force relative axes if a device no rel x/y _and_ no abs x/y.

Reproducible: virtual machine with QEMU USB Tablet will stop working

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-01-26 16:07:10 +10:00
Chase Douglas
bc2f01ab83 Copy last valuator values into new touch valuator masks
Evdev is a 100% stateful protocol. The following represents three
touches. Two touches begin and end at the same time at (500, 500) and
(1000, 1000). The third touch begins after the first two end, and is at
(500, 500).

ABS_MT_SLOT		0	/* Set touch slot */
ABS_MT_TRACKING_ID	0	/* New touch with ID 0 in slot 0 */
ABS_MT_POSITION_X	500	/* Initial X position */
ABS_MT_POSITION_Y	500	/* Initial Y position */
ABS_MT_SLOT		1	/* Set touch slot */
ABS_MT_TRACKING_ID	1	/* New touch with ID 1 in slot 1 */
ABS_MT_POSITION_X	1000	/* Initial X position */
ABS_MT_POSITION_Y	1000	/* Initial Y position */
SYNC				/* End of frame */
ABS_MT_SLOT		0	/* Go back to slot 0 */
ABS_MT_TRACKING_ID	-1	/* Touch in slot 0 ended */
ABS_MT_SLOT		1	/* Go to slot 1 */
ABS_MT_TRACKING_ID	-1	/* Touch in slot 1 ended */
SYNC				/* End of frame */
ABS_MT_SLOT		0	/* Go back to slot 0 */
ABS_MT_TRACKING_ID	2	/* New touch in slot 0 with ID 2 */
SYNC				/* End of frame */
ABS_MT_TRACKING_ID	-1	/* Touch in last slot (0) ended */
SYNC				/* End of frame */

Note that touch 2 has the same X and Y position as touch 0. This is
implied because no new value was emitted for slot 0. In fact, Linux will
not emit an event in the same slot with the same event type and code
unless the value has changed. Thus, we can only assume that all the MT
valuators have the same values as they were when they were last sent for
the given slot.

This change adds an array of valuator mask to hold all the last valuator
values that came from evdev for each slot. When a new touch begins, all
the last values are copied into it.

This patch assumes initial axis values of 0 in each slot. Linux and
mtdev do not provide a facility to query the current values of axes in
each slot yet. This may cause spurious incorrect touch valuator values
at the beginning of an X session, but there's nothing we can do about it
right now.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-24 12:12:47 +10:00
Peter Hutterer
9d9c9870c8 Prefere relative axis labelling over absolute axis labelling
If a device has both relative and absolute axes, we'd initialise the
relative axes but label them with the absolute labels.

The current code is broken for mixed mode devices. Most of these devices
operate primarily in relative mode, but have some absolute axes available
for secondary functionality. For now, label the relative axes properly. We
can fix the absolute axes later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-01-18 16:47:16 +10:00
Peter Hutterer
5c5b2c8db8 Force x/y axes to exist on devices with any other axes (#44655)
Too much in the server relies on x/y to exist and to be axes 0 and 1. So if
any relative axes exist, initialize REL_X/Y or ABS_X/Y as well.

For servers up to 1.11: a scrollwheel-only device now has relative axes
where it only had buttons before.

For servers 1.12 or later: the device now has x/y in addition to the scroll
axes.

X.Org Bug 44655 <http://bugs.freedesktop.org/show_bug.cgi?id=44655>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2012-01-17 14:33:54 +10:00
Pete Beardmore
854df75f49 missing multitouch related define tests
addition of two missing define tests required when no multitouch related
symbols are available in user-space

Fixes X.Org Bug 44578 <https://bugs.freedesktop.org/show_bug.cgi?id=44578>

Signed-off-by: Pete Beardmore <pete.beardmore@msn.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-10 10:56:45 +10:00
Chase Douglas
8c55e94a6a Set the default resolution to 0
If we don't know the resolution, set it to 0. This is invalid, and tells
the X client that we don't know the resolution, rather than reporting an
incorrect value.

This value was originally from commit
6271494faa, which is the initial commit
from Adam Jackson adding absolute axis support.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-06 12:17:00 +10:00
Peter Hutterer
965338e9d0 Remove unused udev.c
Added in 683a55e504 due to a botched up
rebase -i. The contents of udev.c and EvdevIsVirtual are identical, there is
no need for an extra file for this one function.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-03 08:44:27 +10:00
Cyril Brulebois
0075da20d6 configure.ac: Fix udev/libudev dependency.
In 683a55e504, a dependency on libudev was
added, but documented in configure.ac as a dependency on udev (which
also happens to ship a pkg-config file).

Signed-off-by: Cyril Brulebois <kibi@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-03 08:40:02 +10:00
Jeremy Huddleston
009ac94a8e Remove redundant redeclaration of Evdev3BEmuPreInit
Found-by: Tinderbox
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-12-31 21:28:53 -05:00
Cyril Brulebois
4b76d80e93 evdev 2.6.99.901
Signed-off-by: Cyril Brulebois <kibi@debian.org>
2011-12-31 18:38:30 +01:00
Peter Hutterer
6dd6f2d3c6 Require xserver 1.12 RC1
Remove the ABI check hack, just check for the server version directly now
that we have one that definitely has the multitouch APIs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-29 10:37:38 +10:00
Peter Hutterer
0c7c087f77 Test for mtdev before assuming multitouch
If the XI2.2 headers are present but mtdev isn't, build without MULTITOUCH
defined.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-29 10:19:48 +10:00
Peter Hutterer
ba9377c6d9 Remove need for --enable-multitouch
If we spot inputproto 2.1.99.3, we assume we have a capable X server. This
should really be a server version check, but the server version hasn't been
bumped yet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-24 12:49:18 +10:00
Peter Hutterer
7f7606fc46 Include config.h from evdev.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-24 12:49:18 +10:00
Peter Hutterer
0ba58f483e Always include mt_mask in the evdev struct
Even if MT support isn't available, include it in the build. The checks in
the code check whether mt_mask is non-NULL but they would all need ifdef
escaping otherwise.

Leave the mtdev part inside the ifdef however, so that we don't need the
mtdev header if we don't build with multitouch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-24 12:18:16 +10:00
Peter Hutterer
5fb4875747 Merge branch 'multitouch' 2011-12-23 08:16:54 +10:00
Peter Hutterer
e99ab2314f Don't count legacy and MT axes twice
The kernel exports both ABS_X and ABS_MT_POSITION_X (and a couple others)
for a multi-touch capable device. For such devices, only count the axis once
since we submit ABS_MT_POSITION_X through ABS_X.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-20 15:11:56 +10:00
Peter Hutterer
191660189a Add is_blacklisted_axis() helper
The kernel exports a bunch of information as axis that shouldn't be an axis
and we don't treat it as axis in the server. Add this helper instead of
checking for the axis codes manually.

No function change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-20 14:18:30 +10:00
Peter Hutterer
a1c3f8efbb Drop now-unnecessary XI 2.1 and XI 2.2 error suppression defines
Gone since inputproto 2.1.99.3

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-20 13:32:06 +10:00
Peter Hutterer
f3c628acc4 Map ABS_MT_POSITION_X/Y into ABS_X/Y
MT axes are the same as traditional axes, so one into the other so we get
x/y coordinates regardless wich axes it comes from.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-20 11:09:37 +10:00
Paulo Zanoni
7909975b0b Fix relative events with swapped axes
After we swap the axes, we only call valuator_mask_set for axes that are
not zero, so we need to unset the axes that became zero when swapped.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-16 16:09:16 +10:00
Paulo Zanoni
8d6dfd13b0 Fix absolute events with swapped axes
We were correctly swapping the valuator values, but we were not
calling valuator_mask_unset() when needed, so the cursor kept jumping
to the edges.

This patch does the swapping before the main "for", so we don't need to
store unswapped_{x,y} and unswapped_isset_{x,y} even when we don't need
to swap.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-15 14:58:59 +10:00
Peter Hutterer
fed454192d Use xf86InitValuatorAxisStruct, the touch-specific version was dropped
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-15 08:55:32 +10:00
Chase Douglas
cf93a21df1 Don't send pointer events for multitouch touchscreen devices
Pointer events will be emulated by the server.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-29 18:02:58 -08:00
Peter Hutterer
fac1a41c75 Add the required defines to compile against the inputproto
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:57:26 +10:00
Peter Hutterer
3175a2a96d Print to the log if we find multitouch axes.
No real effect on the code, but it helps to have that line in the log when
searching for driver issues.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Peter Hutterer
5e9b027807 Replace 0/1 button values with enums
BUTTON_PRESS is much harder to confuse with a button number than a simple 1.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Peter Hutterer
2ce305129c Skip event posting for empty slots.
ABS_MT_SLOT comes before any other events. The following order of events
is common for protocol B devices (and mtdev):

...
EV_SYN
ABS_MT_SLOT        → posting here means we miss on the position information
ABS_MT_POSITION_X
ABS_MT_POSITION_Y
ABS_MT_SLOT
ABS_MT_POSITION_X
ABS_MT_POSITION_Y
EV_SYN

Store the stot state as SLOT_EMPTY after posting an event (i.e. EV_SYN and
ABS_MT_SLOT) and then don't post until the next slot/syn event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Peter Hutterer
9411749f76 Replace open_slot/close_slot with a SlotState enum
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Peter Hutterer
239e972be1 Simplify a condition, only the event type differs here
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Peter Hutterer
6127923fe0 When resetting the queue, don't reset the touchMask
Otherwise we segfault after the first SYN event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Peter Hutterer
fc4f98153c MT axes are counted separately, make sure they're initialized too.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Peter Hutterer
fabee66bcc 0 is the value for "unknown/unlimited" number of touches
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Peter Hutterer
91d90a7959 Use mtdev API to allocate/free mtdev structs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Peter Hutterer
c1b89bda12 Remove duplicate line
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:36 +10:00
Chase Douglas
907b7cad3f Ensure touchpad events are always processed with MT
Without this change, an MT touchpad in relative mode could end a touch
while not resetting the oldMask used to calculate relative values. This
fix allows a Magic Trackpad to behave as a relative mode device again.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-11 15:50:36 +10:00
Chase Douglas
c9a2b4e9ce Use MTDev for multitouch devices
MTDev translates all multitouch devices to the slotted evdev protocol.
This provides a clean and uniform interface and reduces message handling
inside the input module and X.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
2011-11-11 15:50:36 +10:00
Chase Douglas
e18abd0049 Add experimental XI 2.1 multitouch support
This multitouch addition only supports slotted MT evdev protocol
devices. Support must be enabled at configure time using
--enable-multitouch.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>

Amendments: XI_TouchMotion -> XI_TouchUpdate, rename mtMask to mt_mask

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:50:06 +10:00
Peter Hutterer
683a55e504 Use a new "Virtual Device" boolean property to mark virtual devices
Use udev to check for the device's sysfs path, if it contains LNXSYSTM it's
a kernel-emulated device. This property can then be used to determine if
there are any real devices connected, allowing the desktop environment to
e.g. turn off the touchpad whenever there's a mouse attached.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 15:42:31 +10:00
Peter Hutterer
a9cdb6590c Move misplaced #endif caused by smooth-scrolling merge
Bad conflict resolution in xf86-input-evdev-2.6.0-30-g745fca0

Reported-by: Sebastian Glita <glseba@yahoo.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-11 07:31:40 +10:00
Peter Hutterer
dd000dd4fa Bump to 2.6.99
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-09 16:04:06 +10:00
Peter Hutterer
745fca03a2 Merge branch 'smooth-scrolling'
Conflicts:
	src/evdev.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-11-09 16:01:48 +10:00
Peter Hutterer
b450efdf95 Support smooth scrolling on REL_WHEEL, REL_HWHEEL and REL_DIAL
Automatic smooth scrolling setup for these axes, with REL_WHEEL and REL_DIAL
both mapping into vscrolling. REL_WHEEL is the preferred axis.

Mouse wheel emulation is not yet updated for smooth scrolling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-11-09 15:56:55 +10:00
Peter Hutterer
eede8ccffc Don't crop long value from EvdevBitIsSet.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-04 07:47:47 +10:00
Jools Wills
2aba790ed3 emuThird: Use xf86SetIntOption, not xf86SetBoolOption for integer values
Signed-off-by: Jools Wills <jools@oxfordinspire.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-31 09:58:49 +10:00
Max Schwarz
49693892ce type-safe inline functions for bitmask manipulation
We can't use BitIsSet/SetBit from the server (inputstr.h) since they
operate on byte arrays. EvdevSetBit is added in preparation for the
"smooth-scrolling on wheel emulation" patch.

Signed-off-by: Max Schwarz <Max@x-quadraht.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-24 16:24:35 +10:00
Peter Hutterer
070f30e089 Exit axis labelling if axes are neither rel nor abs
No actual effect since labels_len is always 0 anyway but let's make the
return more explicit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-15 11:34:12 +10:00
Terry Lambert
ffe35b6c25 xf86-input-evdev: Return proper default for unknown values in pInfo->device_control.
Signed-off-by: Terry Lambert <tlambert@chromium.org>
Reviewed-by: Stephane Marchesin <marcheu@chromium.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-18 11:44:24 +10:00
Peter Hutterer
5069e05335 Remove unused misc_label and val
evdev.c: In function 'EvdevInitAxesLabels':
evdev.c:2192:11: warning: variable 'misc_label' set but not used
[-Wunused-but-set-variable]
obsolete with 880ad1e19a

emuWheel.c: In function 'EvdevWheelEmuPreInit':
emuWheel.c:252:10: warning: variable 'val' set but not used
[-Wunused-but-set-variable]
obsolete with b0737bdbd1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-06-15 10:36:36 +10:00
Peter Hutterer
0b9fad23a3 Print abs axes ranges on verbosity 6.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-06-15 10:36:36 +10:00
Peter Hutterer
b79776cf8c Require server 1.10
We require ABI 12.2 in the driver, enforce it through pkg-config.
Technically ABI 12.2 is first available in 1.9.99.902 but 1.10 looks so much
nicer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-06-15 10:36:36 +10:00
Daniel Kurtz
a52cd1cab2 Set prop_product_id undeletable
prop_invert was accidentally being set undeletable twice.

Signed-off-by: Daniel Kurtz <djkurtz@google.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-06-15 10:36:13 +10:00
Peter Hutterer
eaf202531f Export device node as property.
There is currently no mapping between XI devices and physical devices other
than what can be extracted by parsing the Xorg logfile. Add new property
"Device Node" to the driver to export the open device file.

Server 1.11 and later standardises on this property name.

The client is responsible for detecting if the device is on the same host
and converting the data into a more useful format (e.g. sysfs path).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-27 15:32:23 +10:00
Peter Korsgaard
74151b3c52 Handle touchscreens without BTN_TOUCH
Some touchscreens (like the Lumio crystaltouch in single touch mode) send
BTN_LEFT rather than BTN_TOUCH:

Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x202e product 0x5 version 0x111
Input device name: "LUMIO Inc LUMIO CrystalTouch ver 1.1C"
Supported events:
  Event type 0 (Sync)
  Event type 1 (Key)
    Event code 272 (LeftBtn)
    Event code 273 (RightBtn)
    Event code 274 (MiddleBtn)
  Event type 2 (Relative)
    Event code 9 (Misc)
  Event type 3 (Absolute)
    Event code 0 (X)
      Value    650
      Min        0
      Max     4095
    Event code 1 (Y)
      Value   3221
      Min        0
      Max     4095
  Event type 4 (Misc)
    Event code 4 (ScanCode)
Testing ... (interrupt to exit)
Event: time 1305882024.934011, type 4 (Misc), code 4 (ScanCode), value 90001
Event: time 1305882024.934017, type 1 (Key), code 272 (LeftBtn), value 1
Event: time 1305882024.934029, type 3 (Absolute), code 0 (X), value 270
Event: time 1305882024.934034, type 3 (Absolute), code 1 (Y), value 1513
Event: time 1305882024.934039, type 2 (Relative), code 9 (Misc), value 1

This causes evdev to handle these device as a mouse rather than a
touchscreen, which naturally doesn't work very well. We already internally
translate BTN_TOUCH as BTN_LEFT, so accept this kind of devices as
touchscreens by checking for devices with BTN_LEFT, absolute X/Y and NO
relative X/Y axes.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-27 15:26:57 +10:00
Peter Hutterer
e9d96e87ac Add a property to toggle function key mode
On some keyboards, the multimedia function keys are overlaid with the F
keys. This property enables clients to switch the primary mode of these F
keys between function keys and multimedia keys.
Some keyboards provide an Fn key to toggle between the modes. This is
hardware-specific and may or may not work on any given keyboard device.

The current imlementation is only hooked up to apple keyboards.
The kernel provides a tweak to enable/disable.

/sys/module/hid_apple/parameters/fnmode
    0 .. keyboard sends Fx keys, Fn disabled
    1 .. keyboard sends multimedia keys, Fn toggles to function keys
    2 .. keyboard sends function keys, Fn toggles to multimedia keys

If fnmode is on 0, we force it to 2.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
2011-05-27 15:26:57 +10:00
Peter Hutterer
bb15bac149 Export product/vendor ID through a property.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-05-27 15:26:53 +10:00
Peter Hutterer
7611d2fc73 Move invert variable to the block it is used in.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-05-20 13:38:26 +10:00
Chase Douglas
ebe41bfba7 Copy out of proximity values into current values selectively
Otherwise, an event that causes us to go into proximity with some new
valuator values will retain some old valuator values from when last in
proximity. This change ensures that all values posted while out of
proximity are accounted for.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-18 13:56:32 +10:00
Chase Douglas
68a6a18fc2 Ensure all known valuator values are stored when out of proximity
The current code overwrites *all* the stored axis values with whatever
came in from evdev. Evdev is a stateful protocol, so it only sends us
updates to the axis values that have changed. We need to only update
the values that have changed.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-05 13:49:28 +10:00
Chase Douglas
eeacd3e5a8 Ensure events are posted when entering into proximity
Fixes LP: #736829 (https://bugs.launchpad.net/bugs/573006)

Re-fixes old X.Org Bug 29645
<http://bugs.freedesktop.org/show_bug.cgi?id=29645>

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-04-05 13:48:58 +10:00
Simon Thum
5708e38494 rename valuator init functions
Since the mode of valuators (no longer?) bears a relation to the device class
actually initialized, this naming was quite misleading.

Signed-off-by: Simon Thum <simon.thum@gmx.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-23 13:11:09 +10:00
Rami Ylimäki
41111ce1ef Remove constness of device filename to avoid warning when freed.
A warning from free() can be avoided by casting the constness away
from its argument pointer or by not declaring the pointer as const in
the first place.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-09 15:28:10 +10:00
Rami Ylimäki
b4c47d5f94 Release leaked device identifier on input device disconnect.
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-09 15:23:50 +10:00
Rami Ylimäki
50193a0dd3 Release leaked XKB options on input device disconnect.
Currently the XKB options duplicated in EvdevAddKeyClass are never
released. For example, connecting and disconnecting a bluetooth
keyboard repeatedly causes a steadily growing memory leak.

Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-09 15:23:39 +10:00
Peter Hutterer
0049cce4d0 Use Absolute/Relative as argument to xf86Post*
xf86Post* takes an int for the is_absolute parameter. Since the XI protocol
spec requires Relative to be 0 and Absolute to be 1, use those instead to
make the code easier to read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-11 13:31:52 +10:00
Peter Hutterer
d9001a6be9 Add third button emulation.
New properties:
"Evdev Third Button Emulation" → switch on/off
"Evdev Third Button Emulation Timeout" → timeout until event is delivered
"Evdev Third Button Emulation Button" → phys button to be emulated
"Evdev Third Button Emulation Threshold" → move threshold before emulation
is cancelled

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <tissoire@cena.fr>
2011-02-08 11:34:51 +10:00
Peter Hutterer
22db196815 Static atoms don't need to be initialized to 0.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-31 13:39:46 +10:00
Peter Hutterer
54ac2306b8 Replace xf86Msg() with xf86IDrvMsg().
The latter provides a standardised message format in the form of
    driver name: device name: message

making it easier to grep for driver messages in the log.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-31 12:07:48 +10:00
Chase Douglas
768c25a99b Add support for masked valuators
With the X server now supporting masked valuators for XI2, enable
support in X evdev.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-25 11:34:24 +10:00
Chase Douglas
b5c9f41b2b Switch to "goto" logic for error handling when adding classes
This will be necessary for the addition of multitouch functionality.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-24 14:12:46 +10:00
Chase Douglas
8bc4be3048 Remove support for X input ABI < 12.2
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-24 14:12:39 +10:00
Peter Hutterer
30c3645e20 evdev 2.6.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-11 12:46:40 +10:00
Chase Douglas
3b52fe2ea4 Print out error messages when failing to init devices
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-06 08:35:27 +10:00
Peter Hutterer
540a4cce90 evdev 2.5.99.903
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-01-05 09:04:56 +10:00
Peter Hutterer
bed25600f6 Don't update first_val and num_val if we don't have data (#32480)
For touchpads, rel_queued may be on (due to abs to rel conversion) but the
delta for x/y is 0/0 on the first touch. Hence, we don't have any valuators
to post. The current results in a num_vals of -15 and a subsequent segfault
when the data is posted to the server.

Start with a last valuator of -1, so that we know if we have at least one to
post.

X.Org Bug 32480 <http://bugs.freedesktop.org/show_bug.cgi?id=32480>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-01-04 08:12:21 +10:00
Peter Hutterer
9aea1c5fa0 Add use_proximity bit for BTN_TOOL handling.
Touchpads send garbage data between BTN_TOOL_FINGER and BTN_TOUCH. This
leads to cursor movement towards invalid positions (bottom left corner,
usually).

Add a new flag "use_proximity" as a delimiter for BTN_TOUCH handling. If
unset, the actual proximity bits are ignored, no proximity events are sent
and BTN_TOUCH is used for the tool handling.

Example event stream for synaptics:

Event: time 1292893041.002731, -------------- Report Sync ------------
Event: time 1292893041.015807, type 1 (Key), code 330 (Touch), value 0
Event: time 1292893041.015812, type 3 (Absolute), code 0 (X), value 4283
Event: time 1292893041.015813, type 3 (Absolute), code 1 (Y), value 4860
Event: time 1292893041.015815, type 3 (Absolute), code 24 (Pressure), value 23
Event: time 1292893041.015817, type 3 (Absolute), code 28 (Tool Width), value 5
Event: time 1292893041.027537, -------------- Report Sync ------------
Event: time 1292893041.038854, type 3 (Absolute), code 0 (X), value 1
Event: time 1292893041.038857, type 3 (Absolute), code 1 (Y), value 5855
Event: time 1292893041.038859, type 3 (Absolute), code 24 (Pressure), value 1
Event: time 1292893041.038861, type 3 (Absolute), code 28 (Tool Width), value 5
Event: time 1292893041.038864, -------------- Report Sync ------------
Event: time 1292893041.062432, type 3 (Absolute), code 24 (Pressure), value 0
Event: time 1292893041.062435, type 3 (Absolute), code 28 (Tool Width), value 0
Event: time 1292893041.062437, type 1 (Key), code 325 (ToolFinger), value 0
Event: time 1292893041.062438, -------------- Report Sync ------------

Reported-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
2010-12-22 09:18:52 +10:00
Peter Hutterer
0c987a929d Revert "Don't count BTN_TOUCH as tool. (#29428)"
Synaptics devices send garbage between BTN_TOUCH and BTN_TOOL_FINGER. By
switching to use this as proximity data now, the pointer is reset to the
garbage data position (usually around 1/5855).

This reverts commit 899218e181.

Reported-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
2010-12-22 09:18:52 +10:00
Peter Hutterer
242a01eb0f Rename proximity to in_proximity.
No functional change, just making it a bit more obvious to read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
2010-12-22 09:07:28 +10:00
Peter Hutterer
7415953b9a Fix grammar typo in comment.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-12-21 11:13:15 +10:00
Peter Korsgaard
1ced7ec7e2 evdev: rename EvdevCacheCompare() to EvdevCache()
Since 59056e656c (Remove the reopen timer logic) from last year,
EvdevCacheCompare() is only used for caching ioctl values and not for
comparing, so remove the unused compare logic and rename the function
to EvdevCache().

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-12-13 10:46:43 +10:00
Peter Hutterer
1c5ad6f8a0 evdev 2.5.99.902
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-12-08 12:40:49 +10:00
Peter Hutterer
6fd1d0860e Return error codes from EvdevOpenDevice()
The server's behaviour is to stop adding new devices when a BadAlloc occurs
on any device (on the assumption that new devices won't magically have more
memory). Change EvdevOpenDevice() to return an error code of BadValue when
it fails (and thus to the server) to prevent other devices being ignored
because of one misconfigured one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-12-07 08:05:42 +10:00
Peter Hutterer
31ba99e9ed evdev 2.5.99.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-11-19 15:03:33 +10:00
Peter Hutterer
a4aefca2ed Reshuffle to avoid the need for XI86_CONFIGURED.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-28 13:11:56 +10:00
Peter Hutterer
20d7a0a4aa Input API 12 requires a valuator mode for each axis.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-27 08:32:21 +10:00
Nikolai Kondrashov
5e26ba8641 Extend button mapping to full ranges
Extend button code to number mapping to cover full BTN_MOUSE and BTN_MISC
ranges, including undefined codes.

This extends mapping introduced with 0367e387 to the following:

        1       BTN_LEFT        BTN_0       BTN_TOUCH
        2       BTN_MIDDLE      BTN_1       BTN_STYLUS
        3       BTN_RIGHT       BTN_2       BTN_STYLUS2

        8       BTN_SIDE        BTN_3
        9       BTN_EXTRA       BTN_4
        10      BTN_FORWARD     BTN_5
        11      BTN_BACK        BTN_6
        12      BTN_TASK        BTN_7
        13      0x118           BTN_8
        14      0x119           BTN_9
        15      0x11A           0x10A
        16      0x11B           0x10B
        17      0x11C           0x10C
        18      0x11D           0x10D
        19      0x11E           0x10E
        20      0x11F           0x10F

This should fix https://bugs.freedesktop.org/show_bug.cgi?id=30336

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-22 07:52:48 +10:00
Peter Hutterer
71dd18f728 Rename CountBits to EvdevCountBits.
Avoid name collision with the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2010-10-21 08:13:25 +10:00
Peter Hutterer
c3e49f2b95 Use an array for the proximity bits.
Instead of two lists that need to be kept in sync, just store the bits in an
array and run through them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-10-21 08:12:44 +10:00
Peter Hutterer
b06d3ffdcd Rename abs/rel/prox to abs_queued/rel_queued/prox_queued.
Mainly to avoid confusing between pEvdev->prox and pEvdev->proximity and to
better express what these fields are actually holding.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-10-21 08:12:38 +10:00
Benjamin Tissoires
3646371eef Add the names of the valuators for the multitouch properties
Thoses definitions have been included in the kernel and in the X server.
However, the evdev driver has not been updated accordingly.

Without these definitions, the multitouch axes are not correctly labelled.

Signed-off-by: Benjamin Tissoires <tissoire@cena.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-18 10:00:54 +10:00
Peter Hutterer
b48f4c41c0 Add proximity support.
When one of the tools comes into proximity, queue up a proximity event and
send it accordingly.

Includes special handling for tablets that do not send axes with tools
(#29645)

Some tablets send axis values, then EV_SYN, and in the next event the
BTN_TOOL_PEN/BTN_TOUCH, etc. For these tablets, the cursor doesn't move as
coordinates while not in proximity are ignored.

Buffer coordinates received while out-of-proximity and if we get a proximity
event without other coordinates, re-use the last ones received.

X.Org Bug 29645 <http://bugs.freedesktop.org/show_bug.cgi?id=29645>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-18 09:54:42 +10:00
Peter Hutterer
185ad42078 Rename evdev->tool to evdev->proximity.
evdev doesn't care about the actual tool used, only that it is used as an
indicator for proximity. Rename the field accordingly to make the code more
obvious to read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
2010-10-13 11:01:12 +10:00
Peter Hutterer
7282e3ac6c When posting buttons, post absolute valuators if we have them.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-11 08:47:47 +10:00
Peter Hutterer
c504852aa2 Fix valuator offset when posting absolute motion events.
If first_v was not zero, the values passed to xf86PostMotionEventP were
wrong.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-11 08:46:51 +10:00
Peter Hutterer
4bbf9c9125 Don't pass pointers around to first_v and num_v.
We only use them as values, no need for the addresses.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-11 08:46:09 +10:00
Peter Hutterer
684426a9d2 De-duplicate event queue access.
Factor out access to the next queue element in a static function to be
reused for button and key presses.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <tissoire@cena.fr>
2010-10-11 08:44:26 +10:00
Peter Hutterer
9664e5a487 Remove refcnt initialization from InputDriverRec.
Removed from the server with
commit 6130170e7e9b64c611ee942ec3455dd1a185193d
Author: Adam Jackson <ajax@redhat.com>
Date:   Sat Sep 18 06:41:35 2010 -0400

    xfree86: Remove unused refcounting from input drivers

And given that it was unused, we don't need to ifdef it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-10-11 07:52:14 +10:00
Nikolai Kondrashov
0367e3871f Clean up button code to number mapping
Now BTN_MOUSE, BTN_MISC and BTN_DIGI button ranges are all mapped to the
same lower numbers including first three, corresponding to the LMR mouse
buttons. Like this:

    1       BTN_LEFT        BTN_0       BTN_TOUCH
    2       BTN_MIDDLE      BTN_1       BTN_STYLUS
    3       BTN_RIGHT       BTN_2       BTN_STYLUS2

    8       BTN_SIDE        BTN_3
    9       BTN_EXTRA       BTN_4
    10      BTN_FORWARD     BTN_5
    11      BTN_BACK        BTN_6
    12      BTN_TASK        BTN_7
    13                      BTN_8
    14                      BTN_9

This streamlines the button mapping under the assumption that these ranges
don't generally appear in a single device simultaneously. If they do appear,
they will simply report overlapping button numbers.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-09-07 10:40:36 +10:00
Nikolai Kondrashov
617a09e298 Add BTN_TOUCH/STYLUS/STYLUS2 support.
These three buttons are mapped into buttons 1/2/3, respectively.
Overlapping range with BTN_LEFT/MIDDLE/RIGHT, assuming that these
ranges don't generally appear in a single device simultaneously.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-09-07 10:38:20 +10:00
Tim Yamin
b83515485b SwapAxes should rescale raw values when enabled
Current implementation assumes that X & Y axes have the same min and max
values. If they don't, you'll end up with funny behaviour if SwapAxes is
turned on.

Signed-off-by: Tim Yamin <plasm@roo.me.uk>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-09-07 10:31:02 +10:00
Peter Hutterer
009d442aa3 Merge branch 'input-api' of git://people.freedesktop.org/~whot/xf86-input-evdev 2010-09-01 13:04:29 +10:00
Nikolai Kondrashov
10493de96e Improve dumb tablet detection
Improve dumb tablet detection by checking if BTN_STYLUS or BTN_STYLUS2
(first or second pen barrel button) is present when BTN_TOOL_PEN is not
found.

This enables detection of tablets without explicit tool proximity reporting.
These include at least four UC-Logic tablet models: WP4030U, WP5540U,
WP8060U and PF1209, on which many Genius and Trust models are based.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-09-01 12:48:04 +10:00
Peter Hutterer
829facd516 Bump to 2.5.99.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-31 14:21:53 +10:00
Nikolai Kondrashov
fbafe59420 Fix comments about BTN_TOOL_PEN.
Fix incorrect usage of BTN_DIGI instead of BTN_TOOL_PEN in comments.
Fix forgotten pEvdev->digi reference.

Signed-off-by: Nikolai Kondrashov <spbnick@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-31 14:21:39 +10:00
Peter Hutterer
990540fa19 evdev 2.5.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-23 10:34:36 +10:00
Peter Hutterer
b8945e61eb man: don't reference README.mouse
No real reason to refer to the mouse driver's readme.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-23 10:27:45 +10:00
Peter Hutterer
97dc45b769 evdev 2.4.99.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-19 12:50:25 +10:00
Bartosz Brachaczek
ec6cb31cc4 evdev: Initialize valuators array. (#24737)
The array needs to be filled with zeros, otherwise we may end up sending
it with random values if non-zero values aren't in one row (which is the
case for A4Tech X-750F which sends REL_MISC events without a reason).

X.Org Bug 24737 <http://bugs.freedesktop.org/show_bug.cgi?id=24737>

Signed-off-by: Bartosz Brachaczek <b.brachaczek@gmail.com>
Tested-by: Bartek Iwaniec <hash87@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-16 10:45:26 +10:00
Bartosz Brachaczek
ed47c7f33e evdev: Revert "Set all valuators for relative motion events (#24737)"
It isn't necessary to post zero-deltas to X Server. In order not to post
uninitialized "v" array we should rather simply initialize it.

This reverts commit c1f16a4f59.

Signed-off-by: Bartosz Brachaczek <b.brachaczek@gmail.com>
Tested-by: Bartek Iwaniec <hash87@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-16 10:45:07 +10:00
Peter Hutterer
899218e181 Don't count BTN_TOUCH as tool. (#29428)
Devices that don't have a tool but BTN_TOUCH simply have the tool always on.
Devices that have a tool other than BTN_TOUCH set this tool before BTN_TOUCH
is emitted anyway.

X.Org Bug 29428 <http://bugs.freedesktop.org/show_bug.cgi?id=29428>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-08-16 10:04:08 +10:00
Peter Hutterer
4964c61f4b Return BadMatch for already configured devices.
PreInit can now return different error codes. Return BadAlloc for alloc
failures and BadMatch if the device was already configured or the cache
comparison/probe failed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 13:26:40 +10:00
Peter Hutterer
92e8dc4961 Use the new input API (changed PreInit function prototype).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 13:26:38 +10:00
Peter Hutterer
e0e4b7d89b Move private init down.
No real change, preparation for new input API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 10:57:34 +10:00
Peter Hutterer
d2c11d36a0 Use pInfo->options instead of dev->commonOptions.
No real change, preparation for new input API.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 10:57:34 +10:00
Peter Hutterer
2f636402d8 Add ifdefs for pre ABI 12 support.
The server doesn't provide these defines anymore, define them here for
future use. To be purged whenever we drop support for the current server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 10:57:34 +10:00
Peter Hutterer
3d3565c069 Remove usage of XI86_POINTER_CAPABLE and XI86_KEYBOARD_CAPABLE.
XI86_KEYBOARD_CAPABLE was write-only, both in the driver and the server.
XI86_POINTER_CAPABLE was write-only in the server and can be emulated with
has_abs_axes and has_rel_axes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-22 10:57:34 +10:00
Alex Warg
421585fda6 Fix out-of-bounds access if more than MAX_VALUATORS are present. (#28809)
The functions EvdevAddRelClass and EvdevAddAbsClass do out of bounds
accesses to vals and old_vals arrays in the EvdevRec structure if there are
more than MAX_VALUATORS axes reported by the kernel.

X.Org Bug 28809 <http://bugs.freedesktop.org/show_bug.cgi?id=28809>

Signed-off-by: Alex Warg <alexander.warg@os.inf.tu-dresden.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-01 08:16:07 +10:00
Peter Hutterer
8697811f56 man: some minor fixes to man page.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-28 10:49:56 +10:00
Peter Hutterer
b06bffdc97 Add myself to Authors in man page.
git blames me for about half the driver now, I guess that's enough
justification ;)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-28 10:49:56 +10:00
Gaetan Nadon
9410e452d2 config: use AC_PROG_INSTALL now supplied by XORG_DEFAULT_OPTIONS
It depends on util-macros 1.8
The existing statement can now be removed from the configuration file.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-06-16 15:19:39 -04:00
Gaetan Nadon
516e538da4 config: upgrade to util-macros 1.8 for additional man page support
Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS
The value of MAN_SUBST is the same for all X.Org packages.

Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS
The existing statement can now be removed from the configuration file.

Use Automake $() for variables in Makefile.am

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-06-16 15:19:38 -04:00
Gaetan Nadon
1f38e1bc11 COPYING: update and refactor the Copyright notices
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-06-16 15:17:06 -04:00
Peter Hutterer
456579ba30 Bump to 2.4.99
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-06-01 10:20:25 +10:00
Peter Hutterer
21a2ac818e Disable middle mouse button emulation by default.
The AUTO feature was the default, MB emulation was on until a middle mouse
button was pressed. MB emulation however results in a delay of the first
press, causing minor annoyances to the users and being generally confusing
when the behaviour before a button press is different to after a button
pres.

Disable the feature by default instead. There's not a lot of two-button mice
around anymore though and the inability to detect two-button mice makes for
non-deterministic detection of when the emulation should be on.

Middle button emulation can be enabled with a configuration snippet:

Section "InputClass"
        Identifier "middle button emulation"
        MatchIsPointer "on"
        Option "Emulate3Buttons" "on"
EndSection

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
2010-05-31 11:01:26 +10:00
Peter Hutterer
4c21624240 Remove libc wrappers for malloc, calloc and free.
Evdev is Linux-only, and we've had the above calls for quite a while now.
Plus, now that the server has removed them they generate _a lot_ of warnings
otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-05-28 09:24:28 +10:00
Peter Hutterer
6e244b1098 Move mode declaration, it's not const either.
What we're getting back from xf86SetStrOption is a strdup'd string, not
const, especially given that we free it a few lines down.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-28 09:24:28 +10:00
Peter Hutterer
e7c301563a Move opening the device into a separate function.
Re-use from EvdevOn and PreInit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-28 09:24:28 +10:00
Peter Hutterer
ffc2c9961f Move checks for calibration, inversion and axis swap to EvdevProbe.
Keyboard devices don't need these checks.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-28 09:24:28 +10:00
Peter Hutterer
7c01cff1fa Move EVIOCGRAB into a static func.
This is in preparation of some major rework, there are no functional
changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-28 09:24:28 +10:00
Peter Hutterer
e6e20c1b3e Move error handling in PreInit down to the end.
Just have one exit path instead of different ones. Guards are in place to
avoid freeing/deleting something that shouldn't be.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-05-28 09:24:28 +10:00
Peter Hutterer
b27d03b248 Comment odd EVIOCGRAB behaviour and reshuffle conditions a bit.
The reason for this rather weird approach is to ungrab immediately after
getting a successful grab. Evdev shouldn't be hogging the device if nothing
is done with it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-05-28 09:24:28 +10:00
Peter Hutterer
ba78428ed5 Remove support for kernel 2.4.
It's been 6 years since 2.6, I doubt evdev would even work on 2.4 right now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2010-05-28 09:24:28 +10:00
Gaetan Nadon
041a1f246a config: AC_PROG_SED is required explicitly.
It sets the SED env variable with an appropriate sed program path
It still works on some platform when not explicity called.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-05-10 21:44:43 -04:00
Peter Hutterer
44b80d177f Update a stale comment about the use of pEvdev->tool.
Including some typo fixes in the same comment.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-05-06 11:11:30 +10:00
Peter Hutterer
7bbbce9a83 Read the device resolution from the kernel.
For earlier kernels, use the previous hardcoded resolution in place.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2010-04-29 22:05:23 +10:00
Peter Hutterer
35b6085bf8 config: remove AH_TOP autoheader statement.
Include it in evdev.h instead.
xorg-server.h is required to define the right datatype sizes on 64 bit,
hence ensure that evdev.h is the first included in each file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-29 09:07:03 +10:00
Gaetan Nadon
539d67505c Revert "config: remove AH_TOP autoheader statement"
The changed location of xorg-server.h had some side-effects.
See Bug 27768 <https://bugs.freedesktop.org/show_bug.cgi?id=27768>

This reverts commit 9dbace89be.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-22 11:42:49 +10:00
Peter Hutterer
a77dea1caa Merge branch 'master' of git://gitorious.org/omcfadde/xf86-input-evdev 2010-04-20 16:31:09 +10:00
Oliver McFadden
5fb1e841eb evdev: EvdevProbe: check ioctl() return value and warn on failure.
Called function "ioctl" whose return value should be checked (checked 10
out of 11 times)

Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-20 09:12:43 +03:00
Oliver McFadden
a4f2d12cd8 evdev: ioctl() may return a negative value therefor use a signed integer.
Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-20 09:12:38 +03:00
Oliver McFadden
6b5c0401e2 evdev: leaked_storage: free memory allocated from the xf86Option code.
Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-20 09:12:30 +03:00
Gaetan Nadon
993e011b91 man: Use Autoconf provided $(AM_V_GEN)$(SED)
Enables silent rule and use platform appropriate version of sed.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:07 -04:00
Gaetan Nadon
2d5e922a6d include: EXTRA_DIST is not required for header files.
The sdk_HEADERS is sufficient as the "sdk" prefix
matches the "dir" suffix in the "sdkdir" variable.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:07 -04:00
Gaetan Nadon
41a38ec886 config: require macros 1.4, fix warnings, m4 quotings and layout
Fix some m4 quoting
Fix some autoconf warnings
remove AC_PROG_CC as it overrides AC_PROG_C_C99 from XORG_DEFAULT_OPTIONS
Regroup statements per section
Add comments
Upgrade X.Org macros to 1.4 for INSTALL file copying

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:07 -04:00
Gaetan Nadon
b31c00efea config: optional extension check for inputproto not required
The check should be in PKG_CHECK_MODULES permanently.

The XORG_DRIVER_CHECK_EXT will add inputproto to PKG_CHECK_MODULES
only if the extension is available. By definition, this extension
is always available and the evdev driver cannot function without it.

This is evidenced by the absence of XINPUT conditional code.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:07 -04:00
Gaetan Nadon
b48dcfa3f2 config: replace deprecated INCLUDES with AM_CPPFLAGS
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:06 -04:00
Gaetan Nadon
44baa36b99 config: refactor and comment the sdkdir distcheck workaround
Seperate legitimate sdkdir usage from distcheck workaround.
Comment this non obvious workaround.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:06 -04:00
Gaetan Nadon
7fa5982d47 config: remove unrequired AC_HEADER_STDC
Autoconf says:
"This macro is obsolescent, as current systems have conforming
header files. New programs need not use this macro".

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:06 -04:00
Gaetan Nadon
fe8d0fa11a replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS
Regroup AC statements at the top.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:06 -04:00
Gaetan Nadon
09b918db86 config: update AC_PREREQ statement to 2.60
Unrelated to the previous patches, the new value simply reflects
the reality that the minimum level for autoconf to configure
all x.org modules is 2.60 dated June 2006.

ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:06 -04:00
Gaetan Nadon
9dbace89be config: remove AH_TOP autoheader statement
The generated config.h does not need to include xorg-server.h
for the content it provides.
Add #include <xorg-server.h> in .[hc] files as needed.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-04-19 08:52:06 -04:00
Paulo Ricardo Zanoni
aaf65e7bfa Don't set pEvdev->rel for mouse wheel events
This way we won't get empty MotionNotify events when the mouse wheel is
used.

Signed-off-by: Paulo Ricardo Zanoni <pzanoni@mandriva.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-17 15:17:27 +10:00
Peter Hutterer
8eede7ea8d Use X_PROBED instead of X_INFO for probed values.
No functional changes, only the log output differs now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
2010-04-09 14:32:18 +10:00
Peter Hutterer
1936632cb0 evdev 2.4.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-04-06 10:31:16 +10:00
Simon Thum
0dc931e1ac move feedback initialization up
This allows the backend to propery initialize the feedback from options,
as it works with most other drivers. This is the hacky equivalent of
fixing the initialization of pointer acceleration, which would require
changes to most drivers however.

Signed-off-by: Simon Thum <simon.thum@gmx.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-03-24 07:50:55 +10:00
Peter Hutterer
d525b48a2f When labeling a device as touchpad, only check for LMR buttons.
Touchpads that have physical buttons have either LMR or BTN_TOOL_FINGER.
Other buttons in the range evdev recognises shouldn't be taken into account
here - they skew the detection towards touchpads and away from touchscreens.

Fedora Bug 571639

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Simon Thum <simon.thum@gmx.de>
2010-03-18 08:04:01 +10:00
Oliver McFadden
801778c310 emuMB: default to disabled mouse button emulation for touchscreens.
Because touchscreens only use one button (see EvdevProcessKeyEvent())
EvdevMBEmuFilterEvent() never calls EvdevMBEmuEnable(..., FALSE) to
disable emulation. This results in touchscreen devices incurring a delay
of Emulate3Timeout (typically 50 ms.)

Default to MBEMU_DISABLED for touchscreen devices (unless overwritten by
Xorg.conf.)

Signed-off-by: Oliver McFadden <oliver.mcfadden@nokia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-02-25 16:07:39 +10:00
Peter Hutterer
99505011d1 man: fix man page formatting for option EmulateWheel.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-02-18 19:02:40 +10:00
Gaetan Nadon
fd036680c2 config: move CWARNFLAGS from configure.ac to Makefile.am
Compiler warning flags should be explicitly set in the makefile
rather than being merged with other packages compiler flags.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-02-11 10:08:07 -05:00
Andrej Gelenberg
e81cd935cf Implement XSetDeviceMode request handler
Implement XSetDeviceMode request handler for evdev.
Devices with absolute axes can be switched in relative
mode or absolute mode. Devices with relative axes
can be switched only in relative mode. Other devices
return BadMatch, cause they have no valuators and
don't report motion events.

New option "Mode" force devices with absolute axes
to work in relative or absolute mode.

Need xinputproto.

Signed-off-by: Andrej Gelenberg <andrej.gelenberg@udo.edu>
2010-01-19 21:40:06 +13:00
Alan Coopersmith
0b5844ce67 Update Sun license notices to current X.Org standard form
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2010-01-15 15:10:55 -08:00
Dima Kogan
d6beb16be2 allow wheel emulation to work with absolute-position devices
Signed-off-by: Dima Kogan <dkogan@cds.caltech.edu>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-08 11:02:05 +10:00
Dima Kogan
2f5a0fb698 removed unnecessary static declarations
Signed-off-by: Dima Kogan <dkogan@cds.caltech.edu>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-07 11:53:53 +10:00
Peter Hutterer
1b0df04abe Fix up BTN_TOUCH handling for non-button tablets.
BTN_TOOL_* is treated as tool, just like before. BTN_TOUCH on the other hand
may need to be treated as a button left press. This again requires a button
class.

Tested on an HP Touchsmart and a Wacom tablet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-02 09:34:22 +10:00
Peter Hutterer
2ca24a16f0 Only init the calibration property for absolute devices.
Relative devices can't be calibrated anyway so why bother.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-01 15:44:18 +10:00
David Woodhouse
7b285a802b Report initial calibration parameters.
Where an initial calibration is provided through the Calibration option
to the driver, it wasn't being exposed in the 'Evdev Axis Calibration'
property. Remedy that...

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-01 14:14:17 +10:00
David Woodhouse
f187badb71 Swap axes before applying touch screen calibration.
When the SwapAxes option is set, the X and Y axes in calibration should
be labelled as the user perceives them -- not as the kernel sends them.

Currently, we apply the X-axis calibration to the X-axis of the input,
and then do the axis swapping so we've actually applied the X-axis
calibration to what the user sees as the Y-axis.

This patch changes the order of the operations, so that the axes are
swapped before the calibration is applied.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-01 14:12:49 +10:00
Peter Hutterer
0e9d75ba68 Fix a comment, EV_CNT is available since 2.6.24
Introduced in the kernel as 2.6.23-6147-g7b19ada.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-12-01 14:11:55 +10:00
Gaetan Nadon
3a6d27b83d Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
Now that the INSTALL file is generated.
Allows running make maintainer-clean.
2009-11-23 09:25:05 -05:00
Gaetan Nadon
886e303af1 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206
Automake 'foreign' option is specified in configure.ac.
Remove from Makefile.am
2009-11-19 09:40:56 -05:00
Gaetan Nadon
3d23ef4888 INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206
Add missing INSTALL file. Use standard GNU file on building tarball
README may have been updated
Remove AUTHORS file as it is empty and no content available yet.
Remove NEWS file as it is empty and no content available yet.
2009-11-19 09:40:56 -05:00
Gaetan Nadon
c0473e4921 Several driver modules do not have a ChangeLog target in Makefile.am #23814
The git generated ChangeLog replaces the hand written one.
Update configure.ac to xorg-macros level 1.3.
Use XORG_DEFAULT_OPTIONS which replaces four XORG_* macros
Update Makefile.am to add ChangeLog target if missing
Remove ChangeLog from EXTRA_DIST or *CLEAN variables
This is a pre-req for the INSTALL_CMD
2009-11-19 09:40:56 -05:00
Gaetan Nadon
afc9e91765 .gitignore: use common defaults with custom section # 24239
Using common defaults will reduce errors and maintenance.
Only the very small or inexistent custom section need periodic maintenance
when the structure of the component changes. Do not edit defaults.
2009-11-19 09:40:56 -05:00
Bartosz Brachaczek
c1f16a4f59 Set all valuators for relative motion events (#24737)
We should process all the deltas reported by a relative motion device,
otherwise some devices such as A4Tech X-750F or similar may trigger a
situation when the `v` array contains random values (it isn't
initialized anywhere) and later we process them and in effect the mouse
cursor "jumps" on the screen.
I'm not sure why, but we also must be sure that the `first` and `last`
variables reflect the axis map, otherwise the mouse cursor "jumps" on
the screen when clicking mouse buttons in some rare cases reported by
Bartek Iwaniec on Bugzilla. That's why a simple initialization of the
`v` array with zeros isn't sufficient.

X.Org Bug 24737 <http://bugs.freedesktop.org/show_bug.cgi?id=24737>

Signed-off-by: Bartosz Brachaczek <b.brachaczek@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-11-19 09:24:46 +10:00
Dmitry Torokhov
a0f7f34dc5 Relax checks when reopening devices
When checking whether we are dealing with the same device as before
when we try to reopen it evdev should not require exact match of
entire keymap. Users should be allowed to adjust keymaps to better
match their hardware even after X starts. However we don't expect
changes in [BTN_MISC, KEY_OK) range since these codes are reserved for
mice, joysticks, tablets and so forth, so we will limit the check to
this range.

The same goes for absinfo - limits can change and it should not result
in device being disabled.

Also check the length of the data returned by ioctl and don't try to
compare more than we were given.

[peter: moved the key comparison below the led+abs comparison]

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-11-05 08:41:59 +10:00
Peter Hutterer
11669d8279 Fix drag-lock property handler for multiple draglock buttons.
Parsing of the values was wrong. Given an input of 1 2 3 4, button 1 sets
the lock for button 2 and button 3 sets the lock for button 4.

This also means we need to return BadMatch if the property isn't a multiple
of 2.

Red Hat Bug 524428 <https://bugzilla.redhat.com/show_bug.cgi?id=524428>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-11-02 14:01:25 +10:00
Peter Hutterer
9cbffda910 Forward keycodes > 255
The server doesn't handle them yet but eventually it should learn.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-26 15:42:54 +10:00
Peter Hutterer
59056e656c Remove the reopen timer logic.
This logic was needed in older kernels that sometimes gave error messages
after coming back from resume (2.6.27 release kernels). I haven't seen any
log files that needed this reopen timer in a long time, suggesting that need
for it is gone.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-20 16:16:02 +10:00
Peter Hutterer
aa6399fdb9 evdev 2.3.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-19 11:40:24 +10:00
Peter Hutterer
1d86f5dec1 Convert IgnoreAbsolute/RelativeAxes options into trinary state.
The Xen Virtual Pointer device exports both absolute and relative axes from
the kernel device. Which coordinates are used is a run-time decision and
depends on the host-specific configuration.
0a3657d2ee broke these devices, and they are
now unusable out-of-the-box as there is no configuration to cover them.

This patch converts the IgnoreAbsoluteAxes and the IgnoreRelativeAxes
configuration options into a trinary state.
1. If unset, configure the device as normal by trying to guess the right
   axis setup.
2. If set to true, ignore the specific axis type completely (except for
   wheel events).
3. If set to false, explicitly 'unignore' the axis type, alwas configuring
   it if it is present on the device. This setting introduces seemingly
   buggy behaviour (see Bug 21832)

1. and 2. replicate the current driver behaviour.
The result of 3. is that is that if a device has absolute axes and the
options set to false, both axes will be initialized (absolute last to get
clipping right). This requires axis labelling priorty to switch from
relative first to absolute first.

Relative events are forwarded into the server through the absolute axes,
the server scales this into the device absolute range and everyone is happy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-15 11:36:49 +10:00
Peter Hutterer
fbd86e2530 Fix copy/paste typo in comment. 2009-10-15 10:52:27 +10:00
Peter Hutterer
9ea1f9a695 Fix typo, use uppercase like the other messages
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-13 18:30:44 +10:00
Oliver McFadden
57b54ee399 evdev: Support the "Calibration" string option.
Originally based on a patch from Daniel Stone, this commit allows for
the calibration factors to be set either from Xorg.conf or via HAL.

Previously the only way was via the properties interface.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-13 18:30:43 +10:00
Peter Hutterer
f2dc0681fe Finalize the middle button emulation when a read error occurs (#23048)
If a read error occurs, remove the block and wakeup handlers for middle
mouse button emulation. Otherwise, they'll still be around after the device
has been reopened and overwritten with the new ones created by EvdevOn. Once
this happened, future removal of the device can lead to a server crash.

X.Org Bug 23048 <http://bugs.freedesktop.org/show_bug.cgi?id=23048>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-10 11:12:42 +10:00
Peter Hutterer
3fa49dfcab evdev 2.2.99.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-08 14:26:41 +10:00
Peter Hutterer
941391ca34 Add explicit options to ignore relative or absolute axes.
The X server cannot deal with devices that have both relative and absolute
axes. Evdev tries to guess wich axes to ignore given the device type and
disables absolute axes for mice and relative axes for tablets, touchscreens
and touchpad. This guess is sometimes wrong and causes exitus felis
domesticae parvulae.

Two new configuration options are provided to explicitly allow ignoring an
axis. Mouse wheel axes are exempt and will work even if relative axes are
ignored.  No property, this option must be set in the configuration.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Daniel Stone <daniel@fooishbar.org>
2009-10-07 12:55:22 +10:00
Peter Hutterer
2144f7d834 Remove unused has_xy.
has_xy is only ever set, but not used for anything else.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-30 12:30:59 +10:00
Peter Hutterer
61b4e88e01 emuWheel: fix signed/unsigned screwup
This patch fixes wheel emulation on buttons other than 0.

Reported-by: Andy Neitzke
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-23 19:29:41 +10:00
Peter Hutterer
9ee70943ec Require xorg-macros 1.3 and XORG_DEFAULT_OPTIONS
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-11 09:57:22 +10:00
Peter Hutterer
415b6ffa95 Only take the driver-internal button mapping to count buttons (#23405)
Regression:
    If a user has multiple buttons mapped to the same button number, the
    number of buttons counted is set to a wrong value.  e.g. a button
    mapping of 1 1 1 for a mouse with three buttons would only initialize 1
    button to the X server.

    In the future, the user cannot change this button mapping as the server
    only knows about one button.

The user-supplied button map (option ButtonMapping) shouldn't matter when
counting the buttons. Only the driver-internal mapping (BTN_0 -> button 1,
etc.) matters.

X.Org Bug 23405 <http://bugs.freedesktop.org/show_bug.cgi?id=23405>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-20 11:09:12 +10:00
Dima Kogan
f4ba2bd785 Allow 0 as wheel emulation button for unconditional scrolling (#20529)
If wheel emulation is on and the emulation button is 0, then any x/y motion
of the device is converted into wheel events. The devices becomes a
scrolling-only device.

Signed-off-by: Dima Kogan <dkogan@cds.caltech.edu>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-18 13:09:33 +10:00
Peter Hutterer
2e5f68754f Restrict wheel emulation to a single axis at a time.
Wheel emulation works for both horizontal and vertical axes. Thus, if a
device doesn't move in perfect straight line, scroll events build up on the
respective other axis.

In some clients, scroll wheel events have specific meanings other than
scrolling (e.g. mplayer). In these clients, erroneous scrolling events come
at a high cost.

Thus, if a scroll wheel event is generated for one axis, reset the inertia
of the other axis to 0, avoiding the buildup of these erroneous scrolling
events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-18 13:07:13 +10:00
Peter Hutterer
8fdb2abb6f man: fix documentation for EVDEV_PROP_WHEEL_BUTTON
0 doesn't disable it, it's still treated like a button number. copy/paste
error.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-14 13:00:09 +10:00
Peter Hutterer
ca0fb396f1 evdev 2.2.99.1 2009-08-14 11:00:12 +10:00
Peter Hutterer
7967677789 Treat tablets (BTN_TOOL_PEN devices) differently from touchpads.
The previous checks for BTN_TOOL_FINGER and BTN_TOUCH reported false
positives for touchpads for most popular tablets.
As a result, their events were converted to relative events.

Add a new flag EVDEV_TABLET pending presence of BTN_TOOL_PEN and ignore the
touchpad special casing to report the events as-is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-14 10:15:00 +10:00
Peter Hutterer
36064dca90 Add EvdevPostButtonEvent API to immediately post a button event (#23269)
The wheel emulation code needs this API. When the timer expires, the event
must be posted immediately, not enqueued onto the internal event queue.
Otherwise, the emulated middle button press is enqueued only and no event is
sent until the next physical event (and its EV_SYN) arrives.

Since the timer is triggered outside of the SIGIO and SIGIO is blocked
during this period anyway, we could also just enqueue the event and flush by
simulating an EV_SYN. It's easier this way though.

X.Org Bug 23269 <http://bugs.freedesktop.org/show_bug.cgi?id=23269>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Oliver McFadden <oliver.mcfadden@nokia.com>
2009-08-14 10:00:31 +10:00
Peter Hutterer
8bf93709cb Rename parts of the Post API to a Queue API.
Button and key events aren't posted from EvdevPost*Event, they are simply
enqueued onto the evdev-internal event queue until the next EV_SYN arrives.
Rename those interfaces from EvdevPost* to EvdevQueue* and leave only those
that actually post to the server with a matching "*Post*" name.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Oliver McFadden <oliver.mcfadden@nokia.com>
2009-08-13 14:36:46 +10:00
Peter Hutterer
37373a223b comment typo fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 14:36:44 +10:00
Peter Hutterer
d764dded18 Skip check for EVDEV_RELATIVE_EVENTS for wheel events.
This patch fixes a regression introduced with 1f641d75e.
Wheel axis events are posted as button clicks, a device may have no relative
axes but it does need to post these button clicks.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-11 14:38:26 +10:00
Michael Witten
f352598e45 evdev.c: Fix/improve discrimination of rel/abs axes
The relevant comment from evdev.c:

We don't allow relative and absolute axes on the same device. The
reason is that some devices (MS Optical Desktop 2000) register both
rel and abs axes for x/y.

The abs axes register min/max; this min/max then also applies to the
relative device (the mouse) and caps it at 0..255 for both axes.
So, unless you have a small screen, you won't be enjoying it much;
consequently, absolute axes are generally ignored.

However, currenly only a device with absolute axes can be registered
as a touch{pad,screen}. Thus, given such a device, absolute axes are
used and relative axes are ignored.

The code for initializing abs/rel axes has been abstracted out into
3 functions, so that initialization in EvdevInit(device) is as easy
as:

    if (pEvdev->flags & (EVDEV_TOUCHPAD | EVDEV_TOUCHSCREEN))
        EvdevInitTouchDevice(device, pEvdev);
    else if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
        EvdevInitRelClass(device, pEvdev);
    else if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
        EvdevInitAbsClass(device, pEvdev);

Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-06 14:06:24 +10:00
Oliver McFadden
69d6ff3e01 evdev: Use the EvdevPost...Event() functions in the emulation code.
This is similar to commit 1f641d75ed.

It provides the same functionality of queuing the (in this case
emulated) events and waiting until an EV_SYN synchronization event is
received before posting them to the server.

This preserves the order of events (both real and emulated) and ensures
that MotionNotify events will always be posted first. It also unifies
the event posting into a few small functions which improves
maintainability.

From this point on, you should never use the xf86Post...Event()
functions in new code, but rather the EvdevPost...Event() versions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-04 16:07:17 +10:00
Peter Hutterer
6f4634111a Evdev doesn't require inputproto.
None of the inputproto headers seem to be included anywhere.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-30 09:29:36 +10:00
Oliver McFadden
1f641d75ed evdev: Only send the events at synchronization time.
Instead of just posting the button/key press/release events to the
server as soon as they arrive, add them to an internal queue and post
them once we receive an EV_SYN synchronization event.

The motion events are always sent first, followed by the queued events.
There will be one motion event and possibly many queued button/key
events posted every EV_SYN event.

Note that the size of the event queue (EVDEV_MAXQUEUE) is arbitrary and
you may change it. If we receive more events than the queue can handle,
those events are dropped and a warning message printed.

Tested on my Lenovo T400 using evdev for all input devices; keyboard,
touchpad, and trackpoint.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-29 15:26:53 +10:00
Peter Hutterer
2994825665 Don't register middle mouse button emulation handlers for keyboards.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-20 14:52:46 +10:00
Oliver McFadden
9bfd9e8a36 Coverity Prevent: NO_EFFECT in EvdevWheelEmuSetProperty:
Event unsigned_compare: Comparing unsigned less than zero is never true. "pEvdev->emulateWheel.timeout < 0UL"
342  	            if (pEvdev->emulateWheel.timeout < 0)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-17 11:08:51 +10:00
Peter Hutterer
dcca28a59c Count REL_DIAL as a scrollwheel during EvdevProbe (#21457)
The Griffin Powermate only has a single axis (REL_DIAL). This axis is
posted as horizontal scroll wheel, so we need to ensure the scroll wheel
setup (including ensuring that enough buttons are available) is triggered
accordingly.

X.Org Bug 21457 <http://bugs.freedesktop.org/show_bug.cgi?id=21457>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-03 10:37:35 +10:00
Asbjrn Sannes
db8b1ca5cf evdev: Fix spelling of property in man page to match source code. #22571
Signed-off-by: Asbj�rn Sannes <ace@sannes.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-02 07:55:30 +10:00
Peter Hutterer
8cc0d0f285 Fix absolute axis labelling - mapping must be initialized before the labels.
88eedea281 added axis labelling to the
valuator initialization. This requires the axis mapping to be established
before the absolute axis labels are initialized.

88eedea did this for relative axes, but missed out on the absolute ones. As
a result, all abs. labels were initialized to "None".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-29 14:40:21 +10:00
Peter Hutterer
aa1609285d Message "found absolute touchpad" also applies to tablets - fix.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-29 14:40:21 +10:00
Peter Hutterer
b07ab6ea97 If a device fails to initialize relative axes, init the abs. axes instead.
Some devices have relative axes that don't count (scroll wheels). In this
case, don't claim we've initialized relative axes, continue with the
absolute axes instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-29 14:40:18 +10:00
Peter Hutterer
7bc48c666d Fix wrong axis label index causing OOB reads/writes.
The atoms array is filled with each axis atom in mapping order (i.e. after
the driver mapping has been applied). 'axis' OTOH is from 0 to ABS_MAX.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-23 15:47:41 +10:00
Peter Hutterer
880ad1e19a Initialize the axis labels to 0, not "misc".
If we don't know what an axis label is, then don't initialize it. None is a
valid label.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-23 14:53:11 +10:00
Peter Hutterer
6ab23e4519 Add missing checks for ABI_XINPUT_VERSION 7.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 16:19:08 +10:00
Peter Hutterer
88eedea281 Cope with ABI_XINPUT_VERSION 7 - requires button + axes labels.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 15:33:48 +10:00
Peter Hutterer
9a5a4fed3a Split axes and button labels into separate function.
We'll re-use this bit very soon.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-06-18 15:18:14 +10:00
Derek Upham
0a3657d2ee evdev: Prevent driver from processing motion events that it has not configured. #21832
The current implementation initializes itself to support relative
motion events, or absolute motion events, or neither.  But the
event-handling code attempts to process all events, no matter what the
initialization was.  This patch reproduces the flag tests found during
init, to skip events that the driver doesn't support.

Signed-off-by: Derek Upham <sand@blarg.net>
Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-28 08:53:56 +10:00
Peter Hutterer
dc2191285e Deal with BTN_3 to BTN_9 buttons.
These buttons were previously mapped to 0, i.e. inactive. This patch
slightly improves things in that the buttons are now mapped to 8+.

Devices that have both BTN_3 and BTN_SIDE (or a similar pair in that
sequence) have both mapped to the same button number though.
Devices that have BTN_LEFT, BTN_0, BTN_3 and BTN_SIDE have the last three
mapped to 8 (and their followers have double-mappings too). We'll fix that
once we actually see devices affected by this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 15:51:08 +10:00
Peter Hutterer
255b9f6bbf Only initialize the number of buttons we actually have.
This takes into account driver-configured button mappings, i.e. if device
with one button has this button mapped to 25 through the ButtonMapping
option, the X server will think the device has result 25 buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 15:51:08 +10:00
Peter Hutterer
aa117d49a5 Rename pEvdev->buttons to pEvdev->num_buttons for clarity.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 15:51:08 +10:00
Peter Hutterer
b358f1eb3a Ensure enough buttons are advertised to pass the button mapping.
Some buttons are mapped to higher button numbers. For example, BTN_0 is
posted as button 8 if BTN_LEFT is present. On top of that, the
driver-specific button mapping may map the button to something else again.
We need to take these mappings into account when counting the number of
buttons on the device.

Example: A device with BTN_LEFT and BTN_0 and a mapping from 1 -> 7 and 8 ->
2.

BTN_LEFT is mapped to 1. 1 is mapped to 7. num_buttons is 7.
BTN_0 is mapped to 8. 8 is mapped to 2. num_buttons remains 7.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 15:51:08 +10:00
Peter Hutterer
33cc112ca1 Up the number of button labels atoms to EVDEV_MAXBUTTONS.
Button labels would smash memory if the device had less than 4 buttons and
did not advertise a wheel event. In this case the hard-coded wheel button
labels would write past the atoms[] boundary.

Potential memory smash if a device had a BTN_LEFT and BTN_0, since the
latter would map to 8, regardless of the the number of actual buttons
(same with BTN_MIDDLE and BTN_1 or BTN_RIGHT and BTN_2).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 15:51:08 +10:00
Peter Hutterer
3c43d880f1 Only label axes and buttons if the device has axes or buttons.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-21 15:51:08 +10:00
Peter Hutterer
5462898935 Use xf86DisableDevice instead of the DIX' DisableDevice.
DisableDevice has changed API in xi2, xf86DisableDevice hasn't. So let's use
this one so we can have one version for master and xi2.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-16 14:27:08 +10:00
Dan Nicholson
9243d338d1 Fix copy-paste error when probing type name
A minor copy and paste error was introduced in 71e9a69e leaving an "if"
where an "else if" should be. Without this, any device configured as
XI_TOUCHPAD or XI_TABLET will end up having the type_name reset to
either XI_TOUCHSCREEN or XI_MOUSE.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-11 08:19:04 +10:00
Peter Hutterer
71e9a69ed6 Revamp the whole "has_axes" definition.
Since we can now deal with multiple axes, etc. we might as well print it
properly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-29 18:27:13 +10:00
Peter Hutterer
220e2dfb8f Print read errors as X_NONE to avoid mallocs in the server.
Messages of type X_NONE are just passed down to the log files, everything else
gets the (EE) or (II) prefixed. Since this mallocs, we can't use it in the
signal handler.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-16 13:44:07 +10:00
Peter Hutterer
ddc1266374 Pre-allocate the reopen timer so we don't allocate during sigio handling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-16 13:44:05 +10:00
Peter Hutterer
98ecb5233b Trigger read error handling if len is <= 0.
Red Hat Bug 494245 <https://bugzilla.redhat.com/show_bug.cgi?id=494245>

Reported-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-04-06 10:25:03 +10:00
Peter Hutterer
92ca3dc2e7 Fix wrong reference to axis and button label atom list.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-26 13:40:40 +10:00
Peter Hutterer
3fa28c8acd Remove test/ directory.
This shouldn't really be part of the driver source, it's better to just have
it as a separate repository. Code has moved to
git://people.freedesktop.org/~whot/testdevices.git

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-26 10:20:56 +10:00
Peter Hutterer
d9809d7edd Fix jumpy touchpads by updating old_vals only when reported by the device.
Remember whether ABS_X or ABS_Y were reported before the SYN event and only
update the old_vals[0, 1] if we got data for them.
Touchpads that reported pressure data before x/y would otherwise update
old_x/y with bogus values, leading to jumps when the first x/y coordinates
were actually reported.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-17 14:15:00 +10:00
Peter Hutterer
b11439a176 If we have a touchpad, print so, don't claim we're configuring a tablet.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-17 13:27:03 +10:00
Jeremy Jay
740dc202f7 make sure to clear all axis_map entries
don't use uninitialized axis_map entries, ie axis_map[ABS_PRESSURE]

Signed-off-by: Jeremy Jay <dinkumator@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-17 13:27:03 +10:00
Peter Hutterer
7ac0c4456d Assume touchscreen/touchpad if we have _either_ ABS_PRESSURE or BTN_TOUCH
Touchpads have pressure or touch and also BTN_TOOL_FINGER.
Touchscreens have either pressure or touch, but no finger.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-17 10:08:33 +10:00
Peter Hutterer
b4f6ab126d Move keymap/modifier initialization behind the ABI < 5 ifdefs.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-16 10:36:13 +10:00
Jeremy Jay
a3ea979c2b Set "rel" when converting absolute touchpad coordinates to relative (#20661)
We unset "abs" and convert to relative, but never set "rel" so the events
don't get posted. This bit got broken in 43dd2a9592.

X.Org Bug 20661 <http://bugs.freedesktop.org/show_bug.cgi?id=20661>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-16 08:43:16 +10:00
Peter Hutterer
a7fb654a68 Restore repeat-filtering for server 1.5 and earlier.
Letting the server deal with key repeats is fine if we have server 1.6. For
earlier servers, we need to pass on the repeat events (except for modifier
keys).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Marty Jack <martyj19@comcast.net>
2009-03-10 16:04:49 +10:00
Peter Hutterer
3f06825a44 Bump to 2.2.99.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-09 10:01:35 +10:00
Peter Hutterer
31853c39bf Define MAX_VALUATORS if it's missing to allow for builds against 1.5.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-09 09:31:16 +10:00
Peter Hutterer
2c49e21a81 Check button label before fetching the Atom from the server. (#20524)
The server doesn't like NULL names, so don't call XIGetKnownProperty for
labels that don't exist.

X.Org Bug 20524 <http://bugs.freedesktop.org/show_bug.cgi?id=20524>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Peter Henriksson
2009-03-09 09:23:57 +10:00
Peter Hutterer
4361b3efa0 Fix duplicate wheel button up mapping.
Reported by Simon Thum.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Simon Thum <simon.thum@gmx.de>
2009-03-06 19:45:28 +10:00
Peter Hutterer
281a7b4b88 evdev 2.1.99.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-02 16:27:57 +10:00
Peter Hutterer
051cb8b528 Add support for button labelling.
Buttons 4/5 and 6/7 are hardcoded for wheel buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-03-02 16:16:59 +10:00
Peter Hutterer
1abcc88171 Rename prop_label to prop_axis_label. 2009-03-02 16:16:58 +10:00
Peter Hutterer
c89bbf80be Don't double-assign the UKNOWN axis label.
All labels default to unknown anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 14:36:07 +10:00
Peter Hutterer
178435832f If scrollwheels are found, bump the button number by 4 (or up to 7).
Scrollwheel data is always posted as buttons, so we need to advertise at least
enough buttons to accommodate for 6/7 (horizontal wheel).

Note that this may mean that if you have a device that has scroll wheels and
axes, but no buttons, it may be interpreted as a mouse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 14:35:46 +10:00
Peter Hutterer
c9cab83bac Ignore REL_WHEEL, REL_HWHEEL and REL_DIAL during axis initialisation.
We don't post the events for them anyway, so lets ignore them completely.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 09:11:14 +10:00
Peter Hutterer
43dd2a9592 Pass on all relative events, not just x/y.
9620fe776 added generic axes support for relativ values, but values from such
axes didn't get passed on to the server. Fix this.

Note that wheel events are not posted as motion events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 09:11:14 +10:00
Adam Jackson
7977947e0d Reduce the number of read calls in ReadInput.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2009-02-26 09:11:02 +10:00
Peter Hutterer
11a56d4a17 Split ReadInput into ReadInput and ProcessEvent.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-26 09:11:01 +10:00
Adam Jackson
7b0f613c7f Move relative motion and other magic up to EV_SYN processing.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2009-02-26 09:10:47 +10:00
Adam Jackson
75af278861 Open with O_NONBLOCK, and simplify EvdevReadInput to match.
xf86WaitForInput() would call select() with zero timeout to discover if
more input was ready.  But we know that's always true at least once,
since we're only ever called from the sigio handler (if silken is
active) or from the main loop (if it's not and we selected readable).
With nonblocking IO we can just spin around until we hit EAGAIN, which
gets us down to n+1 syscalls per event instead of 2n.
2009-02-23 16:01:14 -05:00
Peter Hutterer
4fd9cd2ea8 Revert "Remove useless include directive."
Necessary for builds against 1.6, but let's at least get rid of XKB defines.

This reverts commit aa5dfa1d6a.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-19 10:04:34 +10:00
Peter Hutterer
12c287df89 Label axes conditional on actual support.
Server 1.6 has device properties, but not axis labels.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-18 09:38:13 +10:00
Peter Hutterer
9f1b9aa6eb Accommodate for holes in the ABS label defines.
abs_labels[] has to be aligned with the defines in linux/input.h, but the
latter does not have continuous range. Pad the holes with
AXIS_LABEL_PROP_ABS_MISC.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-18 09:20:18 +10:00
Peter Hutterer
acb1d557e2 Add support for arbitrary relative axis labels.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-17 15:24:57 +10:00
Peter Hutterer
6a1f8f463d Remove superfluous (and duplicate) call to xf86MotionHistoryAllocate.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-17 14:55:11 +10:00
Peter Hutterer
9620fe7765 Add generic axis support for relative axes.
Just query the kernel what axes we actually have, rather than hard-coding x/y.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-17 14:54:17 +10:00
Peter Hutterer
a1714cac52 Add dynamic axis labelling for absolute devices.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-17 14:42:56 +10:00
Peter Hutterer
5a99ef7ed2 remove duplicate (code > 255) check. 2009-02-16 15:11:20 +10:00
Peter Hutterer
3b22e4703f man: list the options and properties in alphabetical order.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 14:48:45 +10:00
Peter Hutterer
0de20a8f1b man: Fix two minor typos in man page.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 14:48:40 +10:00
Peter Hutterer
978384ede7 Swap axes after scaling, not before.
If we swap before scaling, we scale with the wrong coordinate range.

Reported by Matt Helsley.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 14:08:12 +10:00
Peter Hutterer
df7ff12ed2 CacheCompare before probing the device.
Saves a few duplicate ioctls.

Suggested by Matt Helsley.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:19:55 +10:00
Matt Helsley
dd2c89ac93 General axis valuator support.
Instead of x/y and pressure, support any absolute axis that is reported on the
device. Note that there are still locations that special-case X and Y.

Minor modifications by Peter Hutterer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:19:53 +10:00
Peter Hutterer
4616c79f6c Change cached bitmasks from long to unsigned long.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:19:52 +10:00
Peter Hutterer
a31170718d Remove unused 'screen' variable from the EvdevRec.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:19:51 +10:00
Peter Hutterer
95099cb036 Log which EVIOCGABS ioctl failed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:19:49 +10:00
Peter Hutterer
c58bae0b77 Remove superfluous motion history allocation.
The motion history buffer is allocated during InitValuatorClassDeviceStruct
anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:19:48 +10:00
Peter Hutterer
32242871f7 Remove duplicate MB emu finalization.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:19:47 +10:00
Peter Hutterer
aa5dfa1d6a Remove useless include directive.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:19:45 +10:00
Bryce Harrington
2a6c1d7a60 Add descriptive messages for device-has-changed errs
As can be seen in e.g. bugs 19819 & 20025, it can be unclear what
exactly caused a given "Device has changed - disabled" error.  This
patch adds some more specific messages to give a better clue on what
exactly was seen to have changed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-13 13:16:55 +10:00
Dan Nicholson
0f0743e3cf Really fix distcheck
distcheck has an annoying feature where it checks that all files install
under $prefix. Unfortunately, this conflicts with the desire to install
headers to the SDK directory. Workaround by passing --with-sdkdir during
distcheck.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-03 19:56:45 +10:00
Paulo Cesar Pereira de Andrade
095766ebb3 Janitor: make distcheck, .gitignore.
Remove non toplevel .gitignore and .cvsignore files.
  The "make distcheck correction" for $(sdkdir) probably has a better
approach using a "*-hook:" target, or possibly making $sdkdir a
configure time option that could be set with DISTCHECK_CONFIGURE_FLAGS.
2009-02-02 19:52:32 -02:00
Julien Plissonneau Duquene
0dbb88c52b EvdevCacheCompare: ignore changes in current device position
Input devices (especially touchscreens) were disabled when switching
virtual console back to X because EvdevCacheCompare() thought the device
was substituted by another while away from X. Actually only the current
position reported by the device changed from what was in the cache. Fixed
by ignoring the current position in the comparison.

Fixes bug #19819.

Signed-off-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-03 07:21:27 +10:00
Peter Breitenlohner
c928156702 fix manpage formatting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-02 22:02:26 +10:00
Peter Hutterer
07f40a04df Protect against zero-sized property values. #19882
X.Org Bug 19882 <http://bugs.freedesktop.org/show_bug.cgi?id=19882>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-02 11:03:08 +10:00
Alan Coopersmith
e260993b6a Add README with pointers to mailing list, bugzilla & git repos 2009-01-30 20:18:50 -08:00
Dan Nicholson
dc72e6d8ae Stop hammering XKB defaults
With the new InitKeyboardDeviceStruct, we can just pass the RMLVO we
want without setting the defaults first.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-01-29 11:52:46 -08:00
Peter Hutterer
1906e4d5c1 Reshuffle property initialization.
We don't need axis calibration, etc. on keyboards, so let's do it
conditionally on actually having axes.

Reported by Simon Thum.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 14:06:38 +11:00
Peter Hutterer
3047c25db2 Deal with XINPUT ABI 5.
Some XKB stuff has been removed, so let's deal with it.
2009-01-22 14:06:38 +11:00
Peter Hutterer
c158cf2b64 Require XKB.
Welcome to the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 14:06:38 +11:00
Peter Hutterer
dae1a78a52 Add automatic axis labeling.
Since we don't support anything but REL/ABS x/y and sometimes pressure this is
bordering on pointlessness, but once the year of the Linux desktop comes
around this will be really handy. Or so.

Also, we don't allow changing axis labels, but should eventually rearrange
them if swapaxis is on.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 14:06:38 +11:00
Peter Hutterer
263bf04a9d Don't print xkb options twice to the log file.
xf86SetStrOption already prints with X_CONFIG anyway, no need to do it again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-22 14:05:30 +11:00
Peter Hutterer
c035f3d0f5 Register the property handler AFTER setting all the properties.
Otherwise, we add a new property based on a setting in pEvdev, which triggers
the update handler to change the setting in pEvdev based on the property.
Truly pointless.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-20 09:45:40 +11:00
Peter Hutterer
a7e8af65fc Test for pressure BEFORE using has_pressure. 2009-01-19 21:23:34 +11:00
Michael Chapman
0592d97fbb Disable middle mouse button emulation when a middle mouse button event is registered
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-13 10:52:24 +10:00
Matt Helsley
4dfd86b220 Fix FOO_MAX off-by-one
In linux/input.h each section's (e.g. ABS) FOO_MAX is the maximum FOO
value. Recent kernels define FOO_CNT as the maximum number of FOO there
will ever be. Hence using FOO_MAX to size the bit vectors representing
the capabilities of an evdev device is off by one.

Define FOO_CNT values for use with Linux kernels which lack them. Use
FOO_CNT whenever we need to know the number of bits needed -- usually to
calculate the number of longs needed.

When iterating over the values FOO_MAX still seems appropriate however
the loop test should include FOO_MAX rather than skip it.

Signed-off-by: Matt Helsley <matt.helsley@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-12 13:17:40 +10:00
Matt Helsley
d3fd42d864 rename NBITS to NLONGS to reflect its actual meaning
NBITS really convers the number of bits passed as its argument
into a number of longs. This is somewhat atypical of many
function-like-macro names. Rename it to NLONGS.

Signed-off-by: Matt Helsley <matt.helsley@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-12 13:14:42 +10:00
Matt Helsley
dd1752ce3f Add pressure valuator
If it's available report pressure as third valuator.
(Use xf86PostMotionEventP instead of the varargs wrapper.)

Signed-off-by: Matt Helsley <matt.helsley@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-12 11:22:46 +10:00
Alan Coopersmith
0f0a149067 Remove xorgconfig & xorgcfg from See Also list in man page 2009-01-09 16:13:09 -08:00
Yan Li
d170cba0cd Fix XkbModel parsing error
Signed-off-by: Yan Li <yan.i.li@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-01-06 08:41:24 +10:00
Peter Hutterer
2680382705 Add dummy test device - simple device that doesn't move at all.
Good for filling up the device list without getting distracted by spurious
events all the time.
2008-12-19 16:45:22 +10:00
Sascha Hlusiak
0f36384d06 Revert "Keyboard: Disable kernel autorepeat"
This reverts commit 6867652c2c.
Functionally replaced by commit ece72ce9e9

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2008-12-08 12:32:31 +01:00
Sascha Hlusiak
ece72ce9e9 Filter all repeated keys from kernel, because we do softrepeat in server
Discard all repeated events that come from the device. The server will handle
per-key autorepeat in software.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2008-12-08 12:27:34 +01:00
Peter Hutterer
2bf6e29b40 Finalize MB emu (and wakeup handlers) before closing the fd.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-03 16:36:59 +10:00
Tibi Nagy
2bd24649ec Support keyboards with scroll wheels.
For keyboards, scroll events are reported by the kernel as EV_REL class events
of REL_WHEEL type. If, during probing, the device is found to support wheel
events, make sure it is set up as a pointing device, even if it doesn't have
buttons or doesn't report motion along the X and Y axis so that the scroll
events can be mapped to mouse wheel buttons (usually buttons 4 and 5).

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-12-03 16:36:29 +10:00
Daniel Stone
6867652c2c Keyboard: Disable kernel autorepeat
We handle autorepeat in software due to per-key repeat and whatnot, so
disable the kernel's, which just interferes with ours.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-12-02 19:00:33 +11:00
Peter Hutterer
63af314368 Store device file's minor/major to avoid duplicate devices.
Devices added that use the same min/maj as an already added device are ignored
by the driver. This way users can have an xorg.conf entry on
/dev/input/by-id/blahblah and not get the same device added by HAL.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-17 10:05:09 +10:00
Fernando Carrijo
4c5c9c111d Fix error message 2008-11-06 13:20:16 -05:00
Peter Hutterer
4826969f23 Add support for axes swapping.
New option: SwapAxes (boolean)
New property: EVDEV_PROP_SWAP_AXES.

Actual swapping code written by Donnie Berkholz.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-11-03 13:32:41 +10:30
Peter Hutterer
33eb36f266 Add support for run-time calibration.
Some devices require run-time axis calibration. We can't change the min/max
ranges once we've initialised the valuator structs though, so in-driver
run-time calibration is required.

If the property is set, the driver scales from the calibrated range to the
values reported to the X server (which then may scale to screen coordinates).
If the property is not set (i.e. zero items) no scaling is performed.
2008-10-30 16:55:29 +10:30
Peter Hutterer
d5cf24d3f0 Add test/ directory for uinput-based test devices.
Three test devices provided:
btn0 .... Provides BTN_0, BTN_1, BTN_2 instead of BTN_LEFT, BTN_MIDDLE,
          BTN_RIGHT.
abs ..... Provdes x/y absolute axes, jumps between 100/100 and 120/120.
absrel .. Provides relative x/y axes and absolute x/y axes at the same time.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-10-30 16:51:55 +10:30
Peter Hutterer
64554e4799 Treat BTN_[0-2] as LMR buttons if necessary.
Treat BTN_[0-2] as LMR buttons on devices that do not advertise BTN_LEFT,
BTN_MIDDLE, BTN_RIGHT (e.g. 3Dconnexion SpaceNavigator).

Otherwise, treat BTN_[0+n] as button 5+n. Note: This causes duplicate
mappings for BTN_0 + n and  BTN_SIDE + n.

This also fixes a bug where we could end up with negative button numbers after
trying to map BTN_0.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-10-29 17:05:58 +10:30
Peter Hutterer
b77f939857 Remove obsolete FIXME
xkeyboard-config's maps are perfectly able to cope with evdev now.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-10-29 13:28:46 +10:30
Peter Hutterer
a43ab4999b Flush input after re-opening the fd.
Suggested by Julien Cristau.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-10-29 13:25:46 +10:30
Peter Hutterer
af096e8c5d emuMB: add EvdevMBEmuOn and call from EvdevOn to register wakeup handlers.
This got broken in b0737bdbd1, when the
EmuMBPreInit call was removed from EvdevOn. As a result, VT switching away and
back wouldn't restore the wakeup handlers and mouse button presses
disappeared.
2008-10-28 09:09:14 +10:30
Peter Hutterer
12498042fc Fix axis inversion for absolute coordinates.
If min_x/y was not equal to 0, the inverted calculated range was off and leads
to inaccessible or out-of-range areas.
2008-10-24 13:09:46 +10:30
Peter Hutterer
0f8fcfccb3 emulate MB: fix confusing log message.
If we're forcing MB emulation behaviour as per config, then at least state
whether we're forcing it off or on.

Found by Michel Dänzer.
2008-10-24 09:21:36 +10:30
Peter Hutterer
0ab4c09e50 Silence compiler warning by memsetting the struct properly. 2008-10-23 14:05:41 +10:30
Peter Hutterer
d348eb8ce7 MB emulation timeout is stored as Time, make the property 32-bit too. 2008-10-23 13:22:17 +10:30
Peter Hutterer
2c1698fa61 Init ioctl bitmasks to 0, shuts up valgrind too. 2008-10-22 18:08:31 +10:30
Søren Hauberg
8c39302594 Add touchscreen support.
Touchscreens are devices that do not have buttons and only advertise
BTN_TOUCH. Add a new flag to note the device type.

If BTN_TOUCH is detected, change it to BTN_LEFT and process it normally.
2008-10-22 08:49:11 +10:30
Julien Cristau
f57e8face9 Fix TestBit() on 64bit
Reported by Albert Damen <albrt@gmx.net>
X.Org Bug#18150 <http://bugs.freedesktop.org/show_bug.cgi?id=18150>
2008-10-21 19:21:21 +02:00
Peter Hutterer
4912e2aa7f Add option "GrabDevice", don't grab the device by default.
We now have the matching code in the server to set the console to RAW mode and
don't need to grab the devices anymore.

This is an updated version of e8534d47c8, which
was reverted in 6dc4199155.
2008-10-17 11:18:39 +10:30
Peter Hutterer
7243116f55 Don't post keycodes > 255.
If we only have keys > 255 we don't set up a key class rec, so don't post
them. It makes the server unhappy.

Signed-off-by: Julien Cristau <jcristau@debian.org>
2008-10-16 15:47:31 +02:00
Peter Hutterer
0089d931ac Fix "Device reopened after N attempts" message. 2008-10-14 17:07:09 +10:30
Peter Hutterer
0f5a5ac09e Don't init draglock, etc. if we don't have the required capabilities. 2008-10-14 16:45:44 +10:30
Peter Hutterer
36d68b006d 8-bit properties should use 8-bit storage types... 2008-10-14 16:41:54 +10:30
Peter Hutterer
bb1f421687 Don't include the client-side header anymore. xkbstr.h is server SDK. 2008-10-14 16:25:27 +10:30
Peter Hutterer
0405f7b17f Tidy up evdev.h
This includes shuffling some functions around so we don't need the prototypes
in evdev.h.
2008-10-14 16:22:00 +10:30
Peter Hutterer
088e0a175a Rename DragLockInit to DragLockPreInit, remove superfluous "return". 2008-10-14 16:14:13 +10:30
Peter Hutterer
cefedeb205 Register property handler from within the modules, not the main evdev file. 2008-10-14 16:13:56 +10:30
Peter Hutterer
b0737bdbd1 Clean up program flow - don't call PreInit for "modules" on DEVICE_INIT.
Call the PreInit functions for MB Emulation, wheel emu, and draglock during
PreInit, not on DEVICE_INIT. This way, we only parse the options once and
don't overwrite with defaults when coming back from a VT switch.
2008-10-14 16:09:20 +10:30
Peter Hutterer
5f2c8a2dcd Janitor: clean up xf86Msg use, might as well use X_CONFIG directly. 2008-10-14 16:01:17 +10:30
Peter Hutterer
ff783fce65 Add property support for ReopenAttempts option. 2008-10-14 15:30:20 +10:30
Peter Hutterer
c638aa4a88 Document properties in man page. 2008-10-14 15:17:03 +10:30
Peter Hutterer
b46677e346 Document InvertX/Y options. 2008-10-14 15:17:03 +10:30
Peter Hutterer
680b41dc76 Bump to 2.1.99. 2008-10-13 17:08:22 +10:30
Peter Hutterer
9065d0ccb2 Remove "Path" option.
Path was just an alias for Device anyway, so we might as well not parse it.
By now you should be using HAL anyway which fills in Device for you.
2008-10-11 12:24:54 +10:30
Peter Hutterer
a9fcce1833 Remove parsing of ScreenNumber option.
Was unused anyway, so we might as well not parse it.
2008-10-11 12:24:54 +10:30
Peter Hutterer
ab934d840d Janitor: purge unused headers, reshuffle for readability, fix whitespace errors. 2008-10-11 12:24:54 +10:30
Peter Hutterer
6f6ac98295 Add checkonly handling to property handlers.
If checkonly is TRUE, we can only check if applying the value would succeed.
The value is actually applied if checkonly is FALSE.
2008-10-11 12:24:54 +10:30
Peter Hutterer
a2633c8078 Fix up bad return code in draglock property handler. 2008-10-11 12:24:54 +10:30
Peter Hutterer
e6c699dedc Stricter value checking for property changes. 2008-10-11 12:24:54 +10:30
Julien Cristau
847eac8262 Set pInfo->fd to -1 on DEVICE_CLOSE
This allows the reopen logic to kick in later.
DEVICE_CLOSE gets called on regen, so without this we'd keep a stale
file descriptor in pInfo->fd in subsequent sessions.

Debian bug#496101 (http://bugs.debian.org/496101)
2008-10-11 02:16:25 +02:00
Peter Hutterer
a196672a6b Add property support for axis inversion. 2008-10-03 14:42:02 +09:30
Søren Hauberg
3985d42320 Add support for axis inversion. 2008-10-03 14:41:58 +09:30
Peter Hutterer
e138e4b79a Install xorg-evdev.pc for clients who need evdev-properties.h 2008-10-03 14:39:25 +09:30
Peter Hutterer
125e2b8ce2 Close fd on DEVICE_OFF. (LP #276887)
Leaving the fd open means we still get keyboard events after VT switching
away. Coming back, some of these events are replayed on the application that
has the current focus.

Reproduceable:
1. open terminal, focus.
2. VT switch away
3. type something, preferably a password
4. VT switch back, trigger a mouse event
5. Observe the X server guessing your password.

Closing the fd on DEVICE_OFF fixes this. Reopen is handled by the reopen
code introduced with

    commit 9930477cbe
    Author: Peter Hutterer <peter.hutterer@redhat.com>
    Date:   Tue Aug 26 14:33:40 2008 +0930

        Attempt to re-open devices on read errors.

Launchpad Bug 276887
<https://bugs.edge.launchpad.net/ubuntu/+source/xorg-server/+bug/276887>
2008-10-02 12:09:13 +09:30
Peter Hutterer
91bc0a0ba3 Remove useless initialization of rc. 2008-10-02 12:09:12 +09:30
Peter Hutterer
4c55186aed Change DragLock atom name - prepend with Evdev. 2008-10-02 12:09:10 +09:30
Peter Hutterer
62069b97d2 Move misplaced #endif 2008-09-30 12:24:07 +09:30
Peter Hutterer
2718a5c56b Register property handlers directly, instead of abstracting them.
This removes a left-over from the early device property code where we could
only have a single handler. Now it's easier to just register the handlers for
each subsystem (emulate wheel, draglock and MB emulation).
2008-09-30 12:24:07 +09:30
Peter Hutterer
90d1d494f8 Cleanup: "valid_vals" should be "vals" now. 2008-09-30 12:24:07 +09:30
Peter Hutterer
a77c2622cc Add evdev-properties.h file with #defines for all property names. 2008-09-30 12:24:03 +09:30
Peter Hutterer
84a0e39c0d Use new property API (no ConfigureDP, less args to ChangeDP)
Return appropriate status codes from property handlers.
Make properties non-deletable.
2008-09-26 13:23:35 +09:30
Peter Hutterer
7386937221 draglock: Shut up compiler warning. 2008-09-26 12:56:36 +09:30
Peter Hutterer
fcf8375f2b Don't require randrproto. 2008-09-26 12:56:33 +09:30
Peter Hutterer
9930477cbe Attempt to re-open devices on read errors.
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. To be safe, we cache the information from the device
and compare against it when we re-open. This way we ensure that if the
topology changes under us, we don't open a completely different device. If a
device has changed, we disable it.

Adds option "ReopenAttempts" <int>
2008-09-04 18:33:39 +09:30
Peter Hutterer
4509ec1daf Use HAVE_PROPERTIES define instead of GET_ABI_MAJOR for property compilation. 2008-09-04 18:22:56 +09:30
Peter Hutterer
a205dfc091 Shut up "unused variable" compiler warnings.
Hide properties behind ifdefs, fake use of "val".
2008-09-04 18:14:48 +09:30
Peter Hutterer
184206e717 Wheel emulation: initial values must be char.
parsing int* to char* in XIChangeDeviceProperty means we lose values.
2008-08-25 17:24:15 +09:30
Peter Hutterer
79ff677c52 Init all emulateWheel values, even if EmulateWheel is disabled.
Even if we don't want EmulateWheel, we can at least init everything to usable
values. This way we only need to toggle "enabled", rather than initialising
the whole lot before usage.
2008-08-22 09:04:33 +09:30
Dan Nicholson
37e3addf89 Add wheel timeout property support
Copied from the wheel inertia property support.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-08-22 09:04:16 +09:30
Dan Nicholson
e237de0dea Add timeout support for mouse wheel emulation
Support the EmulateWheelTimeout option as the mouse driver does.

Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-08-22 08:41:14 +09:30
Peter Hutterer
92c6611b6f Add property support for drag lock. 2008-08-18 13:44:02 +09:30
Chris Salch
bd405ddc83 Adding in DragLockButtons functionality.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-08-18 12:03:07 +09:30
Daniel Stone
36d702006d Force rules, not model, to be evdev
xkeyboard-config recently changed to a separate ruleset for the evdev
driver, so match that by only forcing the ruleset, not the model, to be
evdev.
2008-08-16 15:34:03 +03:00
Peter Hutterer
6dc4199155 Revert "Don't grab devices unless specified through the config options."
Not such a good idea, CTRL+C terminates the server and other issues. Reverting
for now until a better solution is found, at least this way the driver is
usable.

See also: http://lists.freedesktop.org/archives/xorg/2008-August/038032.html

This reverts commit e8534d47c8.
2008-08-15 11:54:53 +09:30
Peter Hutterer
e8534d47c8 Don't grab devices unless specified through the config options.
Grabbing event devices stops in-kernel event forwarding, most notably rfkill
and the "Macintosh mouse button emulation" device. Let's not do that.

Option "GrabDevice" forces grabbing the device.
2008-08-14 13:44:11 +09:30
Chris Salch
555f5a7cbf Filter wheel events before middle mouse button emulation.
The Emulate3Button needs to be the last filter function, otherwise the timeout
code causes it to hijack button presses for the first 3 buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-08-08 16:04:26 +09:30
Peter Hutterer
134829d911 Simplify the property handler registration.
Instead of having separate handlers for each property, just handle all of them
in one handler for emuMB, and one handler for emuWheel.
2008-08-08 16:04:23 +09:30
Peter Hutterer
4e121b297e Add EVDEV_MAXBUTTONS instead of checking against 32.
Numbers are so lame, defines are all the rage now I've heard.
2008-08-08 15:51:09 +09:30
Peter Hutterer
9793de8137 Expose wheel emulation through device properties.
Don't enable wheel emulation with 0 inertia - bad things happen.
2008-08-08 15:50:55 +09:30
Chris Salch
a9d72b40fb Adding mouse wheel emulation code.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-08-07 16:04:31 +09:30
Adam Jackson
c1f7f8c3d2 Print a warning if a keycode exceeds the range accepted by the server.
Keycodes over 255 are silently ignored in the server. The least we can do is
put a warning in the logs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-08-07 09:36:02 +09:30
Chris Salch
40e1474d84 Adding a function to map button events to button numbers.
Remove code duplication, let the mapping function hand us the actual button
event to be passed up to the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-08-06 16:36:51 +09:30
Julien Cristau
d9097df01b Actually close the fd on DEVICE_CLOSE (bug#16948)
Fixes file descriptor leak.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-08-04 09:17:37 +09:30
Julien Cristau
5c074af5a9 Print the device name when we get a read error 2008-07-30 10:42:05 +02:00
Michel Dänzer
72551662a0 xf86-input-evdev: Fix EVIOCGBIT ioctl usage on big endian platforms.
With this fix, on my PowerBook HAL hotplugging correctly detects my USB mouse,
and no longer thinks keyboards have random numbers of mouse buttons. :)

The LONG_BITS and NBITS macro definitions are stolen from xf86-input-synaptics.

Signed-off-by: Michel Dänzer <michel@tungstengraphics.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2008-07-30 11:26:23 +09:30
Peter Hutterer
53e7525744 Add support for ButtonMapping option. 2008-07-22 11:49:33 +09:30
Peter Hutterer
5d13259a5d Guard property changes against ABI_XINPUT < 3. 2008-07-21 13:10:11 +09:30
Julien Cristau
2b7edaa4ab Fill up the version info
Report correct versions instead of
"compiled for 0.0.0, module version = 1.0.0"
2008-07-20 11:33:37 +02:00
Peter Hutterer
bf0d81011e Don't enable the device if the grab failed with ENODEV.
After suspend/resume, sometimes the device doesn't come back up on the same
node. Since we do not call PreInit for the device (which would detect this
situation), we continue to try to read a nonexisting file, spamming the log
file with "Read Error".
2008-07-14 13:10:34 +09:30
Peter Hutterer
ef4bb69c1a Add .gitignore file. 2008-07-10 19:32:22 +09:30
Peter Hutterer
d1818ef206 Add support for device properties, currently MB emulation and timeout. 2008-07-10 17:08:49 +09:30
Peter Hutterer
a9223edcd8 Clean out configure.ac
We're not building with or without XInput. Same with xkb.
2008-07-10 16:55:21 +09:30
Peter Hutterer
ec23c6b2f5 Remove static ChangeLog, autogenerate as part of make dist.
Hook taken from xserver's Makefile.am
2008-07-03 15:01:32 +09:30
Peter Hutterer
18d70d796f Update COPYING with the correct copyright info.
Fix up licence of emuMB.c, was using Red Hat instead of "The authors", but
this code wasn't contributed by RH anyway.
2008-07-03 14:59:27 +09:30
Peter Hutterer
37b854cb64 Remove stale comments.
Ctrl+Alt+Backspace works, I'm using it daily.
CapsLock doesn't repeat, otherwise we wouldn't have Bug 16318.
2008-07-03 14:45:41 +09:30
Peter Hutterer
8c06093191 Remove EvdevConvert, nobody calls it now anyway.
Conversion is now done in the DIX.
2008-07-03 14:44:52 +09:30
Ander Conselvan de Oliveira
0830676a0c Mice with a lot of buttons (e.g. Logitech MX1000) generate button events greater than BTN_TASK.
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-06-28 17:54:33 +09:30
Peter Hutterer
1cf7b8f7ee Count buttons at probe and print to log.
We don't really do anything with the number other than print it since I'm sure
that half the mice don't report the correct number anyway (especially with the
wheel button mapping). But having a bit more debug info is good.
2008-06-28 17:53:24 +09:30
Peter Hutterer
826e6e7dd4 Bump to 2.0.99. 2008-06-22 17:52:40 +09:30
Peter Hutterer
5a0ea39b79 No need to finalize MB emulation after EvdevProbe anymore.
Follow-up to 76800bfa75.
2008-06-22 10:56:44 +09:30
Simon Munton
373e13ae35 Close file descriptor if EvdevProbe fails.
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
2008-06-22 10:56:00 +09:30
Keith Packard
76800bfa75 Enable middle button emulation at DEVICE_ON instead of DEVICE_INIT.
This ensures that the middle button emulation is re-enabled after VT switch,
otherwise the block handler that deals with the timeouts would not get
re-registered.

Signed-off-by: Keith Packard <keithp@keithp.com>
2008-06-21 18:14:35 -07:00
31 changed files with 5858 additions and 1155 deletions

View File

@@ -1,19 +0,0 @@
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

View File

@@ -0,0 +1,65 @@
name: 🐞 Bug report
description: Create a report to help us improve
labels: [bug, needs-triage]
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to help everyone identify and fix the bug. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: dropdown
id: affected-version
attributes:
label: Select the version
options:
- 2.11.0.1
- Git master branch
- other or don't know
default: 1
validations:
required: true
- type: textarea
id: description
attributes:
label: Describe your issue
placeholder: When I did X then Y happened.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: |
1. Start ...
2. Do this
3. Do that
validations:
required: true
- type: textarea
id: expected
attributes:
label: What did you expect?
placeholder: I expected this to happen.
- type: textarea
id: environment
attributes:
label: Additional Information
description: |
Additional information you want to provide such as logs, system info, environment, screenshots, etc.
placeholder: |
Add any other context about the bug here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for reporting this issue! We will get back to you as soon as possible.

View File

@@ -0,0 +1,49 @@
name: ✨ Feature request
description: Suggest a feature for this software
labels: [enhancement, needs-triage]
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to properly describe the new software feature you are suggesting. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: textarea
id: description
attributes:
label: "Describe the feature"
placeholder: A thing in X that allows to do Y.
validations:
required: true
- type: textarea
id: rationale
attributes:
label: "It should be done because"
placeholder: Doing Y is needed for Z.
validations:
required: true
- type: textarea
id: alternative
attributes:
label: "What are the alternatives?"
placeholder: We could do A or B instead.
- type: textarea
id: context
attributes:
label: Additional context
description: Additional information you want to provide such as references to related issues or protocols, the implications on existing use cases, etc.
placeholder: |
Add any other context about the feature request here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for your suggestion! Let's see together if it can be done.

View File

@@ -0,0 +1,49 @@
name: 🔧 Code cleanup
description: Level up the source code
labels: [code-cleanup, needs-triage]
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to properly describe the code cleanup you are suggesting. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: textarea
id: description
attributes:
label: "Describe the cleanup"
placeholder: C in X needs to be changed into D.
validations:
required: true
- type: textarea
id: rationale
attributes:
label: "It should be done because"
placeholder: Having D is needed for E.
validations:
required: true
- type: textarea
id: alternative
attributes:
label: "What are the alternatives?"
placeholder: We could do A or B instead.
- type: textarea
id: context
attributes:
label: Additional context
description: Additional information you want to provide such as implications on existing code, how to ensure API/ABI stability, which tests are needed or to be run, related issues, etc.
placeholder: |
Add any other context about the cleanup here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for looking at the source code! Let's see together how it can be improved.

View File

@@ -0,0 +1,38 @@
name: 🔖 Documentation update
description: Make your mark for better documentation
labels: [documentation, needs-triage]
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to help others understand our software. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: textarea
id: description
attributes:
label: Describe the update
placeholder: These things need to be better documented.
validations:
required: true
- type: textarea
id: environment
attributes:
label: Additional Information
description: Additional information you want to provide such as tickets related to changes in the software, affected files, screenshots, etc.
placeholder: |
Add any other context about the update here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for requesting this update! We will get back to you as soon as possible.

43
.github/ISSUE_TEMPLATE/05-org-task.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: ✅ Organizational task
description: Create a task for project organization
labels: [needs-triage, organization]
body:
- type: markdown
attributes:
value: |
Please fill out the sections below to get organizational things done. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
- type: textarea
id: description
attributes:
label: Describe the task
placeholder: These things need to be done.
validations:
required: true
- type: textarea
id: rationale
attributes:
label: "It should be done because"
placeholder: Doing Y is needed for Z.
- type: textarea
id: environment
attributes:
label: Additional Information
description: Additional information you want to provide such as the context for bigger tasks, the implicatons on existing workflows, related issues, etc.
placeholder: |
Add any other context about the task here.
- type: checkboxes
id: checks
attributes:
label: Extra fields
options:
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
required: true
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
required: true
- label: I'd like to work on this issue
- type: markdown
attributes:
value: |
Thanks for adding this task! We will get back to you as soon as possible.

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: XLibre Community Support
url: https://github.com/orgs/X11Libre/discussions
about: Please ask and answer questions here.
- name: Mailing List
url: https://www.freelists.org/list/xlibre
about: You can join the discussions on our mailing list.

50
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
permissions:
contents: write
on:
push:
pull_request:
jobs:
ubuntu:
strategy:
matrix:
xserver-version: [ master, xlibre-xserver-25.1.0, xlibre-xserver-25.0.0.18 ]
runs-on: ubuntu-latest
steps:
- uses: X11Libre/action-build-driver/target/ubuntu@v0.3.7
with:
xserver-version: ${{ matrix.xserver-version }}
freebsd:
strategy:
matrix:
xserver-version: [ master, xlibre-xserver-25.1.0, xlibre-xserver-25.0.0.18 ]
runs-on: ubuntu-latest
steps:
- uses: X11Libre/action-build-driver/target/freebsd@v0.3.7
with:
xserver-version: ${{ matrix.xserver-version }}
dragonfly:
strategy:
matrix:
# xlibre-xserver-25.0.x not compiling on dragonfly yet
xserver-version: [ master, xlibre-xserver-25.1.0 ]
runs-on: ubuntu-latest
steps:
- uses: X11Libre/action-build-driver/target/dragonfly@v0.3.7
with:
xserver-version: ${{ matrix.xserver-version }}
# Not supported on NetBSD
release-notes:
name: Release pushed tag
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/xlibre-') }}
needs: [ ubuntu, freebsd, dragonfly ]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: X11Libre/action-build-driver/release@v0.3.7

80
.gitignore vendored Normal file
View File

@@ -0,0 +1,80 @@
#
# 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/
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
lt~obsolete.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
Makefile
Makefile.in
mdate-sh
missing
mkinstalldirs
*.pc
py-compile
stamp-h?
symlink-tree
texinfo.tex
ylwrap
# Do not edit the following section
# Edit Compile Debug Document Distribute
*~
*.[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'
#
man/evdev.4
man/evdev.man

40
10-evdev.conf Normal file
View File

@@ -0,0 +1,40 @@
#
# Catch-all evdev loader for udev-based systems
# We don't simply match on any device since that also adds accelerometers
# and other devices that we don't really want to use. The list below
# matches everything but joysticks.
Section "InputClass"
Identifier "evdev pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev tablet catchall"
MatchIsTablet "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "evdev touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection

73
COPYING
View File

@@ -1,12 +1,69 @@
This is a stub file. This package has not yet had its complete licensing Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
information compiled. Please see the individual source files for details on Copyright 1993 by David Dawes <dawes@xfree86.org>
your rights to use and modify this software. 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.
Please submit updated COPYING files to the Xorg bugzilla: Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without
fee, provided that the above copyright notice appear in all copies
and that both that copyright notice and this permission notice
appear in supporting documentation, and that the name of the authors
not be used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission. The authors make no
representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied
warranty.
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg 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.
All licensing questions regarding this software should be directed at the Copyright 2005 Sun Microsystems, Inc. All rights reserved.
Xorg mailing list:
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.
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
ADAM JACKSON 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.
http://lists.freedesktop.org/mailman/listinfo/xorg

View File

@@ -1,47 +0,0 @@
2006-01-09 David Nusinow,,, <set EMAIL_ADDRESS environment variable>
* man/Makefile.am:
* man/evdev.man:
Bugzilla #968 <https://bugs.freedesktop.org/show_bug.cgi?id=968>
Patch #4301 <https://bugs.freedesktop.org/attachment.cgi?id=4301>
Add evdev manpage
2005-12-20 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update package version for X11R7 release.
2005-12-14 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update package version number for final X11R7 release candidate.
2005-12-06 Kevin E. Martin <kem-at-freedesktop-dot-org>
* man/Makefile.am:
Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
2005-12-03 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update package version number for X11R7 RC3 release.
2005-12-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Remove extraneous AC_MSG_RESULT.
2005-11-29 Adam Jackson <ajax@freedesktop.org>
* configure.ac:
Only build dlloader modules by default.
2005-11-09 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update package version number for X11R7 RC2 release.
2005-11-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
* configure.ac:
Update pkgcheck dependencies to work with separate build roots.

View File

@@ -18,5 +18,24 @@
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # 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. # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AUTOMAKE_OPTIONS = foreign
# During distcheck, system locations (as provided by pkg-config) may
# not be writable; provide instead relative locations.
DISTCHECK_CONFIGURE_FLAGS = --with-xorg-module-dir='$${libdir}/xorg/modules'
SUBDIRS = src man SUBDIRS = src man
MAINTAINERCLEANFILES = ChangeLog INSTALL
dist_xorgconf_DATA = 10-evdev.conf
.PHONY: ChangeLog INSTALL
INSTALL:
$(INSTALL_CMD)
ChangeLog:
$(CHANGELOG_CMD)
dist-hook: ChangeLog INSTALL
EXTRA_DIST = README.md

8
README.md Normal file
View File

@@ -0,0 +1,8 @@
xf86-input-evdev - Generic Linux input driver for the XLibre X server
---------------------------------------------------------------------
The primary development code repository can be found at:
https://github.com/X11Libre/xf86-input-evdev
Please submit bug reports and requests to merge patches there.

View File

@@ -1,12 +1,17 @@
#! /bin/sh #! /bin/sh
srcdir=`dirname $0` srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=. test -z "$srcdir" && srcdir=.
ORIGDIR=`pwd` ORIGDIR=`pwd`
cd $srcdir cd "$srcdir"
autoreconf -v --install || exit 1 autoreconf -v --install || exit 1
cd $ORIGDIR || exit $? cd "$ORIGDIR" || exit $?
$srcdir/configure --enable-maintainer-mode "$@" git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
git config --local format.subjectPrefix "PATCH xf86-input-evdev"
if test -z "$NOCONFIGURE"; then
exec "$srcdir"/configure "$@"
fi

View File

@@ -20,73 +20,46 @@
# #
# Process this file with autoconf to produce a configure script # Process this file with autoconf to produce a configure script
AC_PREREQ(2.57) # Initialize Autoconf
AC_INIT([xf86-input-evdev], AC_PREREQ([2.60])
2.0.0, AC_INIT([xlibre-xf86-input-evdev],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [25.0.0],
xf86-input-evdev) [https://github.com/X11Libre/xf86-input-evdev/issues],
[xlibre-xf86-input-evdev])
AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR(.) AC_CONFIG_AUX_DIR(.)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE # Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-xz])
DRIVER_NAME=evdev # Initialize libtool
AC_SUBST([DRIVER_NAME])
AM_CONFIG_HEADER([config.h])
# Checks for programs.
AC_DISABLE_STATIC AC_DISABLE_STATIC
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AC_PROG_CC
AH_TOP([#include "xorg-server.h"]) # 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
#AC_DEFINE(XFree86LOADER,1,[Stub define for loadable drivers]) # Obtain compiler/linker options from server and required extensions
# PKG_CHECK_MODULES(XORG, [xorg-server >= 25.0.0] xproto [inputproto >= 2.1.99.3])
#AC_ARG_ENABLE(XINPUT, AS_HELP_STRING([--enable-xinput], PKG_CHECK_MODULES(UDEV, libudev,
# [Build XInput support (default: yes)]), [HAVE_UDEV=yes], [HAVE_UDEV=no])
# [XINPUT=$enableval],[XINPUT=yes]) AS_IF([test "$HAVE_UDEV" = "yes"],
#AM_CONDITIONAL(XINPUT, test "x$XINPUT" = "xyes") [AC_DEFINE([HAVE_LIBUDEV], [1], [Define if libudev is available])])
#if test "x$XINPUT" = "xyes" ; then
# AC_DEFINE(XINPUT,1,[Enable XInput support])
#fi
#
#AC_ARG_ENABLE(XKB, AS_HELP_STRING([--enable-xkb],
# [Build XKB support (default: yes)]),
# [XKB=$enableval],[XKB=yes])
#AM_CONDITIONAL(XKB, test "x$XKB" = "xyes")
#if test "x$XKB" = "xyes" ; then
# AC_DEFINE(XKB,1,[Enable XKB support])
#fi
AC_ARG_WITH(xorg-module-dir, PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
AC_HELP_STRING([--with-xorg-module-dir=DIR], PKG_CHECK_MODULES(MTDEV, mtdev)
[Default xorg module directory [[default=$libdir/xorg/modules]]]),
[moduledir="$withval"],
[moduledir="$libdir/xorg/modules"])
inputdir=${moduledir}/input
AC_SUBST(inputdir)
# Checks for extensions # Define a configure option for an alternate input module directory
XORG_DRIVER_CHECK_EXT(RANDR, randrproto) PKG_PROG_PKG_CONFIG([0.25])
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto) xlibre_input_drivers_dir=`$PKG_CONFIG --variable=input_drivers_dir xlibre-server`
AC_SUBST(xlibre_input_drivers_dir)
# Checks for pkg-config packages xorgconfdir=`$PKG_CONFIG --variable=sysconfigdir xorg-server`
PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES) AC_SUBST(xorgconfdir)
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src' AC_CONFIG_FILES([Makefile src/Makefile man/Makefile man/evdev.man])
AC_SUBST([CFLAGS]) AC_OUTPUT
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
XORG_MANPAGE_SECTIONS
XORG_RELEASE_VERSION
AC_OUTPUT([Makefile src/Makefile man/Makefile])

View File

@@ -0,0 +1,92 @@
/*
* 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_PROPERTIES_H_
#define _EVDEV_PROPERTIES_H_
/* Middle mouse button emulation */
/* BOOL */
#define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
/* CARD32 */
#define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
/* CARD8 */
#define EVDEV_PROP_MIDBUTTON_BUTTON "Evdev Middle Button Button"
/* Wheel emulation */
/* BOOL */
#define EVDEV_PROP_WHEEL "Evdev Wheel Emulation"
/* CARD8, 4 values [x up, x down, y up, y down], 0 to disable a value*/
#define EVDEV_PROP_WHEEL_AXES "Evdev Wheel Emulation Axes"
/* CARD16 */
#define EVDEV_PROP_WHEEL_INERTIA "Evdev Wheel Emulation Inertia"
/* CARD16 */
#define EVDEV_PROP_WHEEL_TIMEOUT "Evdev Wheel Emulation Timeout"
/* CARD8, value range 0-32, 0 to always scroll */
#define EVDEV_PROP_WHEEL_BUTTON "Evdev Wheel Emulation Button"
/* Drag lock */
/* CARD8, either 1 value or pairs, value range 0-32, 0 to disable a value*/
#define EVDEV_PROP_DRAGLOCK "Evdev Drag Lock Buttons"
/* Axis inversion */
/* BOOL, 2 values [x, y], 1 inverts axis */
#define EVDEV_PROP_INVERT_AXES "Evdev Axis Inversion"
/* Run-time calibration */
/* CARD32, 4 values [minx, maxx, miny, maxy], or no values for unset */
#define EVDEV_PROP_CALIBRATION "Evdev Axis Calibration"
/* Swap x and y axis. */
/* BOOL */
#define EVDEV_PROP_SWAP_AXES "Evdev Axes Swap"
/* BOOL */
#define EVDEV_PROP_THIRDBUTTON "Evdev Third Button Emulation"
/* CARD32 */
#define EVDEV_PROP_THIRDBUTTON_TIMEOUT "Evdev Third Button Emulation Timeout"
/* CARD8 */
#define EVDEV_PROP_THIRDBUTTON_BUTTON "Evdev Third Button Emulation Button"
/* CARD32 */
#define EVDEV_PROP_THIRDBUTTON_THRESHOLD "Evdev Third Button Emulation Threshold"
/* CARD8, 1 value,
This property is initialized on devices that have multimedia keys on the
function keys. The value of the property selects the default behaviour
for the function keys. The behaviour of the fn key (if any exists) is
hardware specific. On some hardware, fn may toggle the other set of
functions available on the keys.
0 send functions keys by default, fn may toggle to multimedia keys
1 send multimedia keys by default, fn may toggle to function keys
*/
#define EVDEV_PROP_FUNCTION_KEYS "Evdev Function Keys"
/* Smooth scroll */
/* INT32, 3 values (vertical, horizontal, dial) */
#define EVDEV_PROP_SCROLL_DISTANCE "Evdev Scrolling Distance"
#endif

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,59 +1,7 @@
# $Id$
#
# 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.
#
drivermandir = $(DRIVER_MAN_DIR) drivermandir = $(DRIVER_MAN_DIR)
driverman_DATA = evdev.$(DRIVER_MAN_SUFFIX)
driverman_PRE = @DRIVER_NAME@.man
driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
EXTRA_DIST = @DRIVER_NAME@.man
CLEANFILES = $(driverman_DATA) 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
.man.$(DRIVER_MAN_SUFFIX): .man.$(DRIVER_MAN_SUFFIX):
sed $(MAN_SUBSTS) < $< > $@ cp $< $@

View File

@@ -1,74 +0,0 @@
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH EVDEV __drivermansuffix__ __vendorversion__
.SH NAME
evdev \- Generic Linux input driver
.SH SYNOPSIS
.nf
.B "Section \*qInputDevice\*q"
.BI " Identifier \*q" devname \*q
.B " Driver \*qevdev\*q"
.BI " Option \*qDevice\*q \*q" devpath \*q
.BI " Option \*qPath\*q \*q" path \*q
.BI " Option \*qEmulate3Buttons\*q \*q" True \*q
.BI " Option \*qEmulate3Timeout\*q \*q" 50 \*q
\ \ ...
.B EndSection
.fi
.SH DESCRIPTION
.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.
.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.
.PP
.SH SUPPORTED HARDWARE
In general, any input device that the kernel has a driver for can be accessed
through the
.B evdev
driver. See the Linux kernel documentation for a complete list.
.PP
.SH CONFIGURATION DETAILS
Please refer to __xconfigfile__(__filemansuffix__) for general configuration
details and for options that can be used with all input drivers. This
section only covers configuration details specific to this driver.
.PP
The following driver
.B Options
are supported:
.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. This option is
mandatory unless \*qPath\*q is given, and there is no default setting.
.TP 7
.BI "Option \*qPath\*q \*q" string \*q
Specifies the device through which the device can be accessed. This will
generally be of the form \*q/dev/input/by-path/xyz\*q, where xyz includes the
name of the device. The mapping from device node to hardware is
system-dependent. This option has precedence over the \*qDevice\*q option but
one of \*qPath\*q or \*qDevice\*q must be given.
.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.
.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.
.SH AUTHORS
Kristian Høgsberg.
.SH "SEE ALSO"
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
README.mouse.

369
man/evdev.man.in Normal file
View File

@@ -0,0 +1,369 @@
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH EVDEV @DRIVER_MAN_SUFFIX@ 2016-11-17 "@PACKAGE_STRING@" "X Version 11"
.SH NAME
evdev \- Generic Linux input driver for XLibre
.SH SYNOPSIS
.nf
.B "Section \*qInputDevice\*q"
.BI " Identifier \*q" devname \*q
.B " Driver \*qevdev\*q"
.BI " Option \*qDevice\*q \*q" devpath \*q
.BI " Option \*qEmulate3Buttons\*q \*q" True \*q
.BI " Option \*qEmulate3Timeout\*q \*q" 50 \*q
.BI " Option \*qGrabDevice\*q \*q" False \*q
\ \ ...
.B EndSection
.fi
.SH DESCRIPTION
.B evdev
is an XLibre input driver for Linux\'s generic event devices.
It therefore supports all input devices that the kernel knows about,
including 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.
Multiple input devices are supported by multiple instances of this driver,
with one InputDevice section of your xorg.conf 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
.BR xorg.conf (__filemansuffix__))
instead of manual per-device configuration.
Devices configured in the
.BR xorg.conf (__filemansuffix__)
are not hot-plug capable.
.SH SUPPORTED HARDWARE
In general, any input device that the kernel has a driver for can be accessed
through the
.B evdev
driver.
See the Linux kernel documentation for a complete list.
.SH CONFIGURATION DETAILS
Please refer to
.BR xorg.conf (__filemansuffix__)
for general configuration details and
for options that can be used with all input drivers.
This section only covers configuration details specific to this driver.
.PP
The following driver
.B Options
are supported:
.TP 7
.BI "Option \*qButtonMapping\*q \*q" string \*q
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 device
(i.e. the first number is the mapping for button 1, etc.).
The default mapping is "1 2 3 ... 32".
A mapping of 0 deactivates the button.
Multiple buttons can have the same mapping.
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 is used.
Buttons not specified in the user's mapping use the default mapping.
.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.
Property: "Device Node" (read-only).
.TP 7
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
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
same time they move a mouse cursor.
Button numbers occur in pairs,
with the lock button number occurring first,
followed by the button number that is the target of the lock button.
Property: "Evdev
Drag Lock Buttons".
.TP 7
.BI "Option \*qDragLockButtons\*q \*q" "M1" \*q
Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q
indicating that the next button pressed is to be \*qdrag locked\*q.
Property: "Evdev Drag Lock Buttons".
.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: 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
if two buttons were pressed "simultaneously" when 3 button emulation is enabled.
Default: 50.
Property: "Evdev Middle Button Timeout".
.TP 7
.BI "Option \*qEmulate3Button\*q \*q" integer \*q
Specifies the physical button number to be emitted if middle button emulation
is triggered.
Default: 2.
Property: "Evdev Middle Button Button".
.TP 7
.BI "Option \*qEmulateWheel\*q \*q" boolean \*q
Enable/disable "wheel" emulation.
Wheel emulation means emulating button press/release events
when the mouse is moved while a specific real button is pressed.
Wheel button events (typically buttons 4 and 5) are usually used for scrolling.
Wheel emulation is useful for getting wheel-like behaviour with trackballs.
It can also be useful for mice with 4 or more buttons but no wheel.
See the description of the
.BR EmulateWheelButton ,
.BR EmulateWheelInertia ,
.BR EmulateWheelTimeout ,
.BR XAxisMapping ,
and
.B YAxisMapping
options.
Default: off.
Property: "Evdev Wheel Emulation".
.TP 7
.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q
Specifies which button must be held down to enable wheel emulation mode.
While this button is down, X and/or Y pointer movement will generate button
press/release events as specified for the
.B XAxisMapping
and
.B YAxisMapping
settings.
If the button is 0 and
.B EmulateWheel
is on, any motion of the device is converted into wheel events.
Default: 4.
Property: "Evdev Wheel Emulation Button".
.TP 7
.BI "Option \*qEmulateWheelInertia\*q \*q" integer \*q
Specifies how far (in pixels) the pointer must move to generate button
press/release events in wheel emulation mode.
Default: 10.
Property: "Evdev Wheel Emulation Inertia".
.IP
This value must be set for any device does not resemble a standard mouse.
Specifically, on absolute devices such as tablets the value should be set to
a reasonable fraction of the expected movement to avoid excess scroll events.
.IP
.B WARNING:
the name \*qinertia\*q is a misnomer.
This option defines the distance required to generate one scroll event
similar to the
.B VertScrollDelta
and
.B HorizScrollDelta
options.
It does not enable inertia in the physical sense,
scrolling stops immediately once the movement has stopped.
.TP 7
.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
Specifies the time in milliseconds the
.B EmulateWheelButton
must be pressed before wheel emulation is started.
If the
.B EmulateWheelButton
is released before this timeout,
the original button press/release event is sent.
Default: 200.
Property: "Evdev Wheel Emulation Timeout".
.TP 7
.BI "Option \*qEmulateThirdButton\*q \*q" boolean \*q
Enable third button emulation.
Third button emulation emits a right button event (by default)
by pressing and holding the first button.
The first button must be held down for the configured timeout and
must not move more than the configured threshold for the emulation to activate.
Otherwise, the first button event is posted as normal.
Default: off.
Property: "Evdev Third Button Emulation".
.TP 7
.BI "Option \*qEmulateThirdButtonTimeout\*q \*q" integer \*q
Specifies the timeout in milliseconds between the initial button press and
the generation of the emulated button event.
Default: 1000.
Property: "Evdev Third Button Emulation Timeout".
.TP 7
.BI "Option \*qEmulateThirdButtonButton\*q \*q" integer \*q
Specifies the physical button number to be emitted if third button emulation
is triggered.
Default: 3.
Property: "Evdev Third Button Button".
.TP 7
.BI "Option \*qEmulateThirdButtonMoveThreshold\*q \*q" integer \*q
Specifies the maximum move fuzz in device coordinates for third button
emulation.
If the device moves by more than this threshold before the third
button emulation is triggered, the emulation is cancelled and a first button
event is generated as normal.
Default: 20.
Property: "Evdev Third Button Emulation Threshold".
.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 \*qIgnoreRelativeAxes\*q \*q" Bool \*q
.TP 7
.BI "Option \*qIgnoreAbsoluteAxes\*q \*q" Bool \*q
Ignore the specified type of axis.
Default: unset.
The X server cannot deal with devices that have both relative and absolute axes.
Evdev tries to guess which axes to ignore given the device type and
disables absolute axes for mice and relative axes for tablets, touchscreens,
and touchpad.
These options allow to forcibly disable an axis type.
Mouse wheel axes are exempt and will work even if relative axes are ignored.
No property, this configuration must be set in the configuration.
.br
If either option is set to False, the driver will not ignore the specified
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 \*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 for devices that need to scale to
a different coordinate system than 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
.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q
Specifies which buttons are mapped to motion in the X direction in wheel
emulation mode.
Button number
.I N1
is mapped to the negative X axis motion and button number
.I N2
is mapped to the positive X axis motion.
Default: no mapping.
Property: "Evdev Wheel Emulation Axes".
.TP 7
.BI "Option \*qYAxisMapping\*q \*q" "N1 N2" \*q
Specifies which buttons are mapped to motion in the Y direction in wheel
emulation mode.
Button number
.I N1
is mapped to the negative Y axis motion and button number
.I N2
is mapped to the positive Y axis motion.
Default: "4 5".
Property: "Evdev Wheel Emulation Axes".
.TP 7
.BI "Option \*qTypeName\*q" \*q"type"\*q
Specify the X Input 1.x type (see
.BR XListInputDevices (__libmansuffix__)).
There is rarely a need to use this option, evdev will guess the device type
based on the device's capabilities.
This option is provided for devices that need quirks.
.TP 7
.BI "Option \*qVertScrollDelta\*q \*q" integer \*q
The amount of motion considered one unit of scrolling vertically.
Default: "1".
Property: "Evdev Scrolling Distance".
.TP 7
.BI "Option \*qHorizScrollDelta\*q \*q" integer \*q
The amount of motion considered one unit of scrolling horizontally.
Default: "1".
Property: "Evdev Scrolling Distance".
.TP 7
.BI "Option \*qDialDelta\*q \*q" integer \*q
The amount of motion considered one unit of turning the dial.
Default: "1".
Property: "Evdev Scrolling Distance".
.TP 7
.BI "Option \*qResolution\*q \*q" integer \*q
Sets the resolution of the device in dots per inch.
The resolution is used to scale relative motion events from mouse devices to
1000 DPI resolution.
This can be used to make high resolution mice less sensitive without turning off
acceleration.
If set to 0 no scaling will be performed.
Default: "0".
.SH SUPPORTED PROPERTIES
The following properties are provided by the
.B evdev
driver.
.TP 7
.B "Evdev Axis Calibration"
4 32-bit values, order min-x, max-x, min-y, max-y or 0 values to disable
in-driver axis calibration.
.TP 7
.B "Evdev Axis Inversion"
2 boolean values (8 bit, 0 or 1), order X, Y.
1 inverts the axis.
.TP 7
.B "Evdev Axes Swap"
1 boolean value (8 bit, 0 or 1).
1 swaps x/y axes.
.TP 7
.B "Evdev Drag Lock Buttons"
8-bit. Either 1 value or pairs of values.
Value range 0-32, 0 disables a value.
.TP 7
.B "Evdev Middle Button Emulation"
1 boolean value (8 bit, 0 or 1).
.TP 7
.B "Evdev Middle Button Timeout"
1 16-bit positive value.
.TP 7
.B "Evdev Middle Button Button"
1 8-bit value, allowed range 0-32, 0 disables the button.
.TP 7
.B "Evdev Wheel Emulation"
1 boolean value (8 bit, 0 or 1).
.TP 7
.B "Evdev Wheel Emulation Axes"
4 8-bit values, order X up, X down, Y up, Y down.
0 disables a value.
.TP 7
.B "Evdev Wheel Emulation Button"
1 8-bit value, allowed range 0-32, 0 disables the button.
.TP 7
.B "Evdev Wheel Emulation Inertia"
1 16-bit positive value.
.TP 7
.B "Evdev Wheel Emulation Timeout"
1 16-bit positive value.
.TP 7
.B "Evdev Scrolling Distance"
3 32-bit values: vertical, horizontal and dial.
.SH AUTHORS
Kristian Høgsberg, Peter Hutterer
.SH "SEE ALSO"
.BR XLibre (@APP_MAN_SUFFIX@),
.BR xorg.conf (@FILE_MAN_SUFFIX@),
.BR Xserver (@APP_MAN_SUFFIX@),
.BR X (@MISC_MAN_SUFFIX@)

View File

@@ -1,6 +0,0 @@
.deps
.libs
Makefile
Makefile.in
*.la
*.lo

View File

@@ -24,10 +24,20 @@
# -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.
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
@DRIVER_NAME@_drv_ladir = @inputdir@
@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \ AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
@DRIVER_NAME@.h \ AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBEVDEV_CFLAGS)
emuMB.c
evdev_drv_la_LTLIBRARIES = evdev_drv.la
evdev_drv_la_LDFLAGS = -module -avoid-version
evdev_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS) $(LIBEVDEV_LIBS)
evdev_drv_ladir = @xlibre_input_drivers_dir@
evdev_drv_la_SOURCES = evdev.c \
evdev.h \
emuMB.c \
emuThird.c \
emuWheel.c \
draglock.c \
apple.c \
axis_labels.h

311
src/apple.c Normal file
View File

@@ -0,0 +1,311 @@
/*
* Copyright © 2011 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 "config.h"
#include <evdev.h>
#include <evdev-properties.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <exevents.h>
#include <xf86.h>
#include <xf86Xinput.h>
#include <X11/Xatom.h>
/* Apple-specific controls.
*
* On Apple keyboards, the multimedia function keys are overlaid with the F
* keys. F1 is also BrightnessDown, F10 is Mute, etc. The kernel provides a
* tweak to enable/disable this.
*
* /sys/module/hid_apple/parameters/fnmode
* 0 .. keyboard sends Fx keys, fn is disabled
* 1 .. keyboard sends multimedia keys, fn sends Fx keys
* 2 .. keyboard sends Fx keys, fn sends multimedia keys
*
* We only handle 1 and 2, don't care about 0. If fnmode is found to be on
* 0, we force it to 2 instead.
*/
/* In this file: fkeymode refers to the evdev-specific enums and parameters,
* fnmode refers to the fnmode parameter exposed by the kernel. fnmode is
* apple-specific */
#define FNMODE_PATH "/sys/module/hid_apple/parameters/fnmode"
/* Taken from the kernel */
#define USB_VENDOR_ID_APPLE 0x05ac
#define USB_DEVICE_ID_APPLE_ALU_MINI_ANSI 0x021d
#define USB_DEVICE_ID_APPLE_ALU_MINI_ISO 0x021e
#define USB_DEVICE_ID_APPLE_ALU_MINI_JIS 0x021f
#define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220
#define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221
#define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
static int EvdevAppleGetProperty (DeviceIntPtr dev, Atom property);
static int EvdevAppleSetProperty(DeviceIntPtr dev, Atom atom,
XIPropertyValuePtr val, BOOL checkonly);
static Atom prop_fkeymode;
static Bool fnmode_readonly; /* set if we can only read fnmode */
struct product_table
{
unsigned int vendor;
unsigned int product;
} apple_keyboard_table[] = {
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO},
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS},
{ 0, 0}
};
/**
* @return TRUE if the device matches a product in the given product table,
* FALSE otherwise
*/
static Bool product_check(const struct product_table *t, int vendor, int product)
{
while (t->vendor)
{
if (vendor == t->vendor && product == t->product)
return TRUE;
t++;
}
return FALSE;
}
/**
* @return 0 on success, -1 otherwise (check errno)
*/
static int
set_fnmode(enum fkeymode fkeymode)
{
int fd;
char mode;
int bytes_written;
if (fkeymode == FKEYMODE_UNKNOWN)
{
errno = EINVAL; /* silly you */
return -1;
}
fd = open(FNMODE_PATH, O_WRONLY);
if (fd < 0)
return -1;
mode = (fkeymode == FKEYMODE_FKEYS) ? '2' : '1';
bytes_written = write(fd, &mode, 1);
close(fd);
return (bytes_written == 1) ? 0 : -1;
}
/**
* Get the current value of fnmode. If fnmode is found to be on 0, we set it
* to 2 in the process. Yes, quite daring, I know. I live on the edge.
*
* @return The current setting of fnmode or FKEYMODE_UNKNOWN on error (check
* errno)
*/
static enum fkeymode
get_fnmode(void)
{
int fd;
char retvalue;
fd = open(FNMODE_PATH, O_RDWR);
if (fd < 0 && errno == EACCES)
{
fnmode_readonly = TRUE;
fd = open(FNMODE_PATH, O_RDONLY);
}
if (fd < 0)
goto err;
if (read(fd, &retvalue, 1) != 1)
goto err;
if (retvalue != '0' && retvalue != '1' && retvalue != '2')
{
xf86Msg(X_ERROR, "Invalid fnmode value: %c\n", retvalue);
errno = EINVAL;
goto err;
}
close(fd);
/* we don't want 0, switch to 2 */
if (retvalue == '0')
{
if (fnmode_readonly)
xf86Msg(X_WARNING, "fnmode is disabled and read-only. Fn key will"
"not toggle to multimedia keys.\n");
else
set_fnmode(FKEYMODE_FKEYS);
}
return retvalue == '1' ? FKEYMODE_MMKEYS : FKEYMODE_FKEYS;
err:
if (fd >= 0)
close(fd);
return FKEYMODE_UNKNOWN;
}
/**
* Set the property value to fkeymode. If the property doesn't exist,
* initialize it.
*/
static void set_fkeymode_property(InputInfoPtr pInfo, enum fkeymode fkeymode)
{
DeviceIntPtr dev = pInfo->dev;
BOOL init = FALSE;
char data;
switch(fkeymode)
{
case FKEYMODE_FKEYS: data = 0; break;
case FKEYMODE_MMKEYS: data = 1; break;
case FKEYMODE_UNKNOWN:
xf86IDrvMsg(pInfo, X_ERROR, "Failed to get fnmode (%s)\n", strerror(errno));
return;
}
if (!prop_fkeymode) {
init = TRUE;
prop_fkeymode = MakeAtom(EVDEV_PROP_FUNCTION_KEYS, strlen(EVDEV_PROP_FUNCTION_KEYS), TRUE);
}
/* Don't send an event if we're initializing the property */
XIChangeDeviceProperty(dev, prop_fkeymode, XA_INTEGER, 8,
PropModeReplace, 1, &data, !init);
if (init)
{
XISetDevicePropertyDeletable(dev, prop_fkeymode, FALSE);
XIRegisterPropertyHandler(dev, EvdevAppleSetProperty, EvdevAppleGetProperty, NULL);
}
}
/**
* Called when a client reads the property state.
* Update with current kernel state, it may have changed behind our back.
*/
static int
EvdevAppleGetProperty (DeviceIntPtr dev, Atom property)
{
if (property == prop_fkeymode)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
enum fkeymode fkeymode;
fkeymode = get_fnmode();
if (fkeymode != pEvdev->fkeymode) {
/* set internal copy first, so we don't write to the file in
* SetProperty handler */
pEvdev->fkeymode = fkeymode;
set_fkeymode_property(pInfo, fkeymode);
}
}
return Success;
}
static int
EvdevAppleSetProperty(DeviceIntPtr dev, Atom atom,
XIPropertyValuePtr val, BOOL checkonly)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
if (atom == prop_fkeymode)
{
CARD8 v = *(CARD8*)val->data;
if (val->format != 8 || val->type != XA_INTEGER)
return BadMatch;
if (fnmode_readonly)
return BadAccess;
if (v > 1)
return BadValue;
if (!checkonly)
{
if ((!v && pEvdev->fkeymode != FKEYMODE_FKEYS) ||
(v && pEvdev->fkeymode != FKEYMODE_MMKEYS))
{
pEvdev->fkeymode = v ? FKEYMODE_MMKEYS : FKEYMODE_FKEYS;
set_fnmode(pEvdev->fkeymode);
}
}
}
return Success;
}
void
EvdevAppleInitProperty(DeviceIntPtr dev)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
enum fkeymode fkeymode;
if (!product_check(apple_keyboard_table,
libevdev_get_id_vendor(pEvdev->dev),
libevdev_get_id_product(pEvdev->dev)))
return;
fkeymode = get_fnmode();
pEvdev->fkeymode = fkeymode;
set_fkeymode_property(pInfo, fkeymode);
}

196
src/axis_labels.h Normal file
View File

@@ -0,0 +1,196 @@
/*
* 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.
*/
#include "config.h"
#include <xserver-properties.h>
#ifndef AXIS_LABELS
#define AXIS_LABELS
/* Aligned with linux/input.h.
Note that there are holes in the ABS_ range, these are simply replaced with
MISC here */
static const char* abs_labels[] = {
AXIS_LABEL_PROP_ABS_X, /* 0x00 */
AXIS_LABEL_PROP_ABS_Y, /* 0x01 */
AXIS_LABEL_PROP_ABS_Z, /* 0x02 */
AXIS_LABEL_PROP_ABS_RX, /* 0x03 */
AXIS_LABEL_PROP_ABS_RY, /* 0x04 */
AXIS_LABEL_PROP_ABS_RZ, /* 0x05 */
AXIS_LABEL_PROP_ABS_THROTTLE, /* 0x06 */
AXIS_LABEL_PROP_ABS_RUDDER, /* 0x07 */
AXIS_LABEL_PROP_ABS_WHEEL, /* 0x08 */
AXIS_LABEL_PROP_ABS_GAS, /* 0x09 */
AXIS_LABEL_PROP_ABS_BRAKE, /* 0x0a */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_HAT0X, /* 0x10 */
AXIS_LABEL_PROP_ABS_HAT0Y, /* 0x11 */
AXIS_LABEL_PROP_ABS_HAT1X, /* 0x12 */
AXIS_LABEL_PROP_ABS_HAT1Y, /* 0x13 */
AXIS_LABEL_PROP_ABS_HAT2X, /* 0x14 */
AXIS_LABEL_PROP_ABS_HAT2Y, /* 0x15 */
AXIS_LABEL_PROP_ABS_HAT3X, /* 0x16 */
AXIS_LABEL_PROP_ABS_HAT3Y, /* 0x17 */
AXIS_LABEL_PROP_ABS_PRESSURE, /* 0x18 */
AXIS_LABEL_PROP_ABS_DISTANCE, /* 0x19 */
AXIS_LABEL_PROP_ABS_TILT_X, /* 0x1a */
AXIS_LABEL_PROP_ABS_TILT_Y, /* 0x1b */
AXIS_LABEL_PROP_ABS_TOOL_WIDTH, /* 0x1c */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_VOLUME /* 0x20 */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, /* 0x30 */
AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, /* 0x31 */
AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, /* 0x32 */
AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR, /* 0x33 */
AXIS_LABEL_PROP_ABS_MT_ORIENTATION, /* 0x34 */
AXIS_LABEL_PROP_ABS_MT_POSITION_X, /* 0x35 */
AXIS_LABEL_PROP_ABS_MT_POSITION_Y, /* 0x36 */
AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE, /* 0x37 */
AXIS_LABEL_PROP_ABS_MT_BLOB_ID, /* 0x38 */
AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, /* 0x39 */
AXIS_LABEL_PROP_ABS_MT_PRESSURE, /* 0x3a */
#ifdef AXIS_LABEL_PROP_ABS_MT_DISTANCE
AXIS_LABEL_PROP_ABS_MT_DISTANCE, /* 0x3b */
AXIS_LABEL_PROP_ABS_MT_TOOL_X, /* 0x3c */
AXIS_LABEL_PROP_ABS_MT_TOOL_Y, /* 0x3d */
#endif /* AXIS_LABEL_PROP_ABS_MT_DISTANCE */
};
static const char* rel_labels[] = {
AXIS_LABEL_PROP_REL_X,
AXIS_LABEL_PROP_REL_Y,
AXIS_LABEL_PROP_REL_Z,
AXIS_LABEL_PROP_REL_RX,
AXIS_LABEL_PROP_REL_RY,
AXIS_LABEL_PROP_REL_RZ,
AXIS_LABEL_PROP_REL_HWHEEL,
AXIS_LABEL_PROP_REL_DIAL,
AXIS_LABEL_PROP_REL_WHEEL,
AXIS_LABEL_PROP_REL_MISC
};
static const char* btn_labels[][16] = {
{ /* BTN_MISC group offset 0x100*/
BTN_LABEL_PROP_BTN_0, /* 0x00 */
BTN_LABEL_PROP_BTN_1, /* 0x01 */
BTN_LABEL_PROP_BTN_2, /* 0x02 */
BTN_LABEL_PROP_BTN_3, /* 0x03 */
BTN_LABEL_PROP_BTN_4, /* 0x04 */
BTN_LABEL_PROP_BTN_5, /* 0x05 */
BTN_LABEL_PROP_BTN_6, /* 0x06 */
BTN_LABEL_PROP_BTN_7, /* 0x07 */
BTN_LABEL_PROP_BTN_8, /* 0x08 */
BTN_LABEL_PROP_BTN_9 /* 0x09 */
},
{ /* BTN_MOUSE group offset 0x110 */
BTN_LABEL_PROP_BTN_LEFT, /* 0x00 */
BTN_LABEL_PROP_BTN_RIGHT, /* 0x01 */
BTN_LABEL_PROP_BTN_MIDDLE, /* 0x02 */
BTN_LABEL_PROP_BTN_SIDE, /* 0x03 */
BTN_LABEL_PROP_BTN_EXTRA, /* 0x04 */
BTN_LABEL_PROP_BTN_FORWARD, /* 0x05 */
BTN_LABEL_PROP_BTN_BACK, /* 0x06 */
BTN_LABEL_PROP_BTN_TASK /* 0x07 */
},
{ /* BTN_JOYSTICK group offset 0x120 */
BTN_LABEL_PROP_BTN_TRIGGER, /* 0x00 */
BTN_LABEL_PROP_BTN_THUMB, /* 0x01 */
BTN_LABEL_PROP_BTN_THUMB2, /* 0x02 */
BTN_LABEL_PROP_BTN_TOP, /* 0x03 */
BTN_LABEL_PROP_BTN_TOP2, /* 0x04 */
BTN_LABEL_PROP_BTN_PINKIE, /* 0x05 */
BTN_LABEL_PROP_BTN_BASE, /* 0x06 */
BTN_LABEL_PROP_BTN_BASE2, /* 0x07 */
BTN_LABEL_PROP_BTN_BASE3, /* 0x08 */
BTN_LABEL_PROP_BTN_BASE4, /* 0x09 */
BTN_LABEL_PROP_BTN_BASE5, /* 0x0a */
BTN_LABEL_PROP_BTN_BASE6, /* 0x0b */
NULL,
NULL,
NULL,
BTN_LABEL_PROP_BTN_DEAD /* 0x0f */
},
{ /* BTN_GAMEPAD group offset 0x130 */
BTN_LABEL_PROP_BTN_A, /* 0x00 */
BTN_LABEL_PROP_BTN_B, /* 0x01 */
BTN_LABEL_PROP_BTN_C, /* 0x02 */
BTN_LABEL_PROP_BTN_X, /* 0x03 */
BTN_LABEL_PROP_BTN_Y, /* 0x04 */
BTN_LABEL_PROP_BTN_Z, /* 0x05 */
BTN_LABEL_PROP_BTN_TL, /* 0x06 */
BTN_LABEL_PROP_BTN_TR, /* 0x07 */
BTN_LABEL_PROP_BTN_TL2, /* 0x08 */
BTN_LABEL_PROP_BTN_TR2, /* 0x09 */
BTN_LABEL_PROP_BTN_SELECT, /* 0x0a */
BTN_LABEL_PROP_BTN_START, /* 0x0b */
BTN_LABEL_PROP_BTN_MODE, /* 0x0c */
BTN_LABEL_PROP_BTN_THUMBL, /* 0x0d */
BTN_LABEL_PROP_BTN_THUMBR /* 0x0e */
},
{ /* BTN_DIGI group offset 0x140 */
BTN_LABEL_PROP_BTN_TOOL_PEN, /* 0x00 */
BTN_LABEL_PROP_BTN_TOOL_RUBBER, /* 0x01 */
BTN_LABEL_PROP_BTN_TOOL_BRUSH, /* 0x02 */
BTN_LABEL_PROP_BTN_TOOL_PENCIL, /* 0x03 */
BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH, /* 0x04 */
BTN_LABEL_PROP_BTN_TOOL_FINGER, /* 0x05 */
BTN_LABEL_PROP_BTN_TOOL_MOUSE, /* 0x06 */
BTN_LABEL_PROP_BTN_TOOL_LENS, /* 0x07 */
NULL,
NULL,
BTN_LABEL_PROP_BTN_TOUCH, /* 0x0a */
BTN_LABEL_PROP_BTN_STYLUS, /* 0x0b */
BTN_LABEL_PROP_BTN_STYLUS2, /* 0x0c */
BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP, /* 0x0d */
BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP /* 0x0e */
},
{ /* BTN_WHEEL group offset 0x150 */
BTN_LABEL_PROP_BTN_GEAR_DOWN, /* 0x00 */
BTN_LABEL_PROP_BTN_GEAR_UP /* 0x01 */
}
};
#endif

316
src/draglock.c Normal file
View File

@@ -0,0 +1,316 @@
/*
* 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
* (Ported from xf86-input-mouse, above copyrights taken from there)
* 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
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of the authors
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. The authors make 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.
*
*/
/* Draglock code */
#include "config.h"
#include "evdev.h"
#include <xf86.h>
#include <xf86Xinput.h>
#include <X11/Xatom.h>
#include <exevents.h>
#include <evdev-properties.h>
static Atom prop_dlock = 0; /* Drag lock buttons. */
void EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button);
/* Setup and configuration code */
void
EvdevDragLockPreInit(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
char *option_string = NULL;
int meta_button = 0;
int lock_button = 0;
char *next_num = NULL;
char *end_str = NULL;
BOOL pairs = FALSE;
option_string = xf86CheckStrOption(pInfo->options, "DragLockButtons",NULL);
if (!option_string)
return;
next_num = option_string;
/* Loop until we hit the end of our option string */
while (next_num != NULL) {
lock_button = 0;
meta_button = strtol(next_num, &end_str, 10);
/* check to see if we found anything */
if (next_num != end_str) {
/* setup for the next number */
next_num = end_str;
} else {
/* we have nothing more to parse, drop out of the loop */
next_num = NULL;
}
/* Check for a button to lock if we have a meta button */
if (meta_button != 0 && next_num != NULL ) {
lock_button = strtol(next_num, &end_str, 10);
/* check to see if we found anything */
if (next_num != end_str) {
/* setup for the next number */
next_num = end_str;
} else {
/* we have nothing more to parse, drop out of the loop */
next_num = NULL;
}
}
/* Ok, let the user know what we found on this look */
if (meta_button != 0) {
if (lock_button == 0) {
if (!pairs) {
/* We only have a meta button */
pEvdev->dragLock.meta = meta_button;
xf86IDrvMsg(pInfo, X_CONFIG, "DragLockButtons : "
"%i as meta\n", meta_button);
} else {
xf86IDrvMsg(pInfo, X_ERROR, "DragLockButtons : "
"Incomplete pair specifying button pairs %s\n",
option_string);
}
} else {
/* Do bounds checking to make sure we don't crash */
if ((meta_button <= EVDEV_MAXBUTTONS) && (meta_button >= 0 ) &&
(lock_button <= EVDEV_MAXBUTTONS) && (lock_button >= 0)) {
xf86IDrvMsg(pInfo, X_CONFIG,
"DragLockButtons : %i -> %i\n",
meta_button, lock_button);
pEvdev->dragLock.lock_pair[meta_button - 1] = lock_button;
pairs=TRUE;
} else {
/* Let the user know something was wrong
with this pair of buttons */
xf86IDrvMsg(pInfo, X_CONFIG,"DragLockButtons : "
"Invalid button pair %i -> %i\n",
meta_button, lock_button);
}
}
} else {
xf86IDrvMsg(pInfo, X_ERROR, "Found DragLockButtons "
"with invalid lock button string : '%s'\n",
option_string);
/* This should be the case anyhow, just make sure */
next_num = NULL;
}
/* Check for end of string, to avoid annoying error */
if (next_num != NULL && *next_num == '\0')
next_num = NULL;
}
free(option_string);
}
/* Updates DragLock button state and fires button event messges */
void
EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
BOOL state = 0;
/* update button state */
state = pEvdev->dragLock.lock_state[button - 1] ? FALSE : TRUE;
pEvdev->dragLock.lock_state[button - 1] = state;
EvdevQueueButtonEvent(pInfo, button, state);
}
/* Filter button presses looking for either a meta button or the
* control of a button pair.
*
* @param button button number (1 for left, 3 for right)
* @param value TRUE if button press, FALSE if release
*
* @return TRUE if the event was swallowed here, FALSE otherwise.
*/
BOOL
EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
if (button == 0)
return FALSE;
/* Do we have a single meta key or
several button pairings? */
if (pEvdev->dragLock.meta != 0) {
if (pEvdev->dragLock.meta == button) {
/* setup up for button lock */
if (value)
pEvdev->dragLock.meta_state = TRUE;
return TRUE;
} else if (pEvdev->dragLock.meta_state) { /* waiting to lock */
pEvdev->dragLock.meta_state = FALSE;
EvdevDragLockLockButton(pInfo, button);
return TRUE;
}
} else if (pEvdev->dragLock.lock_pair[button - 1] && value) {
/* A meta button in a meta/lock pair was pressed */
EvdevDragLockLockButton(pInfo, pEvdev->dragLock.lock_pair[button - 1]);
return TRUE;
}
/* Eat events for buttons that are locked */
if (pEvdev->dragLock.lock_state[button - 1])
return TRUE;
return FALSE;
}
/**
* Set the drag lock property.
* If only one value is supplied, then this is used as the meta button.
* If more than one value is supplied, then each value is the drag lock button
* for the pair. 0 disables a pair.
* i.e. to set bt 3 to draglock button 1, supply 0,0,1
*/
static int
EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
BOOL checkonly)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
if (atom == prop_dlock)
{
int i;
if (val->format != 8 || val->type != XA_INTEGER)
return BadMatch;
/* Don't allow changes while a lock is active */
if (pEvdev->dragLock.meta)
{
if (pEvdev->dragLock.meta_state)
return BadAccess;
} else
{
for (i = 0; i < EVDEV_MAXBUTTONS; i++)
if (pEvdev->dragLock.lock_state[i])
return BadValue;
}
if (val->size == 0)
return BadMatch;
else if (val->size == 1)
{
int meta = *((CARD8*)val->data);
if (meta > EVDEV_MAXBUTTONS)
return BadValue;
if (!checkonly)
{
pEvdev->dragLock.meta = meta;
memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair));
}
} else if ((val->size % 2) == 0)
{
CARD8* vals = (CARD8*)val->data;
for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i++)
if (vals[i] > EVDEV_MAXBUTTONS)
return BadValue;
if (!checkonly)
{
pEvdev->dragLock.meta = 0;
memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair));
for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i += 2)
pEvdev->dragLock.lock_pair[vals[i] - 1] = vals[i + 1];
}
} else
return BadMatch;
}
return Success;
}
/**
* Initialise property for drag lock buttons setting.
*/
void
EvdevDragLockInitProperty(DeviceIntPtr dev)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
if (!dev->button) /* don't init prop for keyboards */
return;
prop_dlock = MakeAtom(EVDEV_PROP_DRAGLOCK, strlen(EVDEV_PROP_DRAGLOCK), TRUE);
if (pEvdev->dragLock.meta)
{
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8,
PropModeReplace, 1, &pEvdev->dragLock.meta,
FALSE);
} else {
int highest = 0;
int i;
CARD8 pair[EVDEV_MAXBUTTONS] = {0};
for (i = 0; i < EVDEV_MAXBUTTONS; i++)
{
if (pEvdev->dragLock.lock_pair[i])
highest = i;
pair[i] = pEvdev->dragLock.lock_pair[i];
}
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8, PropModeReplace,
highest + 1, pair, FALSE);
}
XISetDevicePropertyDeletable(dev, prop_dlock, FALSE);
XIRegisterPropertyHandler(dev, EvdevDragLockSetProperty, NULL, NULL);
}

View File

@@ -11,11 +11,11 @@
* and its documentation for any purpose is hereby granted without * and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies * fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice * and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of Red Hat * appear in supporting documentation, and that the name of the authors
* not be used in advertising or publicity pertaining to distribution * not be used in advertising or publicity pertaining to distribution of the
* of the software without specific, written prior permission. Red * software without specific, written prior permission. The authors make no
* Hat makes no representations about the suitability of this software * representations about the suitability of this software for any
* for any purpose. It is provided "as is" without express or implied * purpose. It is provided "as is" without express or implied
* warranty. * warranty.
* *
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
@@ -30,20 +30,19 @@
/* Middle mouse button emulation code. */ /* Middle mouse button emulation code. */
#ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif
#include <xf86.h>
#include "evdev.h" #include "evdev.h"
enum { #include <X11/Xatom.h>
MBEMU_DISABLED = 0, #include <xf86.h>
MBEMU_ENABLED, #include <xf86Xinput.h>
MBEMU_AUTO #include <exevents.h>
};
#include <evdev-properties.h>
static Atom prop_mbemu = 0; /* Middle button emulation on/off property */
static Atom prop_mbtimeout = 0; /* Middle button timeout property */
static Atom prop_mbbuton = 0; /* Middle button target button property */
/* /*
* Lets create a simple finite-state machine for 3 button emulation: * Lets create a simple finite-state machine for 3 button emulation:
* *
@@ -183,22 +182,26 @@ int
EvdevMBEmuTimer(InputInfoPtr pInfo) EvdevMBEmuTimer(InputInfoPtr pInfo)
{ {
EvdevPtr pEvdev = pInfo->private; EvdevPtr pEvdev = pInfo->private;
int sigstate;
int id; int id;
int mapped_id;
sigstate = xf86BlockSIGIO (); input_lock();
pEvdev->emulateMB.pending = FALSE; pEvdev->emulateMB.pending = FALSE;
if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) { if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); mapped_id = abs(id);
if (mapped_id == 2)
mapped_id = pEvdev->emulateMB.button;
EvdevPostButtonEvent(pInfo, mapped_id,
(id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
pEvdev->emulateMB.state = pEvdev->emulateMB.state =
stateTab[pEvdev->emulateMB.state][4][2]; stateTab[pEvdev->emulateMB.state][4][2];
} else { } else {
ErrorF("Got unexpected buttonTimer in state %d\n", xf86IDrvMsg(pInfo, X_ERROR, "Got unexpected buttonTimer in state %d\n",
pEvdev->emulateMB.state); pEvdev->emulateMB.state);
} }
xf86UnblockSIGIO (sigstate); input_unlock();
return 0; return 0;
} }
@@ -206,17 +209,18 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
/** /**
* Emulate a middle button on button press. * Emulate a middle button on button press.
* *
* @param code Evdev event code (BTN_LEFT or BTN_RIGHT) * @param code button number (1 for left, 3 for right)
* @param press TRUE if press, FALSE if release. * @param press TRUE if press, FALSE if release.
* *
* @return TRUE if event was swallowed by middle mouse button emulation, FALSE * @return TRUE if event was swallowed by middle mouse button emulation, FALSE
* otherwise. * otherwise.
*/ */
BOOL BOOL
EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int code, BOOL press) EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
{ {
EvdevPtr pEvdev = pInfo->private; EvdevPtr pEvdev = pInfo->private;
int id; int id;
int mapped_id;
int *btstate; int *btstate;
int ret = FALSE; int ret = FALSE;
@@ -224,23 +228,26 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int code, BOOL press)
return ret; return ret;
/* don't care about other buttons */ /* don't care about other buttons */
if (code != BTN_LEFT && code != BTN_RIGHT) if (button != 1 && button != 3)
return ret; return ret;
btstate = &pEvdev->emulateMB.buttonstate; btstate = &pEvdev->emulateMB.buttonstate;
if (press) if (press)
*btstate |= (code == BTN_LEFT) ? 0x1 : 0x2; *btstate |= (button == 1) ? 0x1 : 0x2;
else else
*btstate &= (code == BTN_LEFT) ? ~0x1 : ~0x2; *btstate &= (button == 1) ? ~0x1 : ~0x2;
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0) if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0)
{ {
xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); mapped_id = abs(id);
if (mapped_id == 2)
mapped_id = pEvdev->emulateMB.button;
EvdevQueueButtonEvent(pInfo, mapped_id, (id >= 0));
ret = TRUE; ret = TRUE;
} }
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0) if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0)
{ {
xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0));
ret = TRUE; ret = TRUE;
} }
@@ -259,9 +266,7 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int code, BOOL press)
} }
void EvdevMBEmuWakeupHandler(pointer data, void EvdevMBEmuWakeupHandler(void *data, int i)
int i,
pointer LastSelectMask)
{ {
InputInfoPtr pInfo = (InputInfoPtr)data; InputInfoPtr pInfo = (InputInfoPtr)data;
EvdevPtr pEvdev = (EvdevPtr)pInfo->private; EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
@@ -275,9 +280,7 @@ void EvdevMBEmuWakeupHandler(pointer data,
} }
} }
void EvdevMBEmuBlockHandler(pointer data, void EvdevMBEmuBlockHandler(void *data, void *waitTime)
struct timeval **waitTime,
pointer LastSelectMask)
{ {
InputInfoPtr pInfo = (InputInfoPtr) data; InputInfoPtr pInfo = (InputInfoPtr) data;
EvdevPtr pEvdev= (EvdevPtr) pInfo->private; EvdevPtr pEvdev= (EvdevPtr) pInfo->private;
@@ -296,39 +299,128 @@ void
EvdevMBEmuPreInit(InputInfoPtr pInfo) EvdevMBEmuPreInit(InputInfoPtr pInfo)
{ {
EvdevPtr pEvdev = (EvdevPtr)pInfo->private; EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
pEvdev->emulateMB.enabled = MBEMU_AUTO; int bt;
if (xf86FindOption(pInfo->options, "Emulate3Buttons"))
{
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
"Emulate3Buttons",
MBEMU_ENABLED);
xf86Msg(X_INFO, "%s: Forcing middle mouse button emulation.\n",
pInfo->name);
}
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
"Emulate3Buttons",
FALSE);
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options, pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
"Emulate3Timeout", 50); "Emulate3Timeout", 50);
bt = xf86SetIntOption(pInfo->options, "Emulate3Button", 2);
if (bt < 0 || bt > EVDEV_MAXBUTTONS) {
xf86IDrvMsg(pInfo, X_WARNING, "Invalid Emulate3Button value: %d\n",
bt);
xf86IDrvMsg(pInfo, X_WARNING, "Middle button emulation disabled.\n");
pEvdev->emulateMB.enabled = FALSE;
}
pEvdev->emulateMB.button = bt;
}
void
EvdevMBEmuOn(InputInfoPtr pInfo)
{
if (!pInfo->dev->button) /* don't init for keyboards */
return;
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler, RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
EvdevMBEmuWakeupHandler, EvdevMBEmuWakeupHandler,
(pointer)pInfo); (void*)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); (void*)pInfo);
} }
/* Enable/disable middle mouse button emulation. */ static int
void EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable) BOOL checkonly)
{ {
EvdevPtr pEvdev = (EvdevPtr)pInfo->private; InputInfoPtr pInfo = dev->public.devicePrivate;
if (pEvdev->emulateMB.enabled == MBEMU_AUTO) EvdevPtr pEvdev = pInfo->private;
pEvdev->emulateMB.enabled = enable; int bt;
if (atom == prop_mbemu)
{
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
if (!checkonly)
pEvdev->emulateMB.enabled = *((BOOL*)val->data);
} else if (atom == prop_mbtimeout)
{
if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
if (!checkonly)
pEvdev->emulateMB.timeout = *((CARD32*)val->data);
} else if (atom == prop_mbbuton)
{
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
bt = *((CARD8*)val->data);
if (bt < 0 || bt > EVDEV_MAXBUTTONS)
return BadValue;
if (!checkonly)
pEvdev->emulateMB.button = bt;
}
return Success;
}
/**
* Initialise property for MB emulation on/off.
*/
void
EvdevMBEmuInitProperty(DeviceIntPtr dev)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
int rc;
if (!dev->button) /* don't init prop for keyboards */
return;
prop_mbemu = MakeAtom(EVDEV_PROP_MIDBUTTON, strlen(EVDEV_PROP_MIDBUTTON), TRUE);
rc = XIChangeDeviceProperty(dev, prop_mbemu, XA_INTEGER, 8,
PropModeReplace, 1,
&pEvdev->emulateMB.enabled,
FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_mbemu, FALSE);
prop_mbtimeout = MakeAtom(EVDEV_PROP_MIDBUTTON_TIMEOUT,
strlen(EVDEV_PROP_MIDBUTTON_TIMEOUT),
TRUE);
rc = XIChangeDeviceProperty(dev, prop_mbtimeout, XA_INTEGER, 32, PropModeReplace, 1,
&pEvdev->emulateMB.timeout, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
prop_mbbuton = MakeAtom(EVDEV_PROP_MIDBUTTON_BUTTON,
strlen(EVDEV_PROP_MIDBUTTON_BUTTON),
TRUE);
rc = XIChangeDeviceProperty(dev, prop_mbbuton, XA_INTEGER, 8, PropModeReplace, 1,
&pEvdev->emulateMB.button, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_mbbuton, FALSE);
XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
} }

412
src/emuThird.c Normal file
View File

@@ -0,0 +1,412 @@
/*
* Copyright © 2011 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 the authors
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. The authors make 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.
*
*/
/* Right mouse button emulation code.
* Emulates a right button event if the first button is held down for a
* timeout. If the device moves more than a certain amount before the
* timeout is over, the emulation is cancelled and a normal button event is
* generated.
*/
#include "config.h"
#include "evdev.h"
#include <X11/Xatom.h>
#include <xf86.h>
#include <xf86Xinput.h>
#include <exevents.h>
#include <evdev-properties.h>
/* Threshold (in device coordinates) for devices to cancel emulation */
#define DEFAULT_MOVE_THRESHOLD 20
static Atom prop_3bemu; /* Right button emulation on/off property */
static Atom prop_3btimeout; /* Right button timeout property */
static Atom prop_3bbutton; /* Right button target physical button */
static Atom prop_3bthreshold; /* Right button move cancellation threshold */
/* State machine for 3rd button emulation */
enum EmulationState {
EM3B_OFF, /* no event */
EM3B_PENDING, /* timer pending */
EM3B_EMULATING /* in emulation */
};
static void
Evdev3BEmuPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act)
{
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
int absolute = Relative;
/* if we cancel, emit the button down event at our start position,
* not at the current position. Only for absolute devices though. For
* relative events, this may be a bit iffy since pointer accel may shoot
* us back more than we moved and confuse the user.
*/
if (emu3B->flags & EVDEV_ABSOLUTE_EVENTS)
absolute = Absolute;
xf86PostButtonEventP(pInfo->dev, absolute, button,
(act == BUTTON_PRESS) ? 1 : 0, 0,
(absolute ? 2 : 0), emu3B->startpos);
}
/**
* Timer function. Post a button down event to the server.
*
* @param arg The InputInfoPtr for this device.
*/
CARD32
Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, void *arg)
{
InputInfoPtr pInfo = (InputInfoPtr)arg;
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
input_lock();
emu3B->state = EM3B_EMULATING;
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_PRESS);
input_unlock();
return 0;
}
/**
* Cancel all emulation, reset the timer and reset deltas.
*/
static void
Evdev3BCancel(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
if (emu3B->state != EM3B_OFF)
{
TimerCancel(emu3B->timer);
emu3B->state = EM3B_OFF;
memset(emu3B->delta, 0, sizeof(emu3B->delta));
}
emu3B->flags = 0;
}
/**
* Emulate a third button on button press. Note that emulation only triggers
* on button 1.
*
* Return TRUE if event was swallowed by middle mouse button emulation,
* FALSE otherwise.
*/
BOOL
Evdev3BEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
{
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
int ret = FALSE;
if (!emu3B->enabled)
goto out;
if (press)
emu3B->buttonstate |= button;
else
emu3B->buttonstate &= ~button;
/* Any other button pressed? Cancel timer */
if (button != 1)
{
switch (emu3B->state)
{
case EM3B_PENDING:
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
break;
case EM3B_EMULATING:
/* We're emulating and now the user pressed a different
* button. Just release the emulating one, tell the user to
* not do that and get on with life */
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
Evdev3BCancel(pInfo);
break;
default:
break;
}
goto out;
}
/* Don't emulate if any other button is down */
if ((emu3B->buttonstate & ~0x1) != 0)
goto out;
/* Release event → cancel, send press and release now. */
if (!press)
{
switch(emu3B->state)
{
case EM3B_PENDING:
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
break;
case EM3B_EMULATING:
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
Evdev3BCancel(pInfo);
ret = TRUE;
break;
default:
break;
}
goto out;
}
if (press && emu3B->state == EM3B_OFF)
{
emu3B->state = EM3B_PENDING;
emu3B->timer = TimerSet(emu3B->timer, 0, emu3B->timeout,
Evdev3BEmuTimer, pInfo);
ret = TRUE;
goto out;
}
out:
return ret;
}
/**
* Handle absolute x/y motion. If the motion is above the threshold, cancel
* emulation.
*/
void
Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals)
{
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
int cancel = FALSE;
int axis = 0;
if (emu3B->state != EM3B_PENDING)
{
if (valuator_mask_isset(vals, 0))
emu3B->startpos[0] = valuator_mask_get(vals, 0);
if (valuator_mask_isset(vals, 1))
emu3B->startpos[1] = valuator_mask_get(vals, 1);
return;
}
if ((emu3B->flags & EVDEV_ABSOLUTE_EVENTS) == 0)
emu3B->flags |= EVDEV_ABSOLUTE_EVENTS;
while (axis <= 1 && !cancel)
{
if (valuator_mask_isset(vals, axis))
{
double delta = valuator_mask_get_double(vals, axis) - emu3B->startpos[axis];
if (fabs(delta) > emu3B->threshold)
cancel = TRUE;
}
axis++;
}
if (cancel)
{
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
}
}
/**
* Handle relative x/y motion. If the motion is above the threshold, cancel
* emulation.
*/
void
Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy)
{
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
if (emu3B->state != EM3B_PENDING)
return;
emu3B->delta[0] += dx;
emu3B->delta[1] += dy;
emu3B->flags |= EVDEV_RELATIVE_EVENTS;
if (fabs(emu3B->delta[0]) > emu3B->threshold ||
fabs(emu3B->delta[1]) > emu3B->threshold)
{
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
}
}
void
Evdev3BEmuPreInit(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
emu3B->enabled = xf86SetBoolOption(pInfo->options,
"EmulateThirdButton",
FALSE);
emu3B->timeout = xf86SetIntOption(pInfo->options,
"EmulateThirdButtonTimeout",
1000);
emu3B->button = xf86SetIntOption(pInfo->options,
"EmulateThirdButtonButton",
3);
/* FIXME: this should be auto-configured based on axis ranges */
emu3B->threshold = xf86SetIntOption(pInfo->options,
"EmulateThirdButtonMoveThreshold",
DEFAULT_MOVE_THRESHOLD);
/* allocate now so we don't allocate in the signal handler */
emu3B->timer = TimerSet(NULL, 0, 0, NULL, NULL);
}
void
Evdev3BEmuOn(InputInfoPtr pInfo)
{
/* This function just exists for symmetry in evdev.c */
}
void
Evdev3BEmuFinalize(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
TimerFree(emu3B->timer);
emu3B->timer = NULL;
}
static int
Evdev3BEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
BOOL checkonly)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
if (atom == prop_3bemu)
{
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
if (!checkonly)
emu3B->enabled = *((BOOL*)val->data);
} else if (atom == prop_3btimeout)
{
if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
if (!checkonly)
emu3B->timeout = *((CARD32*)val->data);
} else if (atom == prop_3bbutton)
{
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
if (!checkonly)
emu3B->button = *((CARD8*)val->data);
} else if (atom == prop_3bthreshold)
{
if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
if (!checkonly)
emu3B->threshold = *((CARD32*)val->data);
}
return Success;
}
/**
* Initialise properties for third button emulation
*/
void
Evdev3BEmuInitProperty(DeviceIntPtr dev)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
int rc;
if (!dev->button) /* don't init prop for keyboards */
return;
/* third button emulation on/off */
prop_3bemu = MakeAtom(EVDEV_PROP_THIRDBUTTON, strlen(EVDEV_PROP_THIRDBUTTON), TRUE);
rc = XIChangeDeviceProperty(dev, prop_3bemu, XA_INTEGER, 8,
PropModeReplace, 1,
&emu3B->enabled,
FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_3bemu, FALSE);
/* third button emulation timeout */
prop_3btimeout = MakeAtom(EVDEV_PROP_THIRDBUTTON_TIMEOUT,
strlen(EVDEV_PROP_THIRDBUTTON_TIMEOUT),
TRUE);
rc = XIChangeDeviceProperty(dev, prop_3btimeout, XA_INTEGER, 32, PropModeReplace, 1,
&emu3B->timeout, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_3btimeout, FALSE);
/* third button emulation button to be triggered */
prop_3bbutton = MakeAtom(EVDEV_PROP_THIRDBUTTON_BUTTON,
strlen(EVDEV_PROP_THIRDBUTTON_BUTTON),
TRUE);
rc = XIChangeDeviceProperty(dev, prop_3bbutton, XA_INTEGER, 8, PropModeReplace, 1,
&emu3B->button, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_3bbutton, FALSE);
/* third button emulation movement threshold */
prop_3bthreshold = MakeAtom(EVDEV_PROP_THIRDBUTTON_THRESHOLD,
strlen(EVDEV_PROP_THIRDBUTTON_THRESHOLD),
TRUE);
rc = XIChangeDeviceProperty(dev, prop_3bthreshold, XA_INTEGER, 32, PropModeReplace, 1,
&emu3B->threshold, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_3bthreshold, FALSE);
XIRegisterPropertyHandler(dev, Evdev3BEmuSetProperty, NULL, NULL);
}

471
src/emuWheel.c Normal file
View File

@@ -0,0 +1,471 @@
/*
* 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
* (Ported from xf86-input-mouse, above copyrights taken from there)
* 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
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of the authors
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. The authors make 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.
*
*/
/* Mouse wheel emulation code. */
#include "config.h"
#include "evdev.h"
#include <X11/Xatom.h>
#include <xf86.h>
#include <xf86Xinput.h>
#include <exevents.h>
#include <evdev-properties.h>
#define WHEEL_NOT_CONFIGURED 0
static Atom prop_wheel_emu = 0;
static Atom prop_wheel_axismap = 0;
static Atom prop_wheel_inertia = 0;
static Atom prop_wheel_timeout = 0;
static Atom prop_wheel_button = 0;
/* Local Function Prototypes */
static int EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value);
/* Filter mouse button events */
BOOL
EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
int ms;
/* Has wheel emulation been configured to be enabled? */
if (!pEvdev->emulateWheel.enabled)
return FALSE;
/* Check for EmulateWheelButton */
if (pEvdev->emulateWheel.button == button) {
pEvdev->emulateWheel.button_state = value;
if (value)
/* Start the timer when the button is pressed */
pEvdev->emulateWheel.expires = pEvdev->emulateWheel.timeout +
GetTimeInMillis();
else {
ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
if (ms > 0) {
/*
* If the button is released early enough emit the button
* press/release events
*/
EvdevQueueButtonClicks(pInfo, button, 1);
}
}
return TRUE;
}
/* Don't care about this event */
return FALSE;
}
/* Filter mouse wheel events */
BOOL
EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
WheelAxisPtr pAxis = NULL;
int value = pEv->value;
/* Has wheel emulation been configured to be enabled? */
if (!pEvdev->emulateWheel.enabled)
return FALSE;
/* Handle our motion events if the emuWheel button is pressed
* wheel button of 0 means always emulate wheel.
*/
if (pEvdev->emulateWheel.button_state || !pEvdev->emulateWheel.button) {
/* Just return if the timeout hasn't expired yet */
if (pEvdev->emulateWheel.button)
{
int ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
if (ms > 0)
return TRUE;
}
if(pEv->type == EV_ABS) {
int axis = pEvdev->abs_axis_map[pEv->code];
int oldValue;
if (axis > -1 && valuator_mask_fetch(pEvdev->old_vals, axis, &oldValue)) {
valuator_mask_set(pEvdev->abs_vals, axis, value);
value -= oldValue; /* make value into a differential measurement */
} else
value = 0; /* avoid a jump on the first touch */
}
switch(pEv->code) {
/* ABS_X has the same value as REL_X, so this case catches both */
case REL_X:
pAxis = &(pEvdev->emulateWheel.X);
break;
/* ABS_Y has the same value as REL_Y, so this case catches both */
case REL_Y:
pAxis = &(pEvdev->emulateWheel.Y);
break;
default:
break;
}
/* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
wheel.
*/
if (pAxis)
EvdevWheelEmuInertia(pInfo, pAxis, value);
/* Eat motion events while emulateWheel button pressed. */
return TRUE;
}
return FALSE;
}
/* Simulate inertia for our emulated mouse wheel.
Returns the number of wheel events generated.
*/
static int
EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
int button;
int inertia;
int rc = 0;
/* if this axis has not been configured, just eat the motion */
if (!axis->up_button)
return rc;
axis->traveled_distance += value;
if (axis->traveled_distance < 0) {
button = axis->up_button;
inertia = -pEvdev->emulateWheel.inertia;
} else {
button = axis->down_button;
inertia = pEvdev->emulateWheel.inertia;
}
/* Produce button press events for wheel motion */
while(abs(axis->traveled_distance) > pEvdev->emulateWheel.inertia) {
axis->traveled_distance -= inertia;
EvdevQueueButtonClicks(pInfo, button, 1);
rc++;
}
return rc;
}
/* Handle button mapping here to avoid code duplication,
returns true if a button mapping was found. */
static BOOL
EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis,
const char *axis_name)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
char *option_string;
pAxis->up_button = WHEEL_NOT_CONFIGURED;
/* Check to see if there is configuration for this axis */
option_string = xf86SetStrOption(pInfo->options, axis_name, NULL);
if (option_string) {
int up_button = 0;
int down_button = 0;
char *msg = NULL;
if ((sscanf(option_string, "%d %d", &up_button, &down_button) == 2) &&
((up_button > 0) && (up_button <= EVDEV_MAXBUTTONS)) &&
((down_button > 0) && (down_button <= EVDEV_MAXBUTTONS))) {
msg = strdup("buttons XX and YY");
if (msg)
sprintf(msg, "buttons %d and %d", up_button, down_button);
pAxis->up_button = up_button;
pAxis->down_button = down_button;
/* Update the number of buttons if needed */
if (up_button > pEvdev->num_buttons) pEvdev->num_buttons = up_button;
if (down_button > pEvdev->num_buttons) pEvdev->num_buttons = down_button;
} else {
xf86IDrvMsg(pInfo, X_WARNING, "Invalid %s value:\"%s\"\n",
axis_name, option_string);
}
free(option_string);
/* Clean up and log what happened */
if (msg) {
xf86IDrvMsg(pInfo, X_CONFIG, "%s: %s\n", axis_name, msg);
free(msg);
return TRUE;
}
}
return FALSE;
}
/* Setup the basic configuration options used by mouse wheel emulation */
void
EvdevWheelEmuPreInit(InputInfoPtr pInfo)
{
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
int wheelButton;
int inertia;
int timeout;
if (xf86SetBoolOption(pInfo->options, "EmulateWheel", FALSE)) {
pEvdev->emulateWheel.enabled = TRUE;
} else
pEvdev->emulateWheel.enabled = FALSE;
wheelButton = xf86SetIntOption(pInfo->options, "EmulateWheelButton", 4);
if ((wheelButton < 0) || (wheelButton > EVDEV_MAXBUTTONS)) {
xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelButton value: %d\n",
wheelButton);
xf86IDrvMsg(pInfo, X_WARNING, "Wheel emulation disabled.\n");
pEvdev->emulateWheel.enabled = FALSE;
}
pEvdev->emulateWheel.button = wheelButton;
inertia = xf86SetIntOption(pInfo->options, "EmulateWheelInertia", 10);
if (inertia <= 0) {
xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelInertia value: %d\n",
inertia);
xf86IDrvMsg(pInfo, X_WARNING, "Using built-in inertia value.\n");
inertia = 10;
}
pEvdev->emulateWheel.inertia = inertia;
timeout = xf86SetIntOption(pInfo->options, "EmulateWheelTimeout", 200);
if (timeout < 0) {
xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelTimeout value: %d\n",
timeout);
xf86IDrvMsg(pInfo, X_WARNING, "Using built-in timeout value.\n");
timeout = 200;
}
pEvdev->emulateWheel.timeout = timeout;
/* Configure the Y axis or default it */
if (!EvdevWheelEmuHandleButtonMap(pInfo, &(pEvdev->emulateWheel.Y),
"YAxisMapping")) {
/* Default the Y axis to sane values */
pEvdev->emulateWheel.Y.up_button = 4;
pEvdev->emulateWheel.Y.down_button = 5;
/* Simpler to check just the largest value in this case */
/* XXX: we should post this to the server */
if (5 > pEvdev->num_buttons)
pEvdev->num_buttons = 5;
/* Display default Configuration */
xf86IDrvMsg(pInfo, X_CONFIG, "YAxisMapping: buttons %d and %d\n",
pEvdev->emulateWheel.Y.up_button,
pEvdev->emulateWheel.Y.down_button);
}
/* This axis should default to an unconfigured state as most people
are not going to expect a Horizontal wheel. */
EvdevWheelEmuHandleButtonMap(pInfo, &(pEvdev->emulateWheel.X),
"XAxisMapping");
/* Used by the inertia code */
pEvdev->emulateWheel.X.traveled_distance = 0;
pEvdev->emulateWheel.Y.traveled_distance = 0;
xf86IDrvMsg(pInfo, X_CONFIG,
"EmulateWheelButton: %d, "
"EmulateWheelInertia: %d, "
"EmulateWheelTimeout: %d\n",
pEvdev->emulateWheel.button, inertia, timeout);
}
static int
EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
BOOL checkonly)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
if (atom == prop_wheel_emu)
{
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
if (!checkonly)
{
pEvdev->emulateWheel.enabled = *((BOOL*)val->data);
/* Don't enable with zero inertia, otherwise we may get stuck in an
* infinite loop */
if (pEvdev->emulateWheel.inertia <= 0)
{
pEvdev->emulateWheel.inertia = 10;
/* We may get here before the property is actually enabled */
if (prop_wheel_inertia)
XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER,
16, PropModeReplace, 1,
&pEvdev->emulateWheel.inertia, TRUE);
}
}
}
else if (atom == prop_wheel_button)
{
int bt;
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
bt = *((CARD8*)val->data);
if (bt < 0 || bt >= EVDEV_MAXBUTTONS)
return BadValue;
if (!checkonly)
pEvdev->emulateWheel.button = bt;
} else if (atom == prop_wheel_axismap)
{
if (val->format != 8 || val->size != 4 || val->type != XA_INTEGER)
return BadMatch;
if (!checkonly)
{
pEvdev->emulateWheel.X.up_button = *((CARD8*)val->data);
pEvdev->emulateWheel.X.down_button = *(((CARD8*)val->data) + 1);
pEvdev->emulateWheel.Y.up_button = *(((CARD8*)val->data) + 2);
pEvdev->emulateWheel.Y.down_button = *(((CARD8*)val->data) + 3);
}
} else if (atom == prop_wheel_inertia)
{
int inertia;
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
inertia = *((CARD16*)val->data);
if (inertia <= 0)
return BadValue;
if (!checkonly)
pEvdev->emulateWheel.inertia = inertia;
} else if (atom == prop_wheel_timeout)
{
int timeout;
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
return BadMatch;
timeout = *((CARD16*)val->data);
if (timeout < 0)
return BadValue;
if (!checkonly)
pEvdev->emulateWheel.timeout = timeout;
}
return Success;
}
void
EvdevWheelEmuInitProperty(DeviceIntPtr dev)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
int rc = TRUE;
char vals[4];
if (!dev->button) /* don't init prop for keyboards */
return;
prop_wheel_emu = MakeAtom(EVDEV_PROP_WHEEL, strlen(EVDEV_PROP_WHEEL), TRUE);
rc = XIChangeDeviceProperty(dev, prop_wheel_emu, XA_INTEGER, 8,
PropModeReplace, 1,
&pEvdev->emulateWheel.enabled, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_wheel_emu, FALSE);
vals[0] = pEvdev->emulateWheel.X.up_button;
vals[1] = pEvdev->emulateWheel.X.down_button;
vals[2] = pEvdev->emulateWheel.Y.up_button;
vals[3] = pEvdev->emulateWheel.Y.down_button;
prop_wheel_axismap = MakeAtom(EVDEV_PROP_WHEEL_AXES, strlen(EVDEV_PROP_WHEEL_AXES), TRUE);
rc = XIChangeDeviceProperty(dev, prop_wheel_axismap, XA_INTEGER, 8,
PropModeReplace, 4, vals, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_wheel_axismap, FALSE);
prop_wheel_inertia = MakeAtom(EVDEV_PROP_WHEEL_INERTIA, strlen(EVDEV_PROP_WHEEL_INERTIA), TRUE);
rc = XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER, 16,
PropModeReplace, 1,
&pEvdev->emulateWheel.inertia, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_wheel_inertia, FALSE);
prop_wheel_timeout = MakeAtom(EVDEV_PROP_WHEEL_TIMEOUT, strlen(EVDEV_PROP_WHEEL_TIMEOUT), TRUE);
rc = XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16,
PropModeReplace, 1,
&pEvdev->emulateWheel.timeout, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_wheel_timeout, FALSE);
prop_wheel_button = MakeAtom(EVDEV_PROP_WHEEL_BUTTON, strlen(EVDEV_PROP_WHEEL_BUTTON), TRUE);
rc = XIChangeDeviceProperty(dev, prop_wheel_button, XA_INTEGER, 8,
PropModeReplace, 1,
&pEvdev->emulateWheel.button, FALSE);
if (rc != Success)
return;
XISetDevicePropertyDeletable(dev, prop_wheel_button, FALSE);
XIRegisterPropertyHandler(dev, EvdevWheelEmuSetProperty, NULL, NULL);
}

File diff suppressed because it is too large Load Diff

View File

@@ -25,39 +25,158 @@
* Kristian Høgsberg (krh@redhat.com) * Kristian Høgsberg (krh@redhat.com)
* Adam Jackson (ajax@redhat.com) * Adam Jackson (ajax@redhat.com)
* Peter Hutterer (peter@cs.unisa.edu.au) * Peter Hutterer (peter@cs.unisa.edu.au)
* Oliver McFadden (oliver.mcfadden@nokia.com)
*/ */
#include "config.h"
#ifndef EVDEV_H #ifndef EVDEV_H
#define EVDEV_H #define EVDEV_H
#include <linux/input.h> #include <linux/input.h>
#include <sys/types.h>
/* Tolerate prior #include <linux/input.h> */
#undef BUS_NONE
#undef BUS_PCI
#undef BUS_SBUS
#undef BUS_PLATFORM
#undef BUS_USB
#include <xorg-server.h>
#include <xf86Xinput.h> #include <xf86Xinput.h>
#include <xf86_OSproc.h> #include <xf86_OSproc.h>
#include <xkbstr.h>
#if defined(XKB) #include <mtdev.h>
/* XXX VERY WRONG. this is a client side header. */
#include <X11/extensions/XKBstr.h> #include <libevdev/libevdev.h>
#ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */
#define EV_CNT (EV_MAX+1)
#endif #endif
#ifndef KEY_CNT
#define KEY_CNT (KEY_MAX+1)
#endif
#ifndef REL_CNT
#define REL_CNT (REL_MAX+1)
#endif
#ifndef ABS_CNT
#define ABS_CNT (ABS_MAX+1)
#endif
#ifndef LED_CNT
#define LED_CNT (LED_MAX+1)
#endif
#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 */
#ifndef MAX_VALUATORS
#define MAX_VALUATORS 36
#endif
#ifndef XI_PROP_DEVICE_NODE
#define XI_PROP_DEVICE_NODE "Device Node"
#endif
#define LONG_BITS (sizeof(long) * 8)
/* Number of longs needed to hold the given number of bits */
#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
#define DEFAULT_MOUSE_DPI 1000.0
/* Function key mode */
enum fkeymode {
FKEYMODE_UNKNOWN = 0,
FKEYMODE_FKEYS, /* function keys send function keys */
FKEYMODE_MMKEYS, /* function keys send multimedia keys */
};
enum SlotState {
SLOTSTATE_OPEN = 8,
SLOTSTATE_CLOSE,
SLOTSTATE_UPDATE,
SLOTSTATE_EMPTY,
};
enum ButtonAction {
BUTTON_RELEASE = 0,
BUTTON_PRESS = 1
};
/* axis specific data for wheel emulation */
typedef struct {
int up_button;
int down_button;
int traveled_distance;
} WheelAxis, *WheelAxisPtr;
/* Event queue used to defer keyboard/button events until EV_SYN time. */
typedef struct {
enum {
EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */
EV_QUEUE_BTN, /* xf86PostButtonEvent() */
EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */
EV_QUEUE_TOUCH, /*xf86PostTouchEvent() */
} type;
union {
int key; /* May be either a key code or button number. */
unsigned int touch; /* Touch ID */
} detail;
int val; /* State of the key/button/touch; pressed or released. */
ValuatorMask *touchMask;
} EventQueueRec, *EventQueuePtr;
typedef struct { typedef struct {
int kernel24; struct libevdev *dev;
int screen;
int min_x, min_y, max_x, max_y; char *device;
int abs_x, abs_y, old_x, old_y; int grabDevice; /* grab the event device? */
int num_vals; /* number of valuators */
int num_mt_vals; /* number of multitouch valuators */
int abs_axis_map[ABS_CNT]; /* Map evdev ABS_* to index */
int rel_axis_map[REL_CNT]; /* Map evdev REL_* to index */
ValuatorMask *abs_vals; /* values for absolute axis */
ValuatorMask *rel_vals; /* values for relative axis */
ValuatorMask *old_vals; /* old absolute values for calculating relative motion */
ValuatorMask *prox; /* last absolute values set while not in proximity */
ValuatorMask *mt_mask;
ValuatorMask **last_mt_vals;
int cur_slot;
struct slot {
int dirty;
enum SlotState state;
} *slots;
struct mtdev *mtdev;
BOOL fake_mt;
int flags; int flags;
int tool; int in_proximity; /* device in proximity */
int use_proximity; /* using the proximity bit? */
int num_buttons; /* number of buttons */
BOOL swap_axes;
BOOL invert_x;
BOOL invert_y;
int resolution;
unsigned int abs_queued, rel_queued, prox_queued;
/* XKB stuff has to be per-device rather than per-driver */
int noXkb;
#ifdef XKB
char *xkb_rules;
char *xkb_model;
char *xkb_layout;
char *xkb_variant;
char *xkb_options;
XkbComponentNamesRec xkbnames;
#endif
/* Middle mouse button emulation */ /* Middle mouse button emulation */
struct { struct {
BOOL enabled; BOOL enabled;
@@ -66,16 +185,110 @@ typedef struct {
int state; /* state machine (see bt3emu.c) */ int state; /* state machine (see bt3emu.c) */
Time expires; /* time of expiry */ Time expires; /* time of expiry */
Time timeout; Time timeout;
uint8_t button; /* phys button to emit */
} emulateMB; } emulateMB;
/* Third mouse button emulation */
struct emulate3B {
BOOL enabled;
BOOL state; /* current state */
Time timeout; /* timeout until third button press */
int buttonstate; /* phys. button state */
int button; /* phys button to emit */
int threshold; /* move threshold in dev coords */
OsTimerPtr timer;
double delta[2]; /* delta x/y, accumulating */
int startpos[2]; /* starting pos for abs devices */
int flags; /* remember if we had rel or abs movement */
} emulate3B;
struct {
int meta; /* meta key to lock any button */
BOOL meta_state; /* meta_button state */
unsigned int lock_pair[EVDEV_MAXBUTTONS]; /* specify a meta/lock pair */
BOOL lock_state[EVDEV_MAXBUTTONS]; /* state of any locked buttons */
} dragLock;
struct {
BOOL enabled;
int button;
int button_state;
int inertia;
WheelAxis X;
WheelAxis Y;
Time expires; /* time of expiry */
Time timeout;
} emulateWheel;
struct {
int vert_delta;
int horiz_delta;
int dial_delta;
} smoothScroll;
/* run-time calibration */
struct {
int min_x;
int max_x;
int min_y;
int max_y;
} calibration;
unsigned char btnmap[32]; /* config-file specified button mapping */
int reopen_attempts; /* max attempts to re-open after read failure */
int reopen_left; /* number of attempts left to re-open the device */
OsTimerPtr reopen_timer;
/* minor/major number */
dev_t min_maj;
/* Event queue used to defer keyboard/button events until EV_SYN time. */
int num_queue;
EventQueueRec queue[EVDEV_MAXQUEUE];
enum fkeymode fkeymode;
char *type_name;
} EvdevRec, *EvdevPtr; } EvdevRec, *EvdevPtr;
/* Event posting functions */
void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch,
ValuatorMask *mask, uint16_t type);
void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act);
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo);
void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo);
unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code);
/* Middle Button emulation */ /* Middle Button emulation */
int EvdevMBEmuTimer(InputInfoPtr); int EvdevMBEmuTimer(InputInfoPtr);
BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL); BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
void EvdevMBEmuWakeupHandler(pointer, int, pointer); void EvdevMBEmuWakeupHandler(void *data, int i);
void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer); void EvdevMBEmuBlockHandler(void *data, void *waitTime);
void EvdevMBEmuPreInit(InputInfoPtr); void EvdevMBEmuPreInit(InputInfoPtr);
void EvdevMBEmuOn(InputInfoPtr);
void EvdevMBEmuFinalize(InputInfoPtr); void EvdevMBEmuFinalize(InputInfoPtr);
void EvdevMBEmuEnable(InputInfoPtr, BOOL);
/* Third button emulation */
CARD32 Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, void *arg);
BOOL Evdev3BEmuFilterEvent(InputInfoPtr, int, BOOL);
void Evdev3BEmuPreInit(InputInfoPtr pInfo);
void Evdev3BEmuOn(InputInfoPtr);
void Evdev3BEmuFinalize(InputInfoPtr);
void Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy);
void Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals);
/* Mouse Wheel emulation */
void EvdevWheelEmuPreInit(InputInfoPtr pInfo);
BOOL EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value);
BOOL EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv);
/* Draglock code */
void EvdevDragLockPreInit(InputInfoPtr pInfo);
BOOL EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value);
void EvdevMBEmuInitProperty(DeviceIntPtr);
void Evdev3BEmuInitProperty(DeviceIntPtr);
void EvdevWheelEmuInitProperty(DeviceIntPtr);
void EvdevDragLockInitProperty(DeviceIntPtr);
void EvdevAppleInitProperty(DeviceIntPtr);
#endif #endif