[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-input-evdev: Changes to 'upstream-experimental'



Rebased ref, commits from common ancestor:
commit 990540fa1905b11403d5c25345c428c5bc9ed126
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Aug 23 10:34:36 2010 +1000

    evdev 2.5.0
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index cf494ca..116fa3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-evdev],
-        [2.4.99.901],
+        [2.5.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-evdev])
 AC_CONFIG_SRCDIR([Makefile.am])

commit b8945e61eb97265fdccace8411b8b33d3d56be13
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Aug 23 10:27:35 2010 +1000

    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>

diff --git a/man/evdev.man b/man/evdev.man
index 9b9a0ef..adb3f8d 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -238,5 +238,4 @@ value.
 .SH AUTHORS
 Kristian Høgsberg, Peter Hutterer
 .SH "SEE ALSO"
-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
-README.mouse.
+__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)

commit 97dc45b769c9a4dfa61782d7ce491df8ebaed3dc
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Aug 19 12:50:25 2010 +1000

    evdev 2.4.99.901
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 63460b7..cf494ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-evdev],
-        [2.4.99],
+        [2.4.99.901],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-evdev])
 AC_CONFIG_SRCDIR([Makefile.am])

commit ec6cb31cc47eed3ccba4c906ca6c54b99136e9eb
Author: Bartosz Brachaczek <b.brachaczek@gmail.com>
Date:   Tue Aug 10 22:31:37 2010 +0200

    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>

