Commit cb57b800 authored by Don Gagne's avatar Don Gagne

No port tests while unit testing

parent 246d48f7
...@@ -196,39 +196,41 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -196,39 +196,41 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#ifndef __mobile__ #ifndef __mobile__
if (getuid() == 0) { if (!_runningUnitTests) {
QMessageBox msgBox; if (getuid() == 0) {
msgBox.setInformativeText("You are runnning QGroundControl as root. " QMessageBox msgBox;
"You should not do this since it will cause other issues with QGroundControl. " msgBox.setInformativeText("You are runnning QGroundControl as root. "
"QGroundControl will now exit. " "You should not do this since it will cause other issues with QGroundControl. "
"If you are having serial port issues on Ubuntu, execute the following commands to fix most issues:\n" "QGroundControl will now exit. "
"sudo usermod -a -G dialout $USER\n" "If you are having serial port issues on Ubuntu, execute the following commands to fix most issues:\n"
"sudo apt-get remove modemmanager"); "sudo usermod -a -G dialout $USER\n"
msgBox.setStandardButtons(QMessageBox::Ok); "sudo apt-get remove modemmanager");
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec(); msgBox.setDefaultButton(QMessageBox::Ok);
_exit(0); msgBox.exec();
} _exit(0);
}
// Determine if we have the correct permissions to access USB serial devices // Determine if we have the correct permissions to access USB serial devices
QFile permFile("/etc/group"); QFile permFile("/etc/group");
if(permFile.open(QIODevice::ReadOnly)) { if(permFile.open(QIODevice::ReadOnly)) {
while(!permFile.atEnd()) { while(!permFile.atEnd()) {
QString line = permFile.readLine(); QString line = permFile.readLine();
if (line.contains("dialout") && !line.contains(getenv("USER"))) { if (line.contains("dialout") && !line.contains(getenv("USER"))) {
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setInformativeText("The current user does not have the correct permissions to access serial devices. " msgBox.setInformativeText("The current user does not have the correct permissions to access serial devices. "
"You should also remove modemmanager since it also interferes. " "You should also remove modemmanager since it also interferes. "
"If you are using Ubuntu, execute the following commands to fix these issues:\n" "If you are using Ubuntu, execute the following commands to fix these issues:\n"
"sudo usermod -a -G dialout $USER\n" "sudo usermod -a -G dialout $USER\n"
"sudo apt-get remove modemmanager"); "sudo apt-get remove modemmanager");
msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.exec(); msgBox.exec();
break; break;
}
} }
permFile.close();
} }
permFile.close();
} }
#endif #endif
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment