diff options
author | Keith Packard <keithp@keithp.com> | 2014-02-22 01:44:38 -0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-02-24 08:02:01 +1000 |
commit | ac78616d074f2d248543411c106f0d1befeef58d (patch) | |
tree | 18ce22061c1873697c49a87ac68112efc96fe546 /src | |
parent | 22fe8bdc6668e78853768c62f4d1331114c7eca0 (diff) |
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 <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/eventcomm.c | 28 |
1 files changed, 14 insertions, 14 deletions
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; |