summaryrefslogtreecommitdiffstats
path: root/tools/runonphone/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/runonphone/main.cpp')
-rw-r--r--tools/runonphone/main.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp
index 39fa983..6dd53fc 100644
--- a/tools/runonphone/main.cpp
+++ b/tools/runonphone/main.cpp
@@ -70,7 +70,8 @@ void printUsage(QTextStream& outstream, QString exeName)
<< "-T, --tempfile <remote file> specify temporary sis file name" << endl
<< "--nocrashlog Don't capture call stack if test crashes" << endl
<< "--crashlogpath <dir> Path to save crash logs (default=working dir)" << endl
- << "--coda Use CODA instead of TRK (default agent)" << endl
+ << "--coda Use CODA instead of detecting the debug agent" << endl
+ << "--trk Use TRK instead of detecting the debug agent" << endl
<< endl
<< "USB COM ports can usually be autodetected, use -p or -f to force a specific port." << endl
<< "TRK is the default debugging agent, use --coda option when using CODA instead of TRK." << endl
@@ -99,7 +100,7 @@ int main(int argc, char *argv[])
int loglevel=1;
int timeout=0;
bool crashlog = true;
- bool coda = false;
+ enum {AgentUnknown, AgentCoda, AgentTRK} debugAgent = AgentUnknown;
QString crashlogpath;
QListIterator<QString> it(args);
it.next(); //skip name of program
@@ -154,7 +155,9 @@ int main(int argc, char *argv[])
}
}
else if (arg == "--coda")
- coda = true;
+ debugAgent = AgentCoda;
+ else if (arg == "--trk")
+ debugAgent = AgentTRK;
else if (arg == "--tempfile" || arg == "-T") {
CHECK_PARAMETER_EXISTS
dstName = it.next();
@@ -225,7 +228,24 @@ int main(int argc, char *argv[])
QFileInfo info(exeFile);
QFileInfo uploadInfo(uploadLocalFile);
- if (coda) {
+ if (debugAgent == AgentUnknown) {
+ outstream << "detecting debug agent..." << endl;
+ CodaSignalHandler codaDetector;
+ //auto detect agent
+ codaDetector.setSerialPortName(serialPortName);
+ codaDetector.setLogLevel(loglevel);
+ codaDetector.setActionType(ActionPingOnly);
+ codaDetector.setTimeout(1000);
+ if (!codaDetector.run()) {
+ debugAgent = AgentCoda;
+ outstream << " - Coda is found" << endl;
+ } else {
+ debugAgent = AgentTRK;
+ outstream << " - Coda is not found, defaulting to TRK" << endl;
+ }
+ }
+
+ if (debugAgent == AgentCoda) {
codaHandler.setSerialPortName(serialPortName);
codaHandler.setLogLevel(loglevel);
@@ -257,7 +277,8 @@ int main(int argc, char *argv[])
return codaHandler.run();
} else {
- launcher.reset(new trk::Launcher(trk::Launcher::ActionPingOnly));
+ launcher.reset(new trk::Launcher(trk::Launcher::ActionPingOnly,
+ SymbianUtils::SymbianDeviceManager::instance()->acquireDevice(serialPortName)));
QStringList srcNames, dstNames;
if (!sisFile.isEmpty()) {
launcher->addStartupActions(trk::Launcher::ActionCopyInstall);