rpms/xorg-x11-drv-evdev/F-10 evdev-2.0.6-dont-grab.patch, NONE, 1.1 xorg-x11-drv-evdev.spec, 1.33, 1.34

Peter Hutterer whot at fedoraproject.org
Thu Oct 16 07:49:01 UTC 2008


Author: whot

Update of /cvs/pkgs/rpms/xorg-x11-drv-evdev/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv28199

Modified Files:
	xorg-x11-drv-evdev.spec 
Added Files:
	evdev-2.0.6-dont-grab.patch 
Log Message:
* Thu Oct 16 2008 Peter Hutterer <peter.hutterer at redhat.com> 2.0.6-3
- evdev-2.0.6-dont-grab.patch: don't grab the evdev device.
  Requires xserver 1.5.2-5.



evdev-2.0.6-dont-grab.patch:

--- NEW FILE evdev-2.0.6-dont-grab.patch ---
>From e335ca1cd6d9b933109774ade0f3e9cc7bd13710 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at redhat.com>
Date: Thu, 16 Oct 2008 15:27:47 +1030
Subject: [PATCH] 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 e8534d47c8524ac081c2e3e6ebaabe4c6b274a18, which
was reverted in 6dc41991557fa55a9e2f5aaf0fe40c70a08d41fd.
---
 man/evdev.man |    8 ++++++++
 src/evdev.c   |   19 +++++++++++++------
 src/evdev.h   |    2 +-
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/man/evdev.man b/man/evdev.man
index 530f979..83f9e65 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -12,6 +12,7 @@ evdev \- Generic Linux input driver
 .BI "  Option \*qPath\*q     \*q" path \*q
 .BI "  Option \*qEmulate3Buttons\*q     \*q" True \*q
 .BI "  Option \*qEmulate3Timeout\*q     \*q" 50 \*q
+.BI "  Option \*qGrabDevice\*q     \*q" False \*q
 \ \ ...
 .B EndSection
 .fi
@@ -71,6 +72,13 @@ enabled.  Default: 50.
 .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 \*qGrabDevice\*q \*q" boolean \*q
+Force a grab on the event device. Doing so will ensure that no other driver
+can initialise the same device and it will also stop the device from sending
+events to /dev/kbd or /dev/input/mice. Events from this device will not be
+sent to virtual devices (e.g. rfkill or the Macintosh mouse button emulation).
+Default disabled.
 
 .SH AUTHORS
 Kristian Høgsberg.
diff --git a/src/evdev.c b/src/evdev.c
index 6958578..6b17c58 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -912,7 +912,7 @@ EvdevOn(DeviceIntPtr device)
     pInfo = device->public.devicePrivate;
     pEvdev = pInfo->private;
 
-    if (pInfo->fd != -1 && !pEvdev->kernel24 &&
+    if (pInfo->fd != -1 && pEvdev->grabDevice &&
         (rc = ioctl(pInfo->fd, EVIOCGRAB, (void *)1)))
     {
         xf86Msg(X_WARNING, "%s: Grab failed (%s)\n", pInfo->name,
@@ -966,7 +966,7 @@ EvdevProc(DeviceIntPtr device, int what)
     case DEVICE_OFF:
         if (pInfo->fd != -1)
         {
-            if (!pEvdev->kernel24 && ioctl(pInfo->fd, EVIOCGRAB, (void *)0))
+            if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)0))
                 xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name,
                         strerror(errno));
             xf86RemoveEnabledDevice(pInfo);
@@ -1137,17 +1137,19 @@ EvdevProbe(InputInfoPtr pInfo)
     long rel_bitmask[NBITS(REL_MAX)];
     long abs_bitmask[NBITS(ABS_MAX)];
     int i, has_axes, has_buttons, has_keys;
+    int kernel24 = 0;
     EvdevPtr pEvdev = pInfo->private;
 
-    if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
+    if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
         if (errno == EINVAL) {
             /* keyboards are unsafe in 2.4 */
-            pEvdev->kernel24 = 1;
+            kernel24 = 1;
+            pEvdev->grabDevice = 0;
         } else {
             xf86Msg(X_ERROR, "Grab failed. Device already configured?\n");
             return 1;
         }
-    } else {
+    } else if (pEvdev->grabDevice) {
         ioctl(pInfo->fd, EVIOCGRAB, (void *)0);
     }
 
@@ -1214,7 +1216,7 @@ EvdevProbe(InputInfoPtr pInfo)
     }
 
     if (has_keys) {
-        if (pEvdev->kernel24) {
+        if (kernel24) {
             xf86Msg(X_INFO, "%s: Kernel < 2.6 is too old, ignoring keyboard\n",
                     pInfo->name);
         } else {
@@ -1300,6 +1302,11 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 
     pEvdev->reopen_attempts = xf86SetIntOption(pInfo->options, "ReopenAttempts", 10);
 
+    /* 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. */
+    pEvdev->grabDevice = xf86CheckBoolOption(dev->commonOptions, "GrabDevice", 0);
+
     pEvdev->noXkb = noXkbExtension;
     /* parse the XKB options during kbd setup */
 
diff --git a/src/evdev.h b/src/evdev.h
index 9f16b81..29dd37e 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -45,7 +45,7 @@
 
 typedef struct {
     const char *device;
-    int kernel24;
+    int grabDevice;         /* grab the event device? */
     int screen;
     int min_x, min_y, max_x, max_y;
     int abs_x, abs_y, old_x, old_y;
-- 
1.5.4.3



Index: xorg-x11-drv-evdev.spec
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-evdev/F-10/xorg-x11-drv-evdev.spec,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- xorg-x11-drv-evdev.spec	8 Oct 2008 00:55:21 -0000	1.33
+++ xorg-x11-drv-evdev.spec	16 Oct 2008 07:48:30 -0000	1.34
@@ -7,7 +7,7 @@
 Summary:    Xorg X11 evdev input driver
 Name:	    xorg-x11-drv-evdev
 Version:    2.0.6
-Release:    2%{?dist}
+Release:    3%{?dist}
 URL:	    http://www.x.org
 License:    MIT
 Group:	    User Interface/X Hardware Support
@@ -19,13 +19,16 @@
 
 # Merged upstream but not in 2.0 branch
 Patch0001:  evdev-2.0.6-force-rules-evdev.patch
+# Not upstream until matching xserver commit is upstream. Won't be in 2.0
+# branch anyway.
+Patch0002:  evdev-2.0.6-dont-grab.patch
 
 ExcludeArch: s390 s390x
 
 BuildRequires: autoconf automake libtool
 BuildRequires: xorg-x11-server-sdk >= 1.3.0.0-6
 
-Requires:  xorg-x11-server-Xorg >= 1.3.0.0-6
+Requires:  xorg-x11-server-Xorg >= 1.5.2-5
 Requires:  xkeyboard-config >= 1.4-1
 
 %description 
@@ -37,6 +40,7 @@
 
 # apply patches
 %patch0001 -p1 -b .rules-evdev
+%patch0002 -p1 -b .dont-grab
 
 %build
 autoreconf -v --install || exit 1
@@ -61,6 +65,10 @@
 %{_mandir}/man4/evdev.4*
 
 %changelog
+* Thu Oct 16 2008 Peter Hutterer <peter.hutterer at redhat.com> 2.0.6-3
+- evdev-2.0.6-dont-grab.patch: don't grab the evdev device.
+  Requires xserver 1.5.2-5.
+ 
 * Wed Oct 8 2008 Peter Hutterer <peter.hutterer at redhat.com> 2.0.6-2
 - evdev-2.0.6-force-rules-evdev.patch: force keyboard to use the evdev rules,
   not model. requires xkeyboard-config 1.4. (#457512)




More information about the scm-commits mailing list