Commit ac78616d authored by Keith Packard's avatar Keith Packard Committed by Peter Hutterer
Browse files

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's avatarKeith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 22fe8bdc
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment