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