]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/login/logind-session-device.h
tree-wide: beautify remaining copyright statements
[thirdparty/systemd.git] / src / login / logind-session-device.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 Copyright © 2013 David Herrmann
6 ***/
7
8 typedef enum DeviceType DeviceType;
9 typedef struct SessionDevice SessionDevice;
10
11 #include "list.h"
12 #include "logind.h"
13
14 enum DeviceType {
15 DEVICE_TYPE_UNKNOWN,
16 DEVICE_TYPE_DRM,
17 DEVICE_TYPE_EVDEV,
18 };
19
20 struct SessionDevice {
21 Session *session;
22 Device *device;
23
24 dev_t dev;
25 char *node;
26 int fd;
27 DeviceType type:3;
28 bool active:1;
29 bool pushed_fd:1;
30
31 LIST_FIELDS(struct SessionDevice, sd_by_device);
32 };
33
34 int session_device_new(Session *s, dev_t dev, bool open_device, SessionDevice **out);
35 void session_device_free(SessionDevice *sd);
36 void session_device_complete_pause(SessionDevice *sd);
37
38 void session_device_resume_all(Session *s);
39 void session_device_pause_all(Session *s);
40 unsigned int session_device_try_pause_all(Session *s);
41
42 int session_device_save(SessionDevice *sd);
43 void session_device_attach_fd(SessionDevice *sd, int fd, bool active);