KWin
Loading...
Searching...
No Matches
src
utils
udev.h
Go to the documentation of this file.
1
/*
2
KWin - the KDE window manager
3
This file is part of the KDE project.
4
5
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
6
7
SPDX-License-Identifier: GPL-2.0-or-later
8
*/
9
#pragma once
10
#include <kwin_export.h>
11
#include <memory>
12
13
#include <QList>
14
#include <vector>
15
16
#include <sys/types.h>
17
18
struct
udev;
19
struct
udev_device;
20
struct
udev_monitor;
21
22
namespace
KWin
23
{
24
class
Udev;
25
26
class
KWIN_EXPORT
UdevDevice
27
{
28
public
:
29
UdevDevice
(udev_device *device);
30
~UdevDevice
();
31
32
QString devNode()
const
;
33
dev_t devNum()
const
;
34
const
char
*property(
const
char
*key);
35
bool
hasProperty(
const
char
*key,
const
char
*value);
36
QString action()
const
;
37
38
QMap<QByteArray, QByteArray> properties()
const
;
39
bool
isBootVga()
const
;
40
QString seat()
const
;
41
bool
isHotpluggable()
const
;
42
43
operator
udev_device *()
const
44
{
45
return
m_device;
46
}
47
operator
udev_device *()
48
{
49
return
m_device;
50
}
51
52
private
:
53
udev_device *
const
m_device;
54
};
55
56
class
KWIN_EXPORT
UdevMonitor
57
{
58
public
:
59
explicit
UdevMonitor
(
Udev
*udev);
60
~UdevMonitor
();
61
62
int
fd()
const
;
63
bool
isValid
()
const
64
{
65
return
m_monitor !=
nullptr
;
66
}
67
void
filterSubsystemDevType(
const
char
*subSystem,
const
char
*devType =
nullptr
);
68
void
enable();
69
std::unique_ptr<UdevDevice> getDevice();
70
71
private
:
72
udev_monitor *m_monitor;
73
};
74
75
class
KWIN_EXPORT
Udev
76
{
77
public
:
78
Udev
();
79
~Udev
();
80
81
bool
isValid
()
const
82
{
83
return
m_udev !=
nullptr
;
84
}
85
std::vector<std::unique_ptr<UdevDevice>> listGPUs();
86
std::unique_ptr<UdevDevice> deviceFromSyspath(
const
char
*syspath);
87
std::unique_ptr<UdevMonitor> monitor();
88
operator
udev *()
const
89
{
90
return
m_udev;
91
}
92
operator
udev *()
93
{
94
return
m_udev;
95
}
96
97
private
:
98
struct
udev *m_udev;
99
};
100
101
}
KWin::UdevDevice
Definition
udev.h:27
KWin::Udev
Definition
udev.h:76
KWin::Udev::isValid
bool isValid() const
Definition
udev.h:81
KWin::UdevMonitor
Definition
udev.h:57
KWin::UdevMonitor::isValid
bool isValid() const
Definition
udev.h:63
KWin
Definition
activation_test.cpp:20
Generated on Sat Feb 17 2024 01:42:10 for KWin by
1.10.0