diff --git a/src/evdev.c b/src/evdev.c
index bdac330..512e957 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -661,7 +661,7 @@ static void
 EvdevProcessSyncEvent(InputInfoPtr pInfo, struct input_event *ev)
 {
     int num_v = 0, first_v = 0;
-    int v[MAX_VALUATORS];
+    int v[MAX_VALUATORS] = {};
     EvdevPtr pEvdev = pInfo->private;
 
     EvdevProcessValuators(pInfo, v, &num_v, &first_v);

commit ed47c7f33e315f163a6aebeb3e1c8947004576fd
Author: Bartosz Brachaczek <b.brachaczek@gmail.com>
Date:   Tue Aug 10 22:31:00 2010 +0200

    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 c1f16a4f59a584ab4546c2f16e20b06703042057.
    
    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>

diff --git a/src/evdev.c b/src/evdev.c
index 5ea230c..bdac330 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -386,7 +386,7 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
         for (i = 0; i < REL_CNT; i++)
         {
             int map = pEvdev->axis_map[i];
-            if (map != -1)
+            if (pEvdev->delta[i] && map != -1)
             {
                 v[map] = pEvdev->delta[i];
                 if (map < first)

commit 899218e18120918138f6d7420465763422d5b3b7
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Aug 9 13:01:11 2010 +1000

    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>

diff --git a/src/evdev.c b/src/evdev.c
index cd0fb6c..5ea230c 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -577,7 +577,6 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
             break;
 
         case BTN_TOUCH:
-            pEvdev->tool = value ? ev->code : 0;
             if (!(pEvdev->flags & (EVDEV_TOUCHSCREEN | EVDEV_TABLET)))
                 break;
             /* Treat BTN_TOUCH from devices that only have BTN_TOUCH as

commit 421585fda6ce67c209d43952109dda056ee40941
Author: Alex Warg <alexander.warg@os.inf.tu-dresden.de>
Date:   Wed Jun 30 10:33:46 2010 +1000

    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>

diff --git a/src/evdev.c b/src/evdev.c
index bd92d91..cd0fb6c 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1149,12 +1149,18 @@ EvdevAddAbsClass(DeviceIntPtr device)
     num_axes = CountBits(pEvdev->abs_bitmask, NLONGS(ABS_MAX));
     if (num_axes < 1)
         return !Success;
+
+    if (num_axes > MAX_VALUATORS) {
+        xf86Msg(X_WARNING, "%s: found %d axes, limiting to %d.\n", device->name, num_axes, MAX_VALUATORS);
+        num_axes = MAX_VALUATORS;
+    }
+
     pEvdev->num_vals = num_axes;
     memset(pEvdev->vals, 0, num_axes * sizeof(int));
     memset(pEvdev->old_vals, -1, num_axes * sizeof(int));
     atoms = malloc(pEvdev->num_vals * sizeof(Atom));
 
-    for (axis = ABS_X; axis <= ABS_MAX; axis++) {
+    for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) {
         pEvdev->axis_map[axis] = -1;
         if (!TestBit(axis, pEvdev->abs_bitmask))
             continue;
@@ -1270,11 +1276,16 @@ EvdevAddRelClass(DeviceIntPtr device)
     if (num_axes <= 0)
         return !Success;
 
+    if (num_axes > MAX_VALUATORS) {
+        xf86Msg(X_WARNING, "%s: found %d axes, limiting to %d.\n", device->name, num_axes, MAX_VALUATORS);
+        num_axes = MAX_VALUATORS;
+    }
+
     pEvdev->num_vals = num_axes;
     memset(pEvdev->vals, 0, num_axes * sizeof(int));
     atoms = malloc(pEvdev->num_vals * sizeof(Atom));
 
-    for (axis = REL_X; axis <= REL_MAX; axis++)
+    for (axis = REL_X; i < MAX_VALUATORS && axis <= REL_MAX; axis++)
     {
         pEvdev->axis_map[axis] = -1;
         /* We don't post wheel events, so ignore them here too */

commit 8697811f56160146981f2364d6e154b2c57f388e
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Jun 22 14:40:13 2010 +1000

    man: some minor fixes to man page.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/man/evdev.man b/man/evdev.man
index 504fdaf..9b9a0ef 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -19,15 +19,24 @@ evdev \- Generic Linux input driver
 .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.
+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, 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.
+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 __xconfigfile__ 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 __xconfigfile__(__filemansuffix__)) instead of manual
+per-device configuration. Devices configured in the
+__xconfigfile__(__filemansuffix__) are not hot-plug capable.
 .PP
 .SH SUPPORTED HARDWARE
 In general, any input device that the kernel has a driver for can be accessed

commit b06bffdc979eb7d1ebf10680bc9b11baf9bd34a0
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Jun 11 10:01:08 2010 +1000

    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>

diff --git a/man/evdev.man b/man/evdev.man
index 1a93483..504fdaf 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -227,7 +227,7 @@ value.
 1 16-bit positive value.
 
 .SH AUTHORS
-Kristian Høgsberg.
+Kristian Høgsberg, Peter Hutterer
 .SH "SEE ALSO"
 __xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
 README.mouse.

commit 9410e452d26aeb81fb6068ab83ffdcd5aca32f67
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Thu May 27 21:56:47 2010 -0400

    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>

diff --git a/configure.ac b/configure.ac
index aa7ba18..63460b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,9 +44,6 @@ m4_ifndef([XORG_MACROS_VERSION],
 XORG_MACROS_VERSION(1.8)
 XORG_DEFAULT_OPTIONS
 
-# Checks for programs.
-AC_PROG_INSTALL
-
 # Obtain compiler/linker options from server and required extensions
 PKG_CHECK_MODULES(XORG, xorg-server xproto inputproto)
 

commit 516e538da4c866dde12d747095fa1779fd4275c0
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Thu May 27 20:51:47 2010 -0400

    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>

diff --git a/configure.ac b/configure.ac
index 648804a..aa7ba18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,15 +38,14 @@ AM_MAINTAINER_MODE
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 
-# Initialize X.Org macros
+# 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.4 or later before running autoconf/autogen])])
-XORG_MACROS_VERSION(1.4)
+          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.8)
 XORG_DEFAULT_OPTIONS
 
 # Checks for programs.
 AC_PROG_INSTALL
-AC_PROG_SED
 
 # Obtain compiler/linker options from server and required extensions
 PKG_CHECK_MODULES(XORG, xorg-server xproto inputproto)
diff --git a/man/Makefile.am b/man/Makefile.am
index 4edafaa..0a7311e 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -22,31 +22,16 @@
 
 drivermandir = $(DRIVER_MAN_DIR)
 
-driverman_PRE = @DRIVER_NAME@.man
+driverman_PRE = $(DRIVER_NAME).man
 
-driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
+driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX))
 
-EXTRA_DIST = @DRIVER_NAME@.man
+EXTRA_DIST = $(DRIVER_NAME).man
 
 CLEANFILES = $(driverman_DATA)
 
