From 5d0a6ffff17007e8820495f47f05232045c0709e Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 14 Oct 2019 11:39:29 +0200 Subject: [PATCH 1/3] NetworkDetector: Fix installation on buster arping isn't installed by default any more. We need to pull it in. --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index f6a5835a..8bda58a4 100644 --- a/debian/control +++ b/debian/control @@ -409,6 +409,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, nmap, fping, + arping, nymea-plugins-translations, Replaces: guh-plugin-networkdetector Description: nymea.io plugin for networkdetector From 99eb132775bb643d5783f9d897849722bcc20704 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 14 Oct 2019 11:49:20 +0200 Subject: [PATCH 2/3] Add error handling if arping isn't installed --- networkdetector/devicemonitor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/networkdetector/devicemonitor.cpp b/networkdetector/devicemonitor.cpp index 4a77e55b..a2dfd82e 100644 --- a/networkdetector/devicemonitor.cpp +++ b/networkdetector/devicemonitor.cpp @@ -16,6 +16,12 @@ DeviceMonitor::DeviceMonitor(const QString &name, const QString &macAddress, con m_arpingProcess = new QProcess(this); m_arpingProcess->setReadChannelMode(QProcess::MergedChannels); + connect(m_arpingProcess, &QProcess::errorOccurred, this, [this](QProcess::ProcessError error) { + if (error == QProcess::FailedToStart) { + warn(QString("arping process failed to start. Falling back to ping. This plugin might not work properly on this system.")); + ping(); + } + }); connect(m_arpingProcess, SIGNAL(finished(int)), this, SLOT(arpingFinished(int))); m_pingProcess = new QProcess(this); From 5e6bb05b8e6806a80dfaf22aeb17e9b7e1ad4211 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 14 Oct 2019 20:16:25 +0200 Subject: [PATCH 3/3] Build with xenial --- networkdetector/devicemonitor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/networkdetector/devicemonitor.cpp b/networkdetector/devicemonitor.cpp index a2dfd82e..fb22a02b 100644 --- a/networkdetector/devicemonitor.cpp +++ b/networkdetector/devicemonitor.cpp @@ -16,12 +16,15 @@ DeviceMonitor::DeviceMonitor(const QString &name, const QString &macAddress, con m_arpingProcess = new QProcess(this); m_arpingProcess->setReadChannelMode(QProcess::MergedChannels); +#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + // Actually we'd need this fix on older platforms too, but it's hard to figure this out without this API... connect(m_arpingProcess, &QProcess::errorOccurred, this, [this](QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { warn(QString("arping process failed to start. Falling back to ping. This plugin might not work properly on this system.")); ping(); } }); +#endif connect(m_arpingProcess, SIGNAL(finished(int)), this, SLOT(arpingFinished(int))); m_pingProcess = new QProcess(this);