If you request a device via weston_launcher_open(), you should now release
it via weston_launcher_close() instead of close(). This is currently not
needed but will be required for logind devices.
---
 src/launcher-util.c |  6 ++++++
 src/launcher-util.h |  3 +++
 src/udev-seat.c     | 15 ++++++++++-----
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/launcher-util.c b/src/launcher-util.c
index 3f19083..30e62fc 100644
--- a/src/launcher-util.c
+++ b/src/launcher-util.c
@@ -138,6 +138,12 @@ weston_launcher_open(struct weston_launcher *launcher,
 }
 
 void
+weston_launcher_close(struct weston_launcher *launcher, int fd)
+{
+       close(fd);
+}
+
+void
 weston_launcher_restore(struct weston_launcher *launcher)
 {
        struct vt_mode mode = { 0 };
diff --git a/src/launcher-util.h b/src/launcher-util.h
index 3e7ceb5..9de5237 100644
--- a/src/launcher-util.h
+++ b/src/launcher-util.h
@@ -39,6 +39,9 @@ int
 weston_launcher_open(struct weston_launcher *launcher,
                     const char *path, int flags);
 
+void
+weston_launcher_close(struct weston_launcher *launcher, int fd);
+
 int
 weston_launcher_activate_vt(struct weston_launcher *launcher, int vt);
 
diff --git a/src/udev-seat.c b/src/udev-seat.c
index 4ef7ff3..11a34fb 100644
--- a/src/udev-seat.c
+++ b/src/udev-seat.c
@@ -83,11 +83,11 @@ device_added(struct udev_device *udev_device, struct 
udev_input *input)
 
        device = evdev_device_create(&seat->base, devnode, fd);
        if (device == EVDEV_UNHANDLED_DEVICE) {
-               close(fd);
+               weston_launcher_close(c->launcher, fd);
                weston_log("not using input device '%s'.\n", devnode);
                return 0;
        } else if (device == NULL) {
-               close(fd);
+               weston_launcher_close(c->launcher, fd);
                weston_log("failed to create input device '%s'.\n", devnode);
                return 0;
        }
@@ -216,9 +216,11 @@ evdev_udev_handler(int fd, uint32_t mask, void *data)
                                if (!strcmp(device->devnode, devnode)) {
                                        weston_log("input device %s, %s 
removed\n",
                                                        device->devname, 
device->devnode);
+                                       
weston_launcher_close(input->compositor->launcher,
+                                                             device->fd);
                                        evdev_device_destroy(device);
-                               break;
-                       }
+                                       break;
+                               }
                }
        }
 
@@ -273,8 +275,11 @@ udev_input_remove_devices(struct udev_input *input)
        struct udev_seat *seat;
 
        wl_list_for_each(seat, &input->compositor->seat_list, base.link) {
-               wl_list_for_each_safe(device, next, &seat->devices_list, link)
+               wl_list_for_each_safe(device, next, &seat->devices_list, link) {
+                       weston_launcher_close(input->compositor->launcher,
+                                             device->fd);
                        evdev_device_destroy(device);
+               }
 
                if (seat->base.keyboard)
                        notify_keyboard_focus_out(&seat->base);
-- 
1.8.4

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to