logind-session-device.h revision d7bd01b547bd91353513131561de9cc7d9f7d405
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann#pragma once
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann/***
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann This file is part of systemd.
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann Copyright 2013 David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann systemd is free software; you can redistribute it and/or modify it
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann under the terms of the GNU Lesser General Public License as published by
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann the Free Software Foundation; either version 2.1 of the License, or
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann (at your option) any later version.
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann systemd is distributed in the hope that it will be useful, but
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann WITHOUT ANY WARRANTY; without even the implied warranty of
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann Lesser General Public License for more details.
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann You should have received a copy of the GNU Lesser General Public License
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann along with systemd; If not, see <http://www.gnu.org/licenses/>.
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann***/
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmanntypedef enum DeviceType DeviceType;
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmanntypedef struct SessionDevice SessionDevice;
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann#include "list.h"
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann#include "util.h"
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann#include "logind.h"
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann#include "logind-device.h"
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann#include "logind-seat.h"
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann#include "logind-session.h"
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmannenum DeviceType {
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann DEVICE_TYPE_UNKNOWN,
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann DEVICE_TYPE_FBDEV,
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann DEVICE_TYPE_DRM,
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann DEVICE_TYPE_EVDEV,
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann};
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmannstruct SessionDevice {
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann Session *session;
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann Device *device;
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann dev_t dev;
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann char *node;
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann int fd;
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann bool active;
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann DeviceType type;
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann LIST_FIELDS(struct SessionDevice, sd_by_device);
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann};
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmannint session_device_new(Session *s, dev_t dev, SessionDevice **out);
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmannvoid session_device_free(SessionDevice *sd);
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmannvoid session_device_complete_pause(SessionDevice *sd);
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmann
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmannvoid session_device_resume_all(Session *s);
118ecf32425a590ea266b5c2b6de7962bb242356David Herrmannvoid session_device_pause_all(Session *s);
d7bd01b547bd91353513131561de9cc7d9f7d405David Herrmannunsigned int session_device_try_pause_all(Session *s);