chiark / gitweb /
logind: filter out input devices that have none of the keys/switche we care about
[elogind.git] / src / login / logind-session-device.h
1 #pragma once
2
3 /***
4   This file is part of systemd.
5
6   Copyright 2013 David Herrmann
7
8   systemd is free software; you can redistribute it and/or modify it
9   under the terms of the GNU Lesser General Public License as published by
10   the Free Software Foundation; either version 2.1 of the License, or
11   (at your option) any later version.
12
13   systemd is distributed in the hope that it will be useful, but
14   WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   Lesser General Public License for more details.
17
18   You should have received a copy of the GNU Lesser General Public License
19   along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 typedef enum DeviceType DeviceType;
23 typedef struct SessionDevice SessionDevice;
24
25 #include "list.h"
26 #include "logind.h"
27
28 enum DeviceType {
29         DEVICE_TYPE_UNKNOWN,
30         DEVICE_TYPE_DRM,
31         DEVICE_TYPE_EVDEV,
32 };
33
34 struct SessionDevice {
35         Session *session;
36         Device *device;
37
38         dev_t dev;
39         char *node;
40         int fd;
41         bool active;
42         DeviceType type;
43
44         LIST_FIELDS(struct SessionDevice, sd_by_device);
45 };
46
47 int session_device_new(Session *s, dev_t dev, bool open_device, SessionDevice **out);
48 void session_device_free(SessionDevice *sd);
49 void session_device_complete_pause(SessionDevice *sd);
50
51 void session_device_resume_all(Session *s);
52 void session_device_pause_all(Session *s);
53 unsigned int session_device_try_pause_all(Session *s);
54
55 int session_device_save(SessionDevice *sd);
56 void session_device_attach_fd(SessionDevice *sd, int fd, bool active);