DeviceSupport: Implement DesktopDevice::portsGatheringMethod()

The feature is useful in a QtApplicationManager debugging context.

Internally, DeviceUsedPortsGatherer uses a DeviceProcess now,
not an SshRemoteProcess, to cover cases where the (Windows Desktop)
device not have ssh available.

Change-Id: I9d33ceac65a135123a376ebd2727dcb540563179
Reviewed-by: Wolfgang Bremer <wolfgang.bremer@pelagicore.com>
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2017-08-07 18:54:01 +02:00
parent 4048629d1a
commit 7f87e2af3c
7 changed files with 152 additions and 60 deletions

View File

@@ -35,6 +35,7 @@
#include <coreplugin/id.h>
#include <projectexplorer/devicesupport/sshdeviceprocesslist.h>
#include <projectexplorer/runnables.h>
#include <ssh/sshremoteprocessrunner.h>
#include <utils/algorithm.h>
#include <utils/port.h>
@@ -122,7 +123,7 @@ private:
class LinuxPortsGatheringMethod : public PortsGatheringMethod
{
QByteArray commandLine(QAbstractSocket::NetworkLayerProtocol protocol) const
Runnable runnable(QAbstractSocket::NetworkLayerProtocol protocol) const
{
// We might encounter the situation that protocol is given IPv6
// but the consumer of the free port information decides to open
@@ -135,7 +136,10 @@ class LinuxPortsGatheringMethod : public PortsGatheringMethod
Q_UNUSED(protocol)
// /proc/net/tcp* covers /proc/net/tcp and /proc/net/tcp6
return "sed -e 's/.*: [[:xdigit:]]*:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp*";
StandardRunnable runnable;
runnable.executable = "sed";
runnable.commandLineArguments = "-e 's/.*: [[:xdigit:]]*:\\([[:xdigit:]]\\{4\\}\\).*/\\1/g' /proc/net/tcp*";
return runnable;
}
QList<Utils::Port> usedPorts(const QByteArray &output) const