[PATCH evdev] If a device name contains "trackball" assume it is a XI_TRACKBALL (#55867)

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 26 17:43:34 PDT 2013


X.Org Bug 55867 <http://bugs.freedesktop.org/show_bug.cgi?id=55867>

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac |  2 ++
 src/evdev.c  | 10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 41d1017..db75c6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,8 @@ AC_CONFIG_AUX_DIR(.)
 # Initialize Automake
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 
+AC_DEFINE(_GNU_SOURCE, 1, [_GNU_SOURCE])
+
 # Initialize libtool
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
diff --git a/src/evdev.c b/src/evdev.c
index 052e9f0..235db71 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2358,8 +2358,14 @@ EvdevProbe(InputInfoPtr pInfo)
             if (!EvdevBitIsSet(pEvdev->rel_bitmask, REL_X) ||
                 !EvdevBitIsSet(pEvdev->rel_bitmask, REL_Y))
                 EvdevForceXY(pInfo, Relative);
-	    xf86IDrvMsg(pInfo, X_INFO, "Configuring as mouse\n");
-	    pInfo->type_name = XI_MOUSE;
+            /* Best guess we can make here */
+            if (strcasestr(pInfo->name, "trackball") != NULL) {
+                xf86IDrvMsg(pInfo, X_INFO, "Configuring as trackball\n");
+                pInfo->type_name = XI_TRACKBALL;
+            } else {
+                xf86IDrvMsg(pInfo, X_INFO, "Configuring as mouse\n");
+                pInfo->type_name = XI_MOUSE;
+            }
 	}
 
         rc = 0;
-- 
1.8.1.4



More information about the xorg-devel mailing list