-# 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
 
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
 .man.$(DRIVER_MAN_SUFFIX):
 	$(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@

commit 1f38e1bc1174a66980d4a7e8e0a36aef938625df
Author: Gaetan Nadon <memsize@videotron.ca>
Date:   Sat Jun 12 09:59:06 2010 -0400

    COPYING: update and refactor the Copyright notices
    
    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>

diff --git a/COPYING b/COPYING
index 99e5244..68e43fe 100644
--- a/COPYING
+++ b/COPYING
@@ -1,16 +1,21 @@
-Various copyright notices found in this driver:
-
-Copyright © 2004-2008 Red Hat, Inc.
+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
+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 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
+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,
@@ -42,34 +47,6 @@ 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 © 2008 University of South Australia
-copyrights taken from xf86-input-mouse, partly valid for this driver.
-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
-
-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.
-
-
 Copyright 2005 Adam Jackson.
 
 Permission is hereby granted, free of charge, to any person obtaining a

commit 456579ba30edbda8182cc8a7f6347e591d191bd0
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Jun 1 10:20:25 2010 +1000

    Bump to 2.4.99
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 80add52..648804a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-evdev],
-        [2.4.0],
+        [2.4.99],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-evdev])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 21a2ac818e75ef918d320ce1e88b6263e68e598d
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri May 28 09:47:17 2010 +1000

    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>

diff --git a/man/evdev.man b/man/evdev.man
index 49ab12c..1a93483 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -76,8 +76,7 @@ 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: off for touchscreens, otherwise
-on until a middle mouse button event is registered. Property: "Evdev Middle
+pressing both buttons simultaneously.  Default: off. Property: "Evdev Middle
 Button Emulation".
 .TP 7
 .BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
diff --git a/src/emuMB.c b/src/emuMB.c
index c33ea8e..764b30e 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -43,12 +43,6 @@
 
 #include <evdev-properties.h>
 
-enum {
-    MBEMU_DISABLED = 0,
-    MBEMU_ENABLED,
-    MBEMU_AUTO
-};
-
 #ifdef HAVE_PROPERTIES
 static Atom prop_mbemu     = 0; /* Middle button emulation on/off property */
 static Atom prop_mbtimeout = 0; /* Middle button timeout property */
@@ -232,11 +226,6 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
     if (!pEvdev->emulateMB.enabled)
         return ret;
 
-    if (button == 2) {
-        EvdevMBEmuEnable(pInfo, FALSE);
-        return ret;
-    }
-
     /* don't care about other buttons */
     if (button != 1 && button != 3)
         return ret;
@@ -311,20 +300,9 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)
 {
     EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
 
-    if (pEvdev->flags & EVDEV_TOUCHSCREEN)
-        pEvdev->emulateMB.enabled = MBEMU_DISABLED;
-    else
-        pEvdev->emulateMB.enabled = MBEMU_AUTO;
-
-    if (xf86FindOption(pInfo->options, "Emulate3Buttons"))
-    {
-        pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
-                                                      "Emulate3Buttons",
-                                                      MBEMU_ENABLED);
-        xf86Msg(X_INFO, "%s: Forcing middle mouse button emulation %s.\n",
-                pInfo->name, (pEvdev->emulateMB.enabled) ? "on" : "off");
-    }
-
+    pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
+                                                  "Emulate3Buttons",
+                                                  FALSE);
     pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
                                                  "Emulate3Timeout", 50);
 }
@@ -352,16 +330,6 @@ EvdevMBEmuFinalize(InputInfoPtr pInfo)
 
 }
 
-/* Enable/disable middle mouse button emulation. */
-void
-EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
-{
-    EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
-    if (pEvdev->emulateMB.enabled == MBEMU_AUTO)
-        pEvdev->emulateMB.enabled = enable;
-}
-
-
 #ifdef HAVE_PROPERTIES
 static int
 EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
diff --git a/src/evdev.h b/src/evdev.h
index 8c89f83..4945140 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -214,7 +214,6 @@ void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
 void EvdevMBEmuPreInit(InputInfoPtr);
 void EvdevMBEmuOn(InputInfoPtr);
 void EvdevMBEmuFinalize(InputInfoPtr);
-void EvdevMBEmuEnable(InputInfoPtr, BOOL);
 
 /* Mouse Wheel emulation */
 void EvdevWheelEmuPreInit(InputInfoPtr pInfo);

commit 4c216242404d749b9ae8ec181146689f89119cb4
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu May 20 12:40:13 2010 +1000

    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>

