aboutsummaryrefslogtreecommitdiff
path: root/src/evdev.h
Commit message (Collapse)AuthorAge
* code-remap for 2.8.0code-remap-2.8.0Gianni Ceccarelli2013-03-26
|
* Split rel and abs axis mapping into two separate arraysPeter Hutterer2013-01-23
| | | | | | | 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>
* Localise XKB initializationPeter Hutterer2013-01-08
| | | | | | No need to store this in the evdev struct. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Use LogMessageVerbSigSafe if availablePeter Hutterer2012-08-10
| | | | | | | | 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>
* Fix buffer overrun when populating axis label property arrayChase Douglas2012-06-07
| | | | | | | | | | 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>
* Copy last valuator values into new touch valuator masksChase Douglas2012-01-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Remove redundant redeclaration of Evdev3BEmuPreInitJeremy Huddleston2011-12-31
| | | | | Found-by: Tinderbox Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
* Require xserver 1.12 RC1Peter Hutterer2011-12-29
| | | | | | | 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>
* Remove need for --enable-multitouchPeter Hutterer2011-12-24
| | | | | | | | 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>
* Include config.h from evdev.hPeter Hutterer2011-12-24
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Always include mt_mask in the evdev structPeter Hutterer2011-12-24
| | | | | | | | | | | 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>
* Replace 0/1 button values with enumsPeter Hutterer2011-11-11
| | | | | | 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>
* Skip event posting for empty slots.Peter Hutterer2011-11-11
| | | | | | | | | | | | | | | | | | | | 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>
* Replace open_slot/close_slot with a SlotState enumPeter Hutterer2011-11-11
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Use MTDev for multitouch devicesChase Douglas2011-11-11
| | | | | | | | 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>
* Add experimental XI 2.1 multitouch supportChase Douglas2011-11-11
| | | | | | | | | | | | 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>
* Support smooth scrolling on REL_WHEEL, REL_HWHEEL and REL_DIALPeter Hutterer2011-11-09
| | | | | | | | | | 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>
* Require server 1.10Peter Hutterer2011-06-15
| | | | | | | | | 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>
* Export device node as property.Peter Hutterer2011-05-27
| | | | | | | | | | | | | 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>
* Add a property to toggle function key modePeter Hutterer2011-05-27
| | | | | | | | | | | | | | | | | | | | | 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>
* Export product/vendor ID through a property.Peter Hutterer2011-05-27
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
* Remove constness of device filename to avoid warning when freed.Rami Ylimäki2011-03-09
| | | | | | | | | 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>
* Add third button emulation.Peter Hutterer2011-02-08
| | | | | | | | | | | | 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>
* Add support for masked valuatorsChase Douglas2011-01-25
| | | | | | | | 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>
* Remove support for X input ABI < 12.2Chase Douglas2011-01-24
| | | | | Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add use_proximity bit for BTN_TOOL handling.Peter Hutterer2010-12-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Rename proximity to in_proximity.Peter Hutterer2010-12-22
| | | | | | | | 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>
* Rename abs/rel/prox to abs_queued/rel_queued/prox_queued.Peter Hutterer2010-10-21
| | | | | | | | | 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>
* Add proximity support.Peter Hutterer2010-10-18
| | | | | | | | | | | | | | | | | | | | | 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>
* Rename evdev->tool to evdev->proximity.Peter Hutterer2010-10-13
| | | | | | | | | 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>
* Don't pass pointers around to first_v and num_v.Peter Hutterer2010-10-11
| | | | | | | 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>
* Disable middle mouse button emulation by default.Peter Hutterer2010-05-31
| | | | | | | | | | | | | | | | | | | | | | | 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>
* config: remove AH_TOP autoheader statement.Peter Hutterer2010-04-29
| | | | | | | | | 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>
* emuMB: default to disabled mouse button emulation for touchscreens.Oliver McFadden2010-02-25
| | | | | | | | | | | | | | 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>
* Fix a comment, EV_CNT is available since 2.6.24Peter Hutterer2009-12-01
| | | | | | Introduced in the kernel as 2.6.23-6147-g7b19ada. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add EvdevPostButtonEvent API to immediately post a button event (#23269)Peter Hutterer2009-08-14
| | | | | | | | | | | | | | | | 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>
* Rename parts of the Post API to a Queue API.Peter Hutterer2009-08-13
| | | | | | | | | | 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>
* evdev: Use the EvdevPost...Event() functions in the emulation code.Oliver McFadden2009-08-04
| | | | | | | | | | | | | | | | | | This is similar to commit 1f641d75edba7394201c1c53938215bae696791b. 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>
* evdev: Only send the events at synchronization time.Oliver McFadden2009-07-29
| | | | | | | | | | | | | | | | | | | 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>
* Rename pEvdev->buttons to pEvdev->num_buttons for clarity.Peter Hutterer2009-05-21
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Define MAX_VALUATORS if it's missing to allow for builds against 1.5.Peter Hutterer2009-03-09
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Revert "Remove useless include directive."Peter Hutterer2009-02-19
| | | | | | | | Necessary for builds against 1.6, but let's at least get rid of XKB defines. This reverts commit aa5dfa1d6ae374479d39f1394b85660e6b6bb881. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* General axis valuator support.Matt Helsley2009-02-16
| | | | | | | | | 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>
* Change cached bitmasks from long to unsigned long.Peter Hutterer2009-02-16
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Remove unused 'screen' variable from the EvdevRec.Peter Hutterer2009-02-16
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Remove useless include directive.Peter Hutterer2009-02-16
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Deal with XINPUT ABI 5.Peter Hutterer2009-01-22
| | | | Some XKB stuff has been removed, so let's deal with it.
* Require XKB.Peter Hutterer2009-01-22
| | | | | | Welcome to the future. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* Fix FOO_MAX off-by-oneMatt Helsley2009-01-12
| | | | | | | | | | | | | | | | | 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>
* rename NBITS to NLONGS to reflect its actual meaningMatt Helsley2009-01-12
| | | | | | | | | 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>