From ac78616d074f2d248543411c106f0d1befeef58d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 22 Feb 2014 01:44:38 -0800 Subject: When re-opening evdev, set the fd before trying to grab If we try to grab the evdev device before we've set the new file descriptor, libevdev_grab returns -EFAULT, which causes DeviceOn to fail. Signed-off-by: Keith Packard Signed-off-by: Peter Hutterer --- src/eventcomm.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/eventcomm.c b/src/eventcomm.c index 35167bb..b8a2dc5 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -195,20 +195,6 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para) struct eventcomm_proto_data *proto_data = (struct eventcomm_proto_data *) priv->proto_data; - if (para->grab_event_device) { - /* Try to grab the event device so that data don't leak to /dev/input/mice */ - int ret; - - ret = libevdev_grab(proto_data->evdev, LIBEVDEV_GRAB); - if (ret < 0) { - xf86IDrvMsg(pInfo, X_WARNING, "can't grab event device, errno=%d\n", - -ret); - return FALSE; - } - } - - proto_data->need_grab = FALSE; - if (libevdev_get_fd(proto_data->evdev) != -1) { struct input_event ev; @@ -225,6 +211,20 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para) libevdev_set_fd(proto_data->evdev, pInfo->fd); + if (para->grab_event_device) { + /* Try to grab the event device so that data don't leak to /dev/input/mice */ + int ret; + + ret = libevdev_grab(proto_data->evdev, LIBEVDEV_GRAB); + if (ret < 0) { + xf86IDrvMsg(pInfo, X_WARNING, "can't grab event device, errno=%d\n", + -ret); + return FALSE; + } + } + + proto_data->need_grab = FALSE; + InitializeTouch(pInfo); return TRUE; -- cgit v1.2.3