diff --git a/src/draglock.c b/src/draglock.c
index fad4436..af80cf6 100644
--- a/src/draglock.c
+++ b/src/draglock.c
@@ -146,7 +146,7 @@ EvdevDragLockPreInit(InputInfoPtr pInfo)
             next_num = NULL;
     }
 
-    xfree(option_string);
+    free(option_string);
 }
 
 /* Updates DragLock button state and fires button event messges */
diff --git a/src/emuWheel.c b/src/emuWheel.c
index 35e6931..9a53211 100644
--- a/src/emuWheel.c
+++ b/src/emuWheel.c
@@ -233,12 +233,12 @@ EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char* axis_
 	    xf86Msg(X_WARNING, "%s: Invalid %s value:\"%s\"\n",
 		    pInfo->name, axis_name, option_string);
 	}
-	xfree(option_string);
+	free(option_string);
 
 	/* Clean up and log what happened */
 	if (msg) {
 	    xf86Msg(X_CONFIG, "%s: %s: %s\n",pInfo->name, axis_name, msg);
-	    xfree(msg);
+	    free(msg);
 	    return TRUE;
 	}
     }
diff --git a/src/evdev.c b/src/evdev.c
index 0768bca..bd92d91 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -249,7 +249,7 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
 
     if ((s = xf86SetStrOption(pInfo->options, name, NULL))) {
         if (!s[0]) {
-            xfree(s);
+            free(s);
             *option = NULL;
         } else {
             *option = s;
@@ -1152,7 +1152,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
     pEvdev->num_vals = num_axes;
     memset(pEvdev->vals, 0, num_axes * sizeof(int));
     memset(pEvdev->old_vals, -1, num_axes * sizeof(int));
-    atoms = xalloc(pEvdev->num_vals * sizeof(Atom));
+    atoms = malloc(pEvdev->num_vals * sizeof(Atom));
 
     for (axis = ABS_X; axis <= ABS_MAX; axis++) {
         pEvdev->axis_map[axis] = -1;
@@ -1198,7 +1198,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
         pEvdev->old_vals[axnum] = -1;
     }
 
-    xfree(atoms);
+    free(atoms);
 
     if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
         return !Success;
@@ -1234,7 +1234,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
             pEvdev->flags |= EVDEV_RELATIVE_MODE;
         else
             xf86Msg(X_INFO, "%s: unknown mode, use default\n", pInfo->name);
-        xfree(mode);
+        free(mode);
     }
 
     return Success;
@@ -1272,7 +1272,7 @@ EvdevAddRelClass(DeviceIntPtr device)
 
     pEvdev->num_vals = num_axes;
     memset(pEvdev->vals, 0, num_axes * sizeof(int));
-    atoms = xalloc(pEvdev->num_vals * sizeof(Atom));
+    atoms = malloc(pEvdev->num_vals * sizeof(Atom));
 
     for (axis = REL_X; axis <= REL_MAX; axis++)
     {
@@ -1315,7 +1315,7 @@ EvdevAddRelClass(DeviceIntPtr device)
         xf86InitValuatorDefaults(device, axnum);
     }
 
-    xfree(atoms);
+    free(atoms);
 
     pInfo->flags |= XI86_POINTER_CAPABLE;
 
@@ -1332,7 +1332,7 @@ EvdevAddButtonClass(DeviceIntPtr device)
     pInfo = device->public.devicePrivate;
     pEvdev = pInfo->private;
 
-    labels = xalloc(pEvdev->num_buttons * sizeof(Atom));
+    labels = malloc(pEvdev->num_buttons * sizeof(Atom));
     EvdevInitButtonLabels(pEvdev, pEvdev->num_buttons, labels);
 
     if (!InitButtonClassDeviceStruct(device, pEvdev->num_buttons,
@@ -1342,7 +1342,7 @@ EvdevAddButtonClass(DeviceIntPtr device)
                                      pEvdev->btnmap))
         return !Success;
 
-    xfree(labels);
+    free(labels);
     return Success;
 }
 
@@ -1391,7 +1391,7 @@ EvdevInitButtonMapping(InputInfoPtr pInfo)
             pEvdev->btnmap[nbuttons++] = btn;
             map = s;
         }
-        xfree(mapping);
+        free(mapping);
     }
 
     for (i = nbuttons; i < ArrayLength(pEvdev->btnmap); i++)
