Merge pull request #54 from setime/workaround-ubuntu-22_04

Workaround to get the GUI working on Ubuntu 22.04
dev
Self Not Found 1 year ago committed by GitHub
commit 38c7916715
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -35,19 +35,19 @@ void PM3Process::connectPM3(const QString& path, const QStringList args)
waitForReadyRead(10000);
setRequiringOutput(false);
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("[=]"))
{
clientType = Util::CLIENTTYPE_ICEMAN;
setRequiringOutput(true);
write("hw version\n");
for(int i = 0; i < 50; i++)
{
waitForReadyRead(200);
result += *requiredOutput;
if(result.contains("os: "))
break;
}
setRequiringOutput(false);
readWaitForConnection(&result);
}
else
{
@ -72,6 +72,18 @@ void PM3Process::connectPM3(const QString& path, const QStringList args)
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()
{
connectPM3(currPath, currArgs);

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

Loading…
Cancel
Save