summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@redhat.com>2008-08-15 09:23:02 +0930
committerPeter Hutterer <peter.hutterer@redhat.com>2008-08-15 11:54:53 +0930
commit6dc41991557fa55a9e2f5aaf0fe40c70a08d41fd (patch)
tree617aaebac9c7d34659faffd760a51721e7898b22
parente8534d47c8524ac081c2e3e6ebaabe4c6b274a18 (diff)
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 e8534d47c8524ac081c2e3e6ebaabe4c6b274a18.
-rw-r--r--man/evdev.man8
-rw-r--r--src/evdev.c35
-rw-r--r--src/evdev.h2
3 files changed, 15 insertions, 30 deletions
diff --git a/man/evdev.man b/man/evdev.man
index ee126f1..3b0f3b1 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -12,7 +12,6 @@ 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
@@ -121,13 +120,6 @@ emulation mode. Button number
is mapped to the negative Y axis motion and button number
.I N2
is mapped to the positive Y axis motion. Default: "4 5"
-.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.
.SH "SEE ALSO"
diff --git a/src/evdev.c b/src/evdev.c
index b2a79a2..38a211b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -942,24 +942,23 @@ EvdevProc(DeviceIntPtr device, int what)
return EvdevInit(device);
case DEVICE_ON:
- if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)1))
- {
+ if (!pEvdev->kernel24 && ioctl(pInfo->fd, EVIOCGRAB, (void *)1))
xf86Msg(X_WARNING, "%s: Grab failed (%s)\n", pInfo->name,
strerror(errno));
- if (errno == ENODEV)
- return !Success;
- }
- xf86AddEnabledDevice(pInfo);
- if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
+ if (errno != ENODEV)
{
- EvdevMBEmuPreInit(pInfo);
- EvdevWheelEmuPreInit(pInfo);
+ xf86AddEnabledDevice(pInfo);
+ if (pEvdev->flags & EVDEV_BUTTON_EVENTS)
+ {
+ EvdevMBEmuPreInit(pInfo);
+ EvdevWheelEmuPreInit(pInfo);
+ }
+ device->public.on = TRUE;
}
- device->public.on = TRUE;
break;
case DEVICE_OFF:
- if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)0))
+ if (!pEvdev->kernel24 && ioctl(pInfo->fd, EVIOCGRAB, (void *)0))
xf86Msg(X_WARNING, "%s: Release failed (%s)\n", pInfo->name,
strerror(errno));
xf86RemoveEnabledDevice(pInfo);
@@ -983,19 +982,17 @@ EvdevProbe(InputInfoPtr pInfo)
long rel_bitmask[NBITS(REL_MAX)];
long abs_bitmask[NBITS(ABS_MAX)];
int i, has_axes, has_keys, num_buttons;
- int kernel24 = 0;
EvdevPtr pEvdev = pInfo->private;
- if (pEvdev->grabDevice && ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
+ if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
if (errno == EINVAL) {
/* keyboards are unsafe in 2.4 */
- kernel24 = 1;
- pEvdev->grabDevice = 0;
+ pEvdev->kernel24 = 1;
} else {
xf86Msg(X_ERROR, "Grab failed. Device already configured?\n");
return 1;
}
- } else if (pEvdev->grabDevice) {
+ } else {
ioctl(pInfo->fd, EVIOCGRAB, (void *)0);
}
@@ -1071,7 +1068,7 @@ EvdevProbe(InputInfoPtr pInfo)
}
if (has_keys) {
- if (kernel24) {
+ if (pEvdev->kernel24) {
xf86Msg(X_INFO, "%s: Kernel < 2.6 is too old, ignoring keyboard\n",
pInfo->name);
} else {
@@ -1155,10 +1152,6 @@ EvdevPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
return NULL;
}
- /* Grabbing the event device stops in-kernel event forwarding. In other
- words, it disables rfkill and the "Macintosh mouse button emulation". */
- pEvdev->grabDevice = xf86CheckBoolOption(dev->commonOptions, "GrabDevice", 0);
-
EvdevInitButtonMapping(pInfo);
pEvdev->noXkb = noXkbExtension;
diff --git a/src/evdev.h b/src/evdev.h
index a43ddbe..a0a336a 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -50,7 +50,7 @@ typedef struct {
} WheelAxis, *WheelAxisPtr;
typedef struct {
- int grabDevice; /* grab the event device? */
+ int kernel24;
int screen;
int min_x, min_y, max_x, max_y;
int abs_x, abs_y, old_x, old_y;