@@ -1925,7 +1925,7 @@ EvdevProbe(InputInfoPtr pInfo)
             num_calibration = sscanf(str, "%d %d %d %d",
                     &calibration[0], &calibration[1],
                     &calibration[2], &calibration[3]);
-            xfree(str);
+            free(str);
             if (num_calibration == 4)
                 EvdevSetCalibration(pInfo, num_calibration, calibration);
             else
@@ -2068,7 +2068,7 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
     pInfo->conf_idev = dev;
     pInfo->private = NULL;
 
-    if (!(pEvdev = xcalloc(sizeof(EvdevRec), 1)))
+    if (!(pEvdev = calloc(sizeof(EvdevRec), 1)))
         goto error;
 
     pInfo->private = pEvdev;

commit 6e244b109861d6f602066cac8b766a55a5016c63
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu May 20 12:38:19 2010 +1000

    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>

diff --git a/src/evdev.c b/src/evdev.c
index 624f431..0768bca 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1139,7 +1139,6 @@ EvdevAddAbsClass(DeviceIntPtr device)
     EvdevPtr pEvdev;
     int num_axes, axis, i = 0;
     Atom *atoms;
-    const char *mode;
 
     pInfo = device->public.devicePrivate;
     pEvdev = pInfo->private;
@@ -1227,6 +1226,7 @@ EvdevAddAbsClass(DeviceIntPtr device)
 
     if (xf86FindOption(pInfo->options, "Mode"))
     {
+        char *mode;
         mode = xf86SetStrOption(pInfo->options, "Mode", NULL);
         if (!strcasecmp("absolute", mode))
             pEvdev->flags &= ~EVDEV_RELATIVE_MODE;

commit e7c301563a4b1718d2fc0066c1b3125404e3060f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu May 20 14:24:05 2010 +1000

    Move opening the device into a separate function.
    
    Re-use from EvdevOn and PreInit.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index e54a8ed..624f431 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -95,6 +95,7 @@ static void EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
 static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode);
 static BOOL EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab);
 static void EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4]);
+static BOOL EvdevOpenDevice(InputInfoPtr pInfo);
 
 #ifdef HAVE_PROPERTIES
 static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms);
@@ -1534,30 +1535,12 @@ EvdevOn(DeviceIntPtr device)
 
     pInfo = device->public.devicePrivate;
     pEvdev = pInfo->private;
-
-    if (pInfo->fd == -1) /* after PreInit fd is still open */
-    {
-        do {
-            pInfo->fd = open(pEvdev->device, O_RDWR | O_NONBLOCK, 0);
-        } while (pInfo->fd < 0 && errno == EINTR);
-
-        if (pInfo->fd < 0) {
-            xf86Msg(X_ERROR, "Unable to open evdev device \"%s\".\n",
-                    pEvdev->device);
-            return !Success;
-        }
-    }
+    /* after PreInit fd is still open */
+    if (!EvdevOpenDevice(pInfo))
+        return !Success;
 
     EvdevGrabDevice(pInfo, 1, 0);
 
-    pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
-    if (EvdevIsDuplicate(pInfo))
-    {
-        xf86Msg(X_WARNING, "%s: Refusing to enable duplicate device.\n",
-                pInfo->name);
-        return !Success;
-    }
-
     xf86FlushInput(pInfo->fd);
     xf86AddEnabledDevice(pInfo);
     EvdevMBEmuOn(pInfo);
@@ -2014,11 +1997,53 @@ EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4])
     }
 }
 
+static BOOL
+EvdevOpenDevice(InputInfoPtr pInfo)
+{
+    EvdevPtr pEvdev = pInfo->private;
+    char *device = (char*)pEvdev->device;
+
+    if (!device)
+    {
+        device = xf86CheckStrOption(pInfo->options, "Device", NULL);
+        if (!device) {
+            xf86Msg(X_ERROR, "%s: No device specified.\n", pInfo->name);
+            return FALSE;
+        }
+
+        pEvdev->device = device;
+        xf86Msg(X_CONFIG, "%s: Device: \"%s\"\n", pInfo->name, device);
+    }
+
+    if (pInfo->fd < 0)
+    {
+        do {
+            pInfo->fd = open(device, O_RDWR | O_NONBLOCK, 0);
+        } while (pInfo->fd < 0 && errno == EINTR);
+
+        if (pInfo->fd < 0) {
+            xf86Msg(X_ERROR, "Unable to open evdev device \"%s\".\n", device);
+            return FALSE;
+        }
+    }
+
+    /* Check major/minor of device node to avoid adding duplicate devices. */
+    pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
+    if (EvdevIsDuplicate(pInfo))
+    {
+        xf86Msg(X_WARNING, "%s: device file is duplicate. Ignoring.\n",
+                pInfo->name);
+        close(pInfo->fd);
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
 static InputInfoPtr
 EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 {
     InputInfoPtr pInfo;
-    const char *device;
     EvdevPtr pEvdev;
 
     if (!(pInfo = xf86AllocateInput(drv, 0)))
@@ -2051,39 +2076,15 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
     xf86CollectInputOptions(pInfo, evdevDefaults, NULL);
     xf86ProcessCommonOptions(pInfo, pInfo->options);
 
+    if (!EvdevOpenDevice(pInfo))
+        goto error;
+
     /*
      * We initialize pEvdev->tool to 1 so that device that doesn't use
      * proximity will still report events.
      */
     pEvdev->tool = 1;
 
-    device = xf86CheckStrOption(dev->commonOptions, "Device", NULL);
-    if (!device) {
-        xf86Msg(X_ERROR, "%s: No device specified.\n", pInfo->name);
-        goto error;
-    }
-
-    pEvdev->device = device;
-
-    xf86Msg(X_CONFIG, "%s: Device: \"%s\"\n", pInfo->name, device);
-    do {
-        pInfo->fd = open(device, O_RDWR | O_NONBLOCK, 0);
-    } while (pInfo->fd < 0 && errno == EINTR);
-
-    if (pInfo->fd < 0) {
-        xf86Msg(X_ERROR, "Unable to open evdev device \"%s\".\n", device);
-        goto error;
-    }
-
-    /* Check major/minor of device node to avoid adding duplicate devices. */
-    pEvdev->min_maj = EvdevGetMajorMinor(pInfo);
-    if (EvdevIsDuplicate(pInfo))
-    {
-        xf86Msg(X_WARNING, "%s: device file already in use. Ignoring.\n",
-                pInfo->name);
-        goto error;
-    }
-
     /* Grabbing the event device stops in-kernel event forwarding. In other
        words, it disables rfkill and the "Macintosh mouse button emulation".
        Note that this needs a server that sets the console to RAW mode. */

commit ffc2c9961f5fb099b85a97550a30a854420ee773
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu May 20 11:54:56 2010 +1000

    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>

diff --git a/src/evdev.c b/src/evdev.c
index e09c203..e54a8ed 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -94,6 +94,7 @@ static int EvdevCacheCompare(InputInfoPtr pInfo, BOOL compare);
 static void EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
 static int EvdevSwitchMode(ClientPtr client, DeviceIntPtr device, int mode);
 static BOOL EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab);
+static void EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4]);
 
 #ifdef HAVE_PROPERTIES
 static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms);
@@ -1927,6 +1928,30 @@ EvdevProbe(InputInfoPtr pInfo)
         }
     }
 
+    if (has_rel_axes || has_abs_axes)
+    {
+        char *str;
+        int num_calibration = 0, calibration[4] = { 0, 0, 0, 0 };
+
+        pEvdev->invert_x = xf86SetBoolOption(pInfo->options, "InvertX", FALSE);
+        pEvdev->invert_y = xf86SetBoolOption(pInfo->options, "InvertY", FALSE);
+        pEvdev->swap_axes = xf86SetBoolOption(pInfo->options, "SwapAxes", FALSE);
+
+        str = xf86CheckStrOption(pInfo->options, "Calibration", NULL);
+        if (str) {
+            num_calibration = sscanf(str, "%d %d %d %d",
+                    &calibration[0], &calibration[1],
+                    &calibration[2], &calibration[3]);
+            xfree(str);
+            if (num_calibration == 4)
+                EvdevSetCalibration(pInfo, num_calibration, calibration);
+            else
+                xf86Msg(X_ERROR,
+                        "%s: Insufficient calibration factors (%d). Ignoring calibration\n",
+                        pInfo->name, num_calibration);
+        }
+    }
+
     if (has_rel_axes || has_abs_axes || num_buttons) {
         pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |


Reply to: