summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-21 17:57:54 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-21 17:57:54 +0100
commit46791c08e17740418cc701b8862a980c0f711b87 (patch)
treebedba63fc48b80c2a2df54ea91c3f35398953aac /src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
parentb8a38a6737acd670d92197ca5b009590d9fd8a9c (diff)
parent9033977d3971db5352a2bb51052a723a2ac57a8f (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfshooks_stub.cpp')
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
index f5467fd6a4..b81d260ecb 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
@@ -42,6 +42,7 @@
#include "qeglfshooks.h"
#include <QtPlatformSupport/private/qeglplatformcursor_p.h>
#include <QtPlatformSupport/private/qeglconvenience_p.h>
+#include <QtCore/QRegularExpression>
#include <fcntl.h>
#include <unistd.h>
@@ -56,17 +57,34 @@ QT_BEGIN_NAMESPACE
// this is a global static to keep the QEglFSHooks interface as clean as possible
static int framebuffer = -1;
-const char *QEglFSHooks::fbDeviceName() const
+QByteArray QEglFSHooks::fbDeviceName() const
{
- return "/dev/fb0";
+ QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB");
+ if (fbDev.isEmpty())
+ fbDev = QByteArrayLiteral("/dev/fb0");
+
+ return fbDev;
+}
+
+int QEglFSHooks::framebufferIndex() const
+{
+ int fbIndex = 0;
+ QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)"));
+ QRegularExpressionMatch match = fbIndexRx.match(fbDeviceName());
+ if (match.hasMatch())
+ fbIndex = match.captured(1).toInt();
+
+ return fbIndex;
}
void QEglFSHooks::platformInit()
{
- framebuffer = qt_safe_open(fbDeviceName(), O_RDONLY);
+ QByteArray fbDev = fbDeviceName();
+
+ framebuffer = qt_safe_open(fbDev, O_RDONLY);
if (framebuffer == -1)
- qWarning("EGLFS: Failed to open %s", fbDeviceName());
+ qWarning("EGLFS: Failed to open %s", qPrintable(fbDev));
}
void QEglFSHooks::platformDestroy()