diff options
author | Scott Anderson <ascent12@hotmail.com> | 2017-05-14 12:31:22 +1200 |
---|---|---|
committer | Scott Anderson <ascent12@hotmail.com> | 2017-05-14 12:42:49 +1200 |
commit | ce8786721b17febb5132c136213c95a095f13121 (patch) | |
tree | eaf01de1dbe04b9b4117c9d421edc2d6361588ee | |
parent | 058b8bdf2755da16d38dccc8de715a984fdd620c (diff) |
Got it working.
-rw-r--r-- | backend/drm/backend.c | 9 | ||||
-rw-r--r-- | session/logind.c | 9 |
2 files changed, 5 insertions, 13 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 48e207c8..3c7af14b 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -47,12 +47,13 @@ static void device_paused(struct wl_listener *listener, void *data) { } static void device_resumed(struct wl_listener *listener, void *data) { - struct wlr_backend_state *drm = wl_container_of(listener, drm, device_paused); + struct wlr_backend_state *drm = wl_container_of(listener, drm, device_resumed); int *new_fd = data; - close(drm->fd); - drm->fd = *new_fd; - drm->renderer.fd = *new_fd; + if (dup2(*new_fd, drm->fd) < 0) { + wlr_log(L_ERROR, "dup2 failed: %s", strerror(errno)); + return; + } for (size_t i = 0; i < drm->outputs->length; ++i) { struct wlr_output_state *output = drm->outputs->items[i]; diff --git a/session/logind.c b/session/logind.c index 7799c14b..b6763bf9 100644 --- a/session/logind.c +++ b/session/logind.c @@ -226,15 +226,6 @@ static int resume_device(sd_bus_message *msg, void *userdata, sd_bus_error *ret_ goto error; } - // The original fd seem to be closed when the message is freed - // so we just clone it. - fd = fcntl(fd, F_DUPFD_CLOEXEC, 0); - if (fd == -1) { - wlr_log(L_ERROR, "Failed to clone file descriptor for ResumeDevice: %s", - strerror(errno)); - goto error; - } - // TODO: Use major/minor to make sure the right devices are getting signals wl_signal_emit(&session->base.device_resumed, &fd); |