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