Commit Graph

64 Commits

Author SHA1 Message Date
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
aa5dfa1d6a Remove useless include directive.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-02-16 13:19:45 +10: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
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
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
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
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
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
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
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
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
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
Søren Hauberg
3985d42320 Add support for axis inversion. 2008-10-03 14:41:58 +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
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
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