diff options
author | Zephaniah E. Hull <warp@aehallh.com> | 2006-04-30 21:39:08 +0000 |
---|---|---|
committer | Zephaniah E. Hull <warp@aehallh.com> | 2006-04-30 21:39:08 +0000 |
commit | eca922bd95fbcf09dd0839e571dc30263c94172f (patch) | |
tree | e623d35fde8b8967a12143486045862ac24c4f33 /src/evdev_brain.c | |
parent | f75aadfd628db727e6732c2f0df0c17e75bdeda6 (diff) |
xf86-input-evdev v1.1.2xf86-input-evdev-1_1_2XORG-7_1
Bugzilla #6734 <https://bugs.freedesktop.org/show_bug.cgi=6734> Apply patch
from Philip Langdale which causes us to make sure that O_NONBLOCK is
set on the inotify device.
Diffstat (limited to 'src/evdev_brain.c')
-rw-r--r-- | src/evdev_brain.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/evdev_brain.c b/src/evdev_brain.c index c4b6fd1..7c854d8 100644 --- a/src/evdev_brain.c +++ b/src/evdev_brain.c @@ -39,6 +39,7 @@ #include <xf86.h> #include <fnmatch.h> +#include <sys/poll.h> #include "inotify.h" #include "inotify-syscalls.h" @@ -347,7 +348,7 @@ static int evdevControl(DeviceIntPtr pPointer, int what) { InputInfoPtr pInfo; - int i; + int i, flags; pInfo = pPointer->public.devicePrivate; @@ -376,6 +377,19 @@ evdevControl(DeviceIntPtr pPointer, int what) SYSCALL (close (pInfo->fd)); pInfo->fd = -1; } + if ((flags = fcntl(pInfo->fd, F_GETFL)) < 0) { + xf86Msg(X_ERROR, "%s: Unable to NONBLOCK inotify, using fallback. " + "(errno: %d)\n", pInfo->name, errno); + evdev_inotify = 0; + SYSCALL (close (pInfo->fd)); + pInfo->fd = -1; + } else if (fcntl(pInfo->fd, F_SETFL, flags | O_NONBLOCK) < 0) { + xf86Msg(X_ERROR, "%s: Unable to NONBLOCK inotify, using fallback. " + "(errno: %d)\n", pInfo->name, errno); + evdev_inotify = 0; + SYSCALL (close (pInfo->fd)); + pInfo->fd = -1; + } if (!evdev_inotify) { SYSCALL (pInfo->fd = open ("/proc/bus/usb/devices", O_RDONLY)); |