Fail if the device cannot be grabbed during the probe.

If the grab fails, this is most likely a sign that the device has been grabbed
already (probably by a device specified in xorg.conf). So let's not add the
device to the server's input device list, since it won't generate events
anyway.

Exception: keyboards and kernel 2.4 are not affected.
This commit is contained in:
Peter Hutterer
2008-05-21 16:48:32 +09:30
parent d45f315845
commit 15e0091f0b

View File

@@ -901,9 +901,14 @@ EvdevProbe(InputInfoPtr pInfo)
int i, has_axes, has_buttons, has_keys;
EvdevPtr pEvdev = pInfo->private;
if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1) && errno == EINVAL) {
/* keyboards are unsafe in 2.4 */
pEvdev->kernel24 = 1;
if (ioctl(pInfo->fd, EVIOCGRAB, (void *)1)) {
if (errno == EINVAL) {
/* keyboards are unsafe in 2.4 */
pEvdev->kernel24 = 1;
} else {
xf86Msg(X_ERROR, "Grab failed. Device already configured?\n");
return 1;
}
} else {
ioctl(pInfo->fd, EVIOCGRAB, (void *)0);
}