131 if(exeFile.isEmpty()) { |
131 if(exeFile.isEmpty()) { |
132 printUsage(outstream); |
132 printUsage(outstream); |
133 return 1; |
133 return 1; |
134 } |
134 } |
135 |
135 |
136 if(serialPortName.isEmpty()) { |
136 if (serialPortName.isEmpty()) { |
137 if(loglevel > 0) |
137 if (loglevel > 0) |
138 outstream << "Detecting serial ports" << endl; |
138 outstream << "Detecting serial ports" << endl; |
139 QList <SerialPortId> ports = enumerateSerialPorts(); |
139 QList <SerialPortId> ports = enumerateSerialPorts(); |
140 foreach(SerialPortId id, ports) { |
140 foreach(SerialPortId id, ports) { |
141 if(loglevel > 0) |
141 if (loglevel > 0) |
142 outstream << "Port Name: " << id.portName << ", " |
142 outstream << "Port Name: " << id.portName << ", " |
143 << "Friendly Name:" << id.friendlyName << endl; |
143 << "Friendly Name:" << id.friendlyName << endl; |
144 if(serialPortName.isEmpty()) { |
144 if (serialPortName.isEmpty()) { |
145 if(!id.friendlyName.isEmpty() && |
145 if (!id.friendlyName.isEmpty() |
146 serialPortFriendlyName.isEmpty() && |
146 && serialPortFriendlyName.isEmpty() |
147 (id.friendlyName.contains("symbian", Qt::CaseInsensitive) || |
147 && (id.friendlyName.contains("symbian", Qt::CaseInsensitive) |
148 id.friendlyName.contains("s60", Qt::CaseInsensitive) || |
148 || id.friendlyName.contains("s60", Qt::CaseInsensitive) |
149 id.friendlyName.contains("nokia", Qt::CaseInsensitive))) |
149 || id.friendlyName.contains("nokia", Qt::CaseInsensitive))) |
150 serialPortName = id.portName; |
150 serialPortName = id.portName; |
151 else if (!id.friendlyName.isEmpty() && |
151 else if (!id.friendlyName.isEmpty() |
152 !serialPortFriendlyName.isEmpty() && |
152 && !serialPortFriendlyName.isEmpty() |
153 id.friendlyName.contains(serialPortFriendlyName)) |
153 && id.friendlyName.contains(serialPortFriendlyName)) |
154 serialPortName = id.portName; |
154 serialPortName = id.portName; |
155 } |
155 } |
156 } |
156 } |
157 if(serialPortName.isEmpty()) { |
157 if (serialPortName.isEmpty()) { |
158 errstream << "No phone found, ensure USB cable is connected or specify manually with -p" << endl; |
158 errstream << "No phone found, ensure USB cable is connected or specify manually with -p" << endl; |
159 return 1; |
159 return 1; |
160 } |
160 } |
161 } |
161 } |
162 |
162 |
163 QScopedPointer<trk::Launcher> launcher; |
163 QScopedPointer<trk::Launcher> launcher; |
164 |
164 |
165 if(sisFile.isEmpty()) { |
165 if (sisFile.isEmpty()) { |
166 launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyRun)); |
166 launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyRun)); |
167 launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + exeFile); |
167 launcher->setCopyFileName(exeFile, QString("c:\\sys\\bin\\") + exeFile); |
168 errstream << "System TRK required to copy EXE, use --sis if using Application TRK" << endl; |
168 errstream << "System TRK required to copy EXE, use --sis if using Application TRK" << endl; |
169 } else { |
169 } else { |
170 launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyInstallRun)); |
170 launcher.reset(new trk::Launcher(trk::Launcher::ActionCopyInstallRun)); |
171 launcher->addStartupActions(trk::Launcher::ActionInstall); |
171 launcher->addStartupActions(trk::Launcher::ActionInstall); |
172 launcher->setCopyFileName(sisFile, "c:\\data\\testtemp.sis"); |
172 launcher->setCopyFileName(sisFile, "c:\\data\\testtemp.sis"); |
173 launcher->setInstallFileName("c:\\data\\testtemp.sis"); |
173 launcher->setInstallFileName("c:\\data\\testtemp.sis"); |
174 } |
174 } |
175 if(loglevel > 0) |
175 if (loglevel > 0) |
176 outstream << "Connecting to target via " << serialPortName << endl; |
176 outstream << "Connecting to target via " << serialPortName << endl; |
177 #ifdef Q_OS_WIN |
|
178 launcher->setTrkServerName(QString("\\\\.\\") + serialPortName); |
|
179 #else |
|
180 launcher->setTrkServerName(serialPortName); |
177 launcher->setTrkServerName(serialPortName); |
181 #endif |
|
182 |
178 |
183 launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile); |
179 launcher->setFileName(QString("c:\\sys\\bin\\") + exeFile); |
184 launcher->setCommandLineArgs(cmdLine); |
180 launcher->setCommandLineArgs(cmdLine); |
185 |
181 |
186 if(loglevel > 1) |
182 if (loglevel > 1) |
187 launcher->setVerbose(1); |
183 launcher->setVerbose(1); |
188 |
184 |
189 TrkSignalHandler handler; |
185 TrkSignalHandler handler; |
190 handler.setLogLevel(loglevel); |
186 handler.setLogLevel(loglevel); |
191 |
187 |