summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/devicediscovery
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/devicediscovery')
-rw-r--r--src/platformsupport/devicediscovery/.prev_CMakeLists.txt40
-rw-r--r--src/platformsupport/devicediscovery/CMakeLists.txt20
-rw-r--r--src/platformsupport/devicediscovery/devicediscovery.pro24
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_dummy.cpp40
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h42
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_p.h41
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_static.cpp48
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_static_p.h42
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp58
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h50
10 files changed, 48 insertions, 357 deletions
diff --git a/src/platformsupport/devicediscovery/.prev_CMakeLists.txt b/src/platformsupport/devicediscovery/.prev_CMakeLists.txt
deleted file mode 100644
index 8ecabb4a1b..0000000000
--- a/src/platformsupport/devicediscovery/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-# Generated from devicediscovery.pro.
-
-#####################################################################
-## DeviceDiscoverySupport Module:
-#####################################################################
-
-qt_add_module(DeviceDiscoverySupport
- STATIC
- INTERNAL_MODULE
- SOURCES
- qdevicediscovery_p.h
- DEFINES
- QT_NO_CAST_FROM_ASCII
- PUBLIC_LIBRARIES
- Qt::CorePrivate
-)
-
-#### Keys ignored in scope 1:.:.:devicediscovery.pro:<TRUE>:
-# MODULE = "devicediscovery_support"
-# QT_FOR_CONFIG = "gui-private"
-
-## Scopes:
-#####################################################################
-
-qt_extend_target(DeviceDiscoverySupport CONDITION QT_FEATURE_libudev
- SOURCES
- qdevicediscovery_udev.cpp qdevicediscovery_udev_p.h
- LIBRARIES
- PkgConfig::Libudev
-)
-
-qt_extend_target(DeviceDiscoverySupport CONDITION QT_FEATURE_evdev AND NOT QT_FEATURE_libudev
- SOURCES
- qdevicediscovery_static.cpp qdevicediscovery_static_p.h
-)
-
-qt_extend_target(DeviceDiscoverySupport CONDITION NOT QT_FEATURE_evdev AND NOT QT_FEATURE_libudev
- SOURCES
- qdevicediscovery_dummy.cpp qdevicediscovery_dummy_p.h
-)
diff --git a/src/platformsupport/devicediscovery/CMakeLists.txt b/src/platformsupport/devicediscovery/CMakeLists.txt
index 171db55f5b..19c35f6660 100644
--- a/src/platformsupport/devicediscovery/CMakeLists.txt
+++ b/src/platformsupport/devicediscovery/CMakeLists.txt
@@ -1,11 +1,12 @@
-# Generated from devicediscovery.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
-## DeviceDiscoverySupport Module:
+## DeviceDiscoverySupportPrivate Module:
#####################################################################
-qt_add_module(DeviceDiscoverySupport
- CONFIG_MODULE_NAME devicediscovery_support # special case
+qt_internal_add_module(DeviceDiscoverySupportPrivate
+ CONFIG_MODULE_NAME devicediscovery_support
STATIC
INTERNAL_MODULE
SOURCES
@@ -14,28 +15,25 @@ qt_add_module(DeviceDiscoverySupport
QT_NO_CAST_FROM_ASCII
PUBLIC_LIBRARIES
Qt::CorePrivate
+ NO_GENERATE_CPP_EXPORTS
)
-#### Keys ignored in scope 1:.:.:devicediscovery.pro:<TRUE>:
-# MODULE = "devicediscovery_support"
-# QT_FOR_CONFIG = "gui-private"
-
## Scopes:
#####################################################################
-qt_extend_target(DeviceDiscoverySupport CONDITION QT_FEATURE_libudev
+qt_internal_extend_target(DeviceDiscoverySupportPrivate CONDITION QT_FEATURE_libudev
SOURCES
qdevicediscovery_udev.cpp qdevicediscovery_udev_p.h
LIBRARIES
PkgConfig::Libudev
)
-qt_extend_target(DeviceDiscoverySupport CONDITION QT_FEATURE_evdev AND NOT QT_FEATURE_libudev
+qt_internal_extend_target(DeviceDiscoverySupportPrivate CONDITION QT_FEATURE_evdev AND NOT QT_FEATURE_libudev
SOURCES
qdevicediscovery_static.cpp qdevicediscovery_static_p.h
)
-qt_extend_target(DeviceDiscoverySupport CONDITION NOT QT_FEATURE_evdev AND NOT QT_FEATURE_libudev
+qt_internal_extend_target(DeviceDiscoverySupportPrivate CONDITION NOT QT_FEATURE_evdev AND NOT QT_FEATURE_libudev
SOURCES
qdevicediscovery_dummy.cpp qdevicediscovery_dummy_p.h
)
diff --git a/src/platformsupport/devicediscovery/devicediscovery.pro b/src/platformsupport/devicediscovery/devicediscovery.pro
deleted file mode 100644
index 881ec4d41e..0000000000
--- a/src/platformsupport/devicediscovery/devicediscovery.pro
+++ /dev/null
@@ -1,24 +0,0 @@
-TARGET = QtDeviceDiscoverySupport
-MODULE = devicediscovery_support
-
-QT = core-private
-QT_FOR_CONFIG += gui-private
-CONFIG += static internal_module
-
-DEFINES += QT_NO_CAST_FROM_ASCII
-
-HEADERS += qdevicediscovery_p.h
-
-qtConfig(libudev) {
- SOURCES += qdevicediscovery_udev.cpp
- HEADERS += qdevicediscovery_udev_p.h
- QMAKE_USE_PRIVATE += libudev
-} else: qtConfig(evdev) {
- SOURCES += qdevicediscovery_static.cpp
- HEADERS += qdevicediscovery_static_p.h
-} else {
- SOURCES += qdevicediscovery_dummy.cpp
- HEADERS += qdevicediscovery_dummy_p.h
-}
-
-load(qt_module)
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_dummy.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_dummy.cpp
index a04b91b438..f94f7be3b2 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_dummy.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_dummy.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdevicediscovery_dummy_p.h"
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h
index fe669c8dec..9ac6fbe921 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDEVICEDISCOVERY_DUMMY_H
#define QDEVICEDISCOVERY_DUMMY_H
@@ -60,7 +24,7 @@ class QDeviceDiscoveryDummy : public QDeviceDiscovery
Q_OBJECT
public:
- QDeviceDiscoveryDummy(QDeviceTypes types, QObject *parent = 0);
+ QDeviceDiscoveryDummy(QDeviceTypes types, QObject *parent = nullptr);
QStringList scanConnectedDevices() override;
};
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_p.h
index f1f50e9708..59ce3cd889 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_p.h
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2018 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDEVICEDISCOVERY_H
#define QDEVICEDISCOVERY_H
@@ -54,6 +18,7 @@
#include <QObject>
#include <QSocketNotifier>
#include <QStringList>
+#include <private/qglobal_p.h>
#define QT_EVDEV_DEVICE_PATH "/dev/input/"
#define QT_EVDEV_DEVICE_PREFIX "event"
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
index a1575677f5..03a77aaae7 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_static.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdevicediscovery_static_p.h"
@@ -83,6 +47,8 @@ static bool testBit(long bit, const long *field)
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(lcDD, "qt.qpa.input")
QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
@@ -107,7 +73,7 @@ QStringList QDeviceDiscoveryStatic::scanConnectedDevices()
dir.setPath(QString::fromLatin1(QT_EVDEV_DEVICE_PATH));
const auto deviceFiles = dir.entryList();
for (const QString &deviceFile : deviceFiles) {
- QString absoluteFilePath = dir.absolutePath() + QLatin1Char('/') + deviceFile;
+ QString absoluteFilePath = dir.absolutePath() + u'/' + deviceFile;
if (checkDeviceType(absoluteFilePath))
devices << absoluteFilePath;
}
@@ -118,7 +84,7 @@ QStringList QDeviceDiscoveryStatic::scanConnectedDevices()
dir.setPath(QString::fromLatin1(QT_DRM_DEVICE_PATH));
const auto deviceFiles = dir.entryList();
for (const QString &deviceFile : deviceFiles) {
- QString absoluteFilePath = dir.absolutePath() + QLatin1Char('/') + deviceFile;
+ QString absoluteFilePath = dir.absolutePath() + u'/' + deviceFile;
if (checkDeviceType(absoluteFilePath))
devices << absoluteFilePath;
}
@@ -139,7 +105,7 @@ bool QDeviceDiscoveryStatic::checkDeviceType(const QString &device)
qCDebug(lcDD) << "doing static device discovery for " << device;
- if ((m_types & Device_DRM) && device.contains(QLatin1String(QT_DRM_DEVICE_PREFIX))) {
+ if ((m_types & Device_DRM) && device.contains(QT_DRM_DEVICE_PREFIX ""_L1)) {
QT_CLOSE(fd);
return true;
}
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h
index 93110c3c55..fb698c9022 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDEVICEDISCOVERY_STATIC_H
#define QDEVICEDISCOVERY_STATIC_H
@@ -60,7 +24,7 @@ class QDeviceDiscoveryStatic : public QDeviceDiscovery
Q_OBJECT
public:
- QDeviceDiscoveryStatic(QDeviceTypes types, QObject *parent = 0);
+ QDeviceDiscoveryStatic(QDeviceTypes types, QObject *parent = nullptr);
QStringList scanConnectedDevices() override;
private:
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
index 96af9a2b47..45043818a4 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qdevicediscovery_udev_p.h"
@@ -54,13 +18,15 @@
QT_BEGIN_NAMESPACE
+using namespace Qt::StringLiterals;
+
Q_LOGGING_CATEGORY(lcDD, "qt.qpa.input")
QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
{
qCDebug(lcDD) << "udev device discovery for type" << types;
- QDeviceDiscovery *helper = 0;
+ QDeviceDiscovery *helper = nullptr;
struct udev *udev;
udev = udev_new();
@@ -75,7 +41,7 @@ QDeviceDiscovery *QDeviceDiscovery::create(QDeviceTypes types, QObject *parent)
QDeviceDiscoveryUDev::QDeviceDiscoveryUDev(QDeviceTypes types, struct udev *udev, QObject *parent) :
QDeviceDiscovery(types, parent),
- m_udev(udev), m_udevMonitor(0), m_udevMonitorFileDescriptor(-1), m_udevSocketNotifier(0)
+ m_udev(udev)
{
if (!m_udev)
return;
@@ -140,9 +106,9 @@ QStringList QDeviceDiscoveryUDev::scanConnectedDevices()
const char *syspath = udev_list_entry_get_name(entry);
udev_device *udevice = udev_device_new_from_syspath(m_udev, syspath);
QString candidate = QString::fromUtf8(udev_device_get_devnode(udevice));
- if ((m_types & Device_InputMask) && candidate.startsWith(QLatin1String(QT_EVDEV_DEVICE)))
+ if ((m_types & Device_InputMask) && candidate.startsWith(QT_EVDEV_DEVICE ""_L1))
devices << candidate;
- if ((m_types & Device_VideoMask) && candidate.startsWith(QLatin1String(QT_DRM_DEVICE))) {
+ if ((m_types & Device_VideoMask) && candidate.startsWith(QT_DRM_DEVICE ""_L1)) {
if (m_types & Device_DRM_PrimaryGPU) {
udev_device *pci = udev_device_get_parent_with_subsystem_devtype(udevice, "pci", 0);
if (pci) {
@@ -186,9 +152,9 @@ void QDeviceDiscoveryUDev::handleUDevNotification()
const char *subsystem;
devNode = QString::fromUtf8(str);
- if (devNode.startsWith(QLatin1String(QT_EVDEV_DEVICE)))
+ if (devNode.startsWith(QT_EVDEV_DEVICE ""_L1))
subsystem = "input";
- else if (devNode.startsWith(QLatin1String(QT_DRM_DEVICE)))
+ else if (devNode.startsWith(QT_DRM_DEVICE ""_L1))
subsystem = "drm";
else goto cleanup;
@@ -220,7 +186,7 @@ bool QDeviceDiscoveryUDev::checkDeviceType(udev_device *dev)
if ((m_types & Device_Keyboard) && (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 )) {
const QString capabilities_key = QString::fromUtf8(udev_device_get_sysattr_value(dev, "capabilities/key"));
- const auto val = QStringView{capabilities_key}.split(QLatin1Char(' '), Qt::SkipEmptyParts);
+ const auto val = QStringView{capabilities_key}.split(u' ', Qt::SkipEmptyParts);
if (!val.isEmpty()) {
bool ok;
unsigned long long keys = val.last().toULongLong(&ok, 16);
@@ -258,3 +224,5 @@ bool QDeviceDiscoveryUDev::checkDeviceType(udev_device *dev)
}
QT_END_NAMESPACE
+
+#include "moc_qdevicediscovery_udev_p.cpp"
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h
index 82b475776d..3074877b5a 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QDEVICEDISCOVERY_UDEV_H
#define QDEVICEDISCOVERY_UDEV_H
@@ -68,16 +32,18 @@ public:
private slots:
void handleUDevNotification();
+protected:
+ struct udev *m_udev;
+
private:
bool checkDeviceType(struct udev_device *dev);
void startWatching();
void stopWatching();
- struct udev *m_udev;
- struct udev_monitor *m_udevMonitor;
- int m_udevMonitorFileDescriptor;
- QSocketNotifier *m_udevSocketNotifier;
+ struct udev_monitor *m_udevMonitor = nullptr;
+ int m_udevMonitorFileDescriptor = -1;
+ QSocketNotifier *m_udevSocketNotifier = nullptr;
};
QT_END_NAMESPACE