1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
// Copyright (C) 2016 BlackBerry Limited. All rights reserved.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qnxdevice.h"
#include "qnxconstants.h"
#include "qnxdeployqtlibrariesdialog.h"
#include "qnxdevicetester.h"
#include "qnxtr.h"
#include <coreplugin/icore.h>
#include <projectexplorer/devicesupport/idevicefactory.h>
#include <projectexplorer/devicesupport/sshparameters.h>
#include <remotelinux/linuxdevice.h>
#include <remotelinux/remotelinux_constants.h>
#include <remotelinux/remotelinuxsignaloperation.h>
#include <remotelinux/sshdevicewizard.h>
#include <utils/port.h>
#include <utils/portlist.h>
#include <utils/qtcprocess.h>
#include <utils/qtcassert.h>
#include <utils/wizard.h>
using namespace ProjectExplorer;
using namespace RemoteLinux;
using namespace Utils;
namespace Qnx::Internal {
static QString signalProcessByNameQnxCommandLine(const QString &filePath, int sig)
{
QString executable = filePath;
return QString::fromLatin1("for PID in $(ps -f -o pid,comm | grep %1 | awk '/%1/ {print $1}'); "
"do "
"kill -%2 $PID; "
"done").arg(executable.replace(QLatin1String("/"), QLatin1String("\\/"))).arg(sig);
}
class QnxDeviceProcessSignalOperation : public RemoteLinuxSignalOperation
{
public:
explicit QnxDeviceProcessSignalOperation(const IDeviceConstPtr &device)
: RemoteLinuxSignalOperation(device)
{}
QString killProcessByNameCommandLine(const QString &filePath) const override
{
return QString::fromLatin1("%1; %2").arg(signalProcessByNameQnxCommandLine(filePath, 15),
signalProcessByNameQnxCommandLine(filePath, 9));
}
};
class QnxDevice final : public LinuxDevice
{
public:
QnxDevice()
{
setDisplayType(Tr::tr("QNX"));
setDefaultDisplayName(Tr::tr("QNX Device"));
setOsType(OsTypeOtherUnix);
setupId(IDevice::ManuallyAdded);
setType(Constants::QNX_QNX_OS_TYPE);
setMachineType(IDevice::Hardware);
SshParameters sshParams;
sshParams.timeout = 10;
setSshParameters(sshParams);
setFreePorts(PortList::fromString("10000-10100"));
setExtraData(RemoteLinux::Constants::SourceProfile, true);
addDeviceAction({Tr::tr("Deploy Qt libraries..."), [](const IDevice::Ptr &device, QWidget *parent) {
QnxDeployQtLibrariesDialog dialog(device, parent);
dialog.exec();
}});
}
DeviceProcessSignalOperation::Ptr signalOperation() const final
{
return DeviceProcessSignalOperation::Ptr(new QnxDeviceProcessSignalOperation(shared_from_this()));
}
DeviceTester *createDeviceTester() const final { return new QnxDeviceTester; }
};
class QnxDeviceFactory final : public IDeviceFactory
{
public:
QnxDeviceFactory() : IDeviceFactory(Constants::QNX_QNX_OS_TYPE)
{
setDisplayName(Tr::tr("QNX Device"));
setCombinedIcon(":/qnx/images/qnxdevicesmall.png",
":/qnx/images/qnxdevice.png");
setQuickCreationAllowed(true);
setConstructionFunction([] { return IDevice::Ptr(new QnxDevice); });
setCreator([]() -> IDevice::Ptr {
const IDevice::Ptr device = IDevice::Ptr(new QnxDevice);
SshDeviceWizard wizard(Tr::tr("New QNX Device Configuration Setup"), device);
if (wizard.exec() != QDialog::Accepted)
return {};
return device;
});
}
};
void setupQnxDevice()
{
static QnxDeviceFactory theQnxDeviceFactory;
}
} // Qnx::Internal
|