summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/kms/qkmsudevdrmhandler.cpp
diff options
context:
space:
mode:
authorHannu Lyytinen <hannu.lyytinen@nomovok.com>2012-04-12 15:15:26 +0300
committerQt by Nokia <qt-info@nokia.com>2012-04-13 08:33:40 +0200
commit2a5ade68fd4b536c766de395d2657cd37c9bb98b (patch)
tree6aadeef26b2ace279512ef7ab48ec0232a89bbe4 /src/plugins/platforms/kms/qkmsudevdrmhandler.cpp
parent5ab6a3270d1121fb4d50c3f79f497a9c52d5afa8 (diff)
Use the new udev based framework for detecting graphics cards.
Get rid of hard coded device node and support any number of graphics cards. Change-Id: I50f07fb1e6ea321a4ae751db8fb49ab439dce51e Reviewed-by: Andy Nichols <andy.nichols@nokia.com>
Diffstat (limited to 'src/plugins/platforms/kms/qkmsudevdrmhandler.cpp')
-rw-r--r--src/plugins/platforms/kms/qkmsudevdrmhandler.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/plugins/platforms/kms/qkmsudevdrmhandler.cpp b/src/plugins/platforms/kms/qkmsudevdrmhandler.cpp
new file mode 100644
index 0000000000..0f59de4cef
--- /dev/null
+++ b/src/plugins/platforms/kms/qkmsudevdrmhandler.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QRegExp>
+
+#include <qkmsintegration.h>
+#include <qkmsudevdrmhandler.h>
+
+QT_BEGIN_NAMESPACE
+
+QKmsUdevDRMHandler::QKmsUdevDRMHandler(QKmsIntegration *integration)
+ : m_integration(integration)
+{
+}
+
+QObject *QKmsUdevDRMHandler::create(struct udev_device *device)
+{
+ if (strcmp(udev_device_get_subsystem(device), "drm"))
+ return 0;
+
+ QRegExp regexp("^card\\d+$");
+ if (!regexp.exactMatch(udev_device_get_sysname(device)))
+ return 0;
+
+ return m_integration->createDevice(udev_device_get_devnode(device));
+}
+
+QT_END_NAMESPACE