Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdevicediscovery_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDEVICEDISCOVERY_H
5#define QDEVICEDISCOVERY_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QObject>
19#include <QSocketNotifier>
20#include <QStringList>
21#include <private/qglobal_p.h>
22
23#define QT_EVDEV_DEVICE_PATH "/dev/input/"
24#define QT_EVDEV_DEVICE_PREFIX "event"
26
27#define QT_DRM_DEVICE_PATH "/dev/dri/"
28#define QT_DRM_DEVICE_PREFIX "card"
30
31QT_BEGIN_NAMESPACE
32
33class QDeviceDiscovery : public QObject
34{
35 Q_OBJECT
36
37public:
38 enum QDeviceType {
39 Device_Unknown = 0x00,
40 Device_Mouse = 0x01,
41 Device_Touchpad = 0x02,
42 Device_Touchscreen = 0x04,
43 Device_Keyboard = 0x08,
44 Device_DRM = 0x10,
45 Device_DRM_PrimaryGPU = 0x20,
46 Device_Tablet = 0x40,
47 Device_Joystick = 0x80,
48 Device_InputMask = Device_Mouse | Device_Touchpad | Device_Touchscreen | Device_Keyboard | Device_Tablet | Device_Joystick,
49 Device_VideoMask = Device_DRM
50 };
51 Q_ENUM(QDeviceType)
52 Q_DECLARE_FLAGS(QDeviceTypes, QDeviceType)
53
54 static QDeviceDiscovery *create(QDeviceTypes type, QObject *parent = nullptr);
55
56 virtual QStringList scanConnectedDevices() = 0;
57
58signals:
59 void deviceDetected(const QString &deviceNode);
60 void deviceRemoved(const QString &deviceNode);
61 void deviceChanged(const QString &deviceNode);
62
63protected:
64 QDeviceDiscovery(QDeviceTypes types, QObject *parent) : QObject(parent), m_types(types) { }
65 Q_DISABLE_COPY_MOVE(QDeviceDiscovery)
66
67 QDeviceTypes m_types;
68};
69
70Q_DECLARE_OPERATORS_FOR_FLAGS(QDeviceDiscovery::QDeviceTypes)
71
72QT_END_NAMESPACE
73
74#endif // QDEVICEDISCOVERY_H
#define QT_DRM_DEVICE_PATH
#define QT_EVDEV_DEVICE_PATH
#define QT_DRM_DEVICE_PREFIX
#define QT_EVDEV_DEVICE_PREFIX