From 59056e656c6475816ab45b2798bd4d4466482f6a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 13 Oct 2009 14:51:49 +1000 Subject: 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 --- man/evdev.man | 4 ---- 1 file changed, 4 deletions(-) (limited to 'man/evdev.man') diff --git a/man/evdev.man b/man/evdev.man index 9dd7a77..4771167 100644 --- a/man/evdev.man +++ b/man/evdev.man @@ -151,10 +151,6 @@ 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 \*qReopenAttempts\*q \*q" integer \*q -Number of reopen attempts after a read error occurs on the device (e.g. after -waking up from suspend). In between each attempt is a 100ms wait. Default: 10. -.TP 7 .BI "Option \*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 -- cgit v1.2.3 From e81cd935cfff18d3c387eed3e8083977c19c92f0 Mon Sep 17 00:00:00 2001 From: Andrej Gelenberg Date: Tue, 12 Jan 2010 11:22:16 +0100 Subject: 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 --- configure.ac | 3 +++ man/evdev.man | 5 +++++ src/evdev.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 62 insertions(+), 2 deletions(-) (limited to 'man/evdev.man') diff --git a/configure.ac b/configure.ac index 9d8d0a7..759c1ae 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,9 @@ AC_ARG_WITH(xorg-module-dir, inputdir=${moduledir}/input AC_SUBST(inputdir) +# Checks for extensions +XORG_DRIVER_CHECK_EXT(XINPUT, inputproto) + # Checks for pkg-config packages. We need to be able to override sdkdir # to satisfy silly distcheck requirements. PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES) diff --git a/man/evdev.man b/man/evdev.man index 4771167..bc2ee97 100644 --- a/man/evdev.man +++ b/man/evdev.man @@ -159,6 +159,11 @@ 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 diff --git a/src/evdev.c b/src/evdev.c index 7e65c69..58ffcea 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -32,6 +32,7 @@ #endif #include +#include #include #include @@ -92,6 +93,7 @@ #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 */ #define MIN_KEYCODE 8 #define GLYPHS_PER_KEY 2 @@ -117,6 +119,7 @@ static const char *evdevDefaults[] = { static int EvdevOn(DeviceIntPtr); static int EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare); static void EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl); +static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode); #ifdef HAVE_PROPERTIES static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms); @@ -136,6 +139,38 @@ static Atom prop_btn_label = 0; * cannot be used by evdev, leaving us with a space of 2 at the end. */ static EvdevPtr evdev_devices[MAXDEVICES] = {NULL}; +static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode) +{ + InputInfoPtr pInfo; + EvdevPtr pEvdev; + + pInfo = device->public.devicePrivate; + pEvdev = pInfo->private; + + if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) + { + if (mode == Relative) + return Success; + else + return XI_BadMode; + } + + switch (mode) { + case Absolute: + pEvdev->flags &= ~EVDEV_RELATIVE_MODE; + break; + + case Relative: + pEvdev->flags |= EVDEV_RELATIVE_MODE; + break; + + default: + return XI_BadMode; + } + + return Success; +} + static size_t CountBits(unsigned long *array, size_t nlongs) { unsigned int i; @@ -341,7 +376,7 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v, *num_v = *first_v = 0; /* convert to relative motion for touchpads */ - if (pEvdev->abs && (pEvdev->flags & EVDEV_TOUCHPAD)) { + if (pEvdev->abs && (pEvdev->flags & EVDEV_RELATIVE_MODE)) { if (pEvdev->tool) { /* meaning, touch is active */ if (pEvdev->old_vals[0] != -1) pEvdev->delta[REL_X] = pEvdev->vals[0] - pEvdev->old_vals[0]; @@ -1129,6 +1164,7 @@ EvdevAddAbsClass(DeviceIntPtr device) EvdevPtr pEvdev; int num_axes, axis, i = 0; Atom *atoms; + const char *mode; pInfo = device->public.devicePrivate; pEvdev = pInfo->private; @@ -1200,6 +1236,22 @@ EvdevAddAbsClass(DeviceIntPtr device) TestBit(ABS_TILT_Y, pEvdev->abs_bitmask))) pInfo->flags |= XI86_POINTER_CAPABLE; + if (pEvdev->flags & EVDEV_TOUCHPAD) + pEvdev->flags |= EVDEV_RELATIVE_MODE; + else + pEvdev->flags &= ~EVDEV_RELATIVE_MODE; + + if (xf86FindOption(pInfo->options, "Mode")) + { + mode = xf86SetStrOption(pInfo->options, "Mode", NULL); + if (!strcasecmp("absolute", mode)) + pEvdev->flags &= ~EVDEV_RELATIVE_MODE; + else if (!strcasecmp("relative", mode)) + pEvdev->flags |= EVDEV_RELATIVE_MODE; + else + xf86Msg(X_INFO, "%s: unknown mode, use default\n", pInfo->name); + } + return Success; } @@ -1966,7 +2018,7 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags) pInfo->history_size = 0; pInfo->control_proc = NULL; pInfo->close_proc = NULL; - pInfo->switch_mode = NULL; + pInfo->switch_mode = EvdevSwitchMode; pInfo->conversion_proc = NULL; pInfo->reverse_conversion_proc = NULL; pInfo->dev = NULL; -- cgit v1.2.3 From 99505011d124bef00acffb6ab07f6b765f5870b7 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 18 Feb 2010 19:01:51 +1000 Subject: man: fix man page formatting for option EmulateWheel. Signed-off-by: Peter Hutterer --- man/evdev.man | 1 + 1 file changed, 1 insertion(+) (limited to 'man/evdev.man') diff --git a/man/evdev.man b/man/evdev.man index bc2ee97..d832a4c 100644 --- a/man/evdev.man +++ b/man/evdev.man @@ -83,6 +83,7 @@ button event is registered. Property: "Evdev Middle Button Emulation". Sets the timeout (in milliseconds) that the driver waits before deciding if two buttons where pressed "simultaneously" when 3 button emulation is enabled. Default: 50. Property: "Evdev Middle Button Timeout". +.TP 7 .BI "Option \*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 -- cgit v1.2.3 From 801778c3106fc7e409369b4500253a38be6a5795 Mon Sep 17 00:00:00 2001 From: Oliver McFadden Date: Thu, 25 Feb 2010 07:11:21 +0200 Subject: 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 Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- man/evdev.man | 5 +++-- src/emuMB.c | 6 +++++- src/evdev.c | 14 -------------- src/evdev.h | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 17 deletions(-) (limited to 'man/evdev.man') diff --git a/man/evdev.man b/man/evdev.man index d832a4c..49ab12c 100644 --- a/man/evdev.man +++ b/man/evdev.man @@ -76,8 +76,9 @@ indicating that the next button pressed is to be .BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q Enable/disable the emulation of the third (middle) mouse button for mice which only have two physical buttons. The third button is emulated by -pressing both buttons simultaneously. Default: on, until a middle mouse -button event is registered. Property: "Evdev Middle Button Emulation". +pressing both buttons simultaneously. Default: off for touchscreens, otherwise +on until a middle mouse button event is registered. Property: "Evdev Middle +Button Emulation". .TP 7 .BI "Option \*qEmulate3Timeout\*q \*q" integer \*q Sets the timeout (in milliseconds) that the driver waits before deciding diff --git a/src/emuMB.c b/src/emuMB.c index 199c0d7..113a708 100644 --- a/src/emuMB.c +++ b/src/emuMB.c @@ -309,7 +309,11 @@ void EvdevMBEmuPreInit(InputInfoPtr pInfo) { EvdevPtr pEvdev = (EvdevPtr)pInfo->private; - pEvdev->emulateMB.enabled = MBEMU_AUTO; + + if (pEvdev->flags & EVDEV_TOUCHSCREEN) + pEvdev->emulateMB.enabled = MBEMU_DISABLED; + else + pEvdev->emulateMB.enabled = MBEMU_AUTO; if (xf86FindOption(pInfo->options, "Emulate3Buttons")) { diff --git a/src/evdev.c b/src/evdev.c index 58ffcea..3051462 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -81,20 +81,6 @@ #define ArrayLength(a) (sizeof(a) / (sizeof((a)[0]))) -/* 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 */ - #define MIN_KEYCODE 8 #define GLYPHS_PER_KEY 2 #define AltMask Mod1Mask diff --git a/src/evdev.h b/src/evdev.h index 95d00db..1133985 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -57,6 +57,20 @@ #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 */ + #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3 #define HAVE_PROPERTIES 1 #endif -- cgit v1.2.3