Commit Graph

111 Commits

Author SHA1 Message Date
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
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
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
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
0ab4c09e50 Silence compiler warning by memsetting the struct properly. 2008-10-23 14:05:41 +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
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
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
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
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
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
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
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