summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-03-02 11:55:51 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:59:11 +0200
commit6e7f88fe09dfe20e6c800313088c7bb03155b76f (patch)
tree73bba218845a745e8f94eddd3253127404640d49 /src
parente26d2bd8c76d7dbe67a94036b7bfeea8c75bb038 (diff)
logind: open device if needed
Fixes: #8291
Diffstat (limited to 'src')
-rw-r--r--src/login/logind-session-device.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/login/logind-session-device.c b/src/login/logind-session-device.c
index 64a6bd273..ca0c512a1 100644
--- a/src/login/logind-session-device.c
+++ b/src/login/logind-session-device.c
@@ -197,11 +197,19 @@ static int session_device_start(SessionDevice *sd) {
switch (sd->type) {
case DEVICE_TYPE_DRM:
- /* Device is kept open. Simply call drmSetMaster() and hope there is no-one else. In case it fails, we
- * keep the device paused. Maybe at some point we have a drmStealMaster(). */
- r = sd_drmsetmaster(sd->fd);
- if (r < 0)
- return r;
+
+ if (sd->fd < 0) {
+ /* Open device if it isn't open yet */
+ sd->fd = session_device_open(sd, true);
+ if (sd->fd < 0)
+ return sd->fd;
+ } else {
+ /* Device is kept open. Simply call drmSetMaster() and hope there is no-one else. In case it fails, we
+ * keep the device paused. Maybe at some point we have a drmStealMaster(). */
+ r = sd_drmsetmaster(sd->fd);
+ if (r < 0)
+ return r;
+ }
break;
case DEVICE_TYPE_EVDEV: