Skip to content

Commit

Permalink
Fixed program launching on the Pi 4
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatyas committed Oct 9, 2019
1 parent 65120ae commit 179e38d
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
- QT_TARGET: rpi4-static
steps:
- checkout
- run: git apply ./etc/rpi4/kms_launch_fix.diff
- run: .circleci/prepare.sh
- run: .circleci/build.sh
- run: arm-linux-gnueabihf-objdump -p installdir/opt/pegasus-frontend/pegasus-fe | grep 'NEEDED' | sort
Expand Down
86 changes: 86 additions & 0 deletions etc/rpi4/kms_launch_fix.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
diff --git a/src/backend/ProcessLauncher.cpp b/src/backend/ProcessLauncher.cpp
index d39cce9..b994aeb 100644
--- a/src/backend/ProcessLauncher.cpp
+++ b/src/backend/ProcessLauncher.cpp
@@ -28,6 +28,14 @@
#include <QDir>
#include <QRegularExpression>

+#define private public
+#include <QGuiApplication>
+#include <private/qeglfsintegration_p.h>
+#undef private
+#include <private/qfbvthandler_p.h>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+

namespace {
static constexpr auto SEPARATOR = "----------------------------------------";
@@ -165,7 +173,6 @@ void ProcessLauncher::runProcess(const QString& command, const QStringList& args
m_process = new QProcess(this);

// set up signals and slots
- connect(m_process, &QProcess::started, this, &ProcessLauncher::onProcessStarted);
connect(m_process, &QProcess::errorOccurred, this, &ProcessLauncher::onProcessError);
connect(m_process, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
this, &ProcessLauncher::onProcessFinished);
@@ -174,15 +181,28 @@ void ProcessLauncher::runProcess(const QString& command, const QStringList& args
m_process->setProcessChannelMode(QProcess::ForwardedChannels);
m_process->setInputChannelMode(QProcess::ForwardedInputChannel);
m_process->setWorkingDirectory(workdir);
- m_process->start(command, args, QProcess::ReadOnly);
- m_process->waitForStarted(-1);
+ m_process->setProgram(command);
+ m_process->setArguments(args);
+ onProcessStarted();
}

void ProcessLauncher::onTeardownComplete()
{
Q_ASSERT(m_process);

+ auto platint = static_cast<QEglFSIntegration* const>(QGuiApplicationPrivate::platformIntegration());
+
+ platint->destroy();
+ platint->m_vtHandler.reset(nullptr);
+
+ m_process->start(QProcess::ReadOnly);
m_process->waitForFinished(-1);
+
+ const bool backup = platint->m_disableInputHandlers;
+ platint->m_disableInputHandlers = true;
+ platint->initialize();
+ platint->m_disableInputHandlers = backup;
+
emit processFinished();
}

@@ -236,7 +256,6 @@ void ProcessLauncher::onProcessFinished(int exitcode, QProcess::ExitStatus exits

void ProcessLauncher::beforeRun()
{
- TerminalKbd::enable();
ScriptRunner::run(ScriptEvent::PROCESS_STARTED);
}

@@ -247,5 +266,4 @@ void ProcessLauncher::afterRun()
m_process = nullptr;

ScriptRunner::run(ScriptEvent::PROCESS_FINISHED);
- TerminalKbd::disable();
}
diff --git a/src/backend/backend.pro b/src/backend/backend.pro
index fe116bd..e5d61a9 100644
--- a/src/backend/backend.pro
+++ b/src/backend/backend.pro
@@ -8,6 +8,9 @@ android: QT += androidextras
else: QT += gamepad


+QT += gui-private eglfsdeviceintegration-private
+
+
SOURCES += \
Api.cpp \
AppContext.cpp \

0 comments on commit 179e38d

Please sign in to comment.