From 303e9168eb912ef3c1f5e504b5aa45a3eed5d757 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 17 Jan 2020 16:02:31 +0100 Subject: eglfs: find correct framebuffer index even if device node is symlink Using the Vivante driver on a board with different device trees I found the need to let udev point me to the framebuffer actually connected to HDMI by adding a symlink. Since the extraction of the framebuffer index failed and always returned 0 the GUI still always showed up on the first framebuffer. Change-Id: Ib4aa0fdd6e85d296c17fd977921cbc78e52dcdcf Reviewed-by: Laszlo Agocs (cherry picked from commit dd23313d66846022894b56ad25b6c2c0fdb54762) --- src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 81bad45cd2..dbfb0e6058 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -52,6 +52,7 @@ #include #include #if QT_CONFIG(regularexpression) +# include # include #endif #include @@ -144,7 +145,12 @@ int QEglFSDeviceIntegration::framebufferIndex() const int fbIndex = 0; #if QT_CONFIG(regularexpression) QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)")); - QRegularExpressionMatch match = fbIndexRx.match(QString::fromLocal8Bit(fbDeviceName())); + QFileInfo fbinfo(QString::fromLocal8Bit(fbDeviceName())); + QRegularExpressionMatch match; + if (fbinfo.isSymLink()) + match = fbIndexRx.match(fbinfo.symLinkTarget()); + else + match = fbIndexRx.match(fbinfo.fileName()); if (match.hasMatch()) fbIndex = match.captured(1).toInt(); #endif -- cgit v1.2.3