]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
118ecf32 DH |
2 | #pragma once |
3 | ||
118ecf32 DH |
4 | typedef enum DeviceType DeviceType; |
5 | typedef struct SessionDevice SessionDevice; | |
6 | ||
7 | #include "list.h" | |
118ecf32 | 8 | #include "logind.h" |
118ecf32 DH |
9 | |
10 | enum DeviceType { | |
11 | DEVICE_TYPE_UNKNOWN, | |
118ecf32 DH |
12 | DEVICE_TYPE_DRM, |
13 | DEVICE_TYPE_EVDEV, | |
14 | }; | |
15 | ||
16 | struct SessionDevice { | |
17 | Session *session; | |
18 | Device *device; | |
19 | ||
20 | dev_t dev; | |
21 | char *node; | |
22 | int fd; | |
04104444 LP |
23 | DeviceType type:3; |
24 | bool active:1; | |
25 | bool pushed_fd:1; | |
118ecf32 DH |
26 | |
27 | LIST_FIELDS(struct SessionDevice, sd_by_device); | |
28 | }; | |
29 | ||
8ccba83f | 30 | int session_device_new(Session *s, dev_t dev, bool open_device, SessionDevice **ret); |
80e52052 | 31 | SessionDevice *session_device_free(SessionDevice *sd); |
360179ea DT |
32 | DEFINE_TRIVIAL_CLEANUP_FUNC(SessionDevice*, session_device_free); |
33 | ||
118ecf32 DH |
34 | void session_device_complete_pause(SessionDevice *sd); |
35 | ||
36 | void session_device_resume_all(Session *s); | |
37 | void session_device_pause_all(Session *s); | |
14cb109d | 38 | unsigned session_device_try_pause_all(Session *s); |
aed24c4c FB |
39 | |
40 | int session_device_save(SessionDevice *sd); | |
41 | void session_device_attach_fd(SessionDevice *sd, int fd, bool active); |