Workaround to get the GUI working on Ubuntu 22.04

pull/54/head
setime 1 year ago committed by Sebastian
parent e2fb18970e
commit 687c27672f

@ -35,19 +35,19 @@ void PM3Process::connectPM3(const QString& path, const QStringList args)
waitForReadyRead(10000); waitForReadyRead(10000);
setRequiringOutput(false); setRequiringOutput(false);
result = *requiredOutput; result = *requiredOutput;
// Workaround for wayland system, e.g. Ubuntu 22.04
// The issue is that the warning is read and nothing else, hence the process is killed.
if(result.contains("Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway."))
{
setRequiringOutput(true);
readWaitForConnection(&result);
}
if(result.contains("[=]")) if(result.contains("[=]"))
{ {
clientType = Util::CLIENTTYPE_ICEMAN; clientType = Util::CLIENTTYPE_ICEMAN;
setRequiringOutput(true); setRequiringOutput(true);
write("hw version\n"); write("hw version\n");
for(int i = 0; i < 50; i++) readWaitForConnection(&result);
{
waitForReadyRead(200);
result += *requiredOutput;
if(result.contains("os: "))
break;
}
setRequiringOutput(false);
} }
else else
{ {
@ -72,6 +72,18 @@ void PM3Process::connectPM3(const QString& path, const QStringList args)
setRequiringOutput(false); setRequiringOutput(false);
} }
void PM3Process::readWaitForConnection(QString *result)
{
for(int i = 0; i < 50; i++)
{
waitForReadyRead(200);
(*result) += *requiredOutput;
if(result->contains("os: "))
break;
}
setRequiringOutput(false);
}
void PM3Process::reconnectPM3() void PM3Process::reconnectPM3()
{ {
connectPM3(currPath, currArgs); connectPM3(currPath, currArgs);

@ -38,6 +38,7 @@ private:
bool isRequiringOutput; bool isRequiringOutput;
QString* requiredOutput; // It only works in this class now QString* requiredOutput; // It only works in this class now
void setRequiringOutput(bool st);// It only works in this class now void setRequiringOutput(bool st);// It only works in this class now
void readWaitForConnection(QString *result);
QTimer* serialListener; QTimer* serialListener;
QSerialPortInfo* portInfo; QSerialPortInfo* portInfo;
QString currPath; QString currPath;

Loading…
Cancel
Save