Merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/fixdevicedetection into lp:qtcreator-plugin-ubuntu

Proposed by Benjamin Zeller
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 391
Merged at revision: 397
Proposed branch: lp:~zeller-benjamin/qtcreator-plugin-ubuntu/fixdevicedetection
Merge into: lp:qtcreator-plugin-ubuntu
Diff against target: 158 lines (+31/-8)
1 file modified
src/ubuntu/ubuntudevice.cpp (+31/-8)
To merge this branch: bzr merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/fixdevicedetection
Reviewer Review Type Date Requested Status
Zoltan Balogh Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+259729@code.launchpad.net

Commit message

Fix bug lp:1456627 "Almost unusuable while non-Ubuntu device connected through adb"

Description of the change

Fix bug lp:1456627 "Almost unusuable while non-Ubuntu device connected through adb"

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

OK

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/ubuntu/ubuntudevice.cpp'
--- src/ubuntu/ubuntudevice.cpp 2015-05-05 09:38:13 +0000
+++ src/ubuntu/ubuntudevice.cpp 2015-05-21 08:14:58 +0000
@@ -159,14 +159,11 @@
159{159{
160 Q_UNUSED(code)160 Q_UNUSED(code)
161161
162 if (code == 0) {162
163 m_errorCount = 0;163 if(m_errorCount > 3) {
164 } else {164 setProcessState(UbuntuDevice::Failed);
165 if(m_errorCount > 3) {165 m_reply.clear();
166 setProcessState(UbuntuDevice::Failed);166 return;
167 m_reply.clear();
168 return;
169 }
170 }167 }
171168
172 switch(m_dev->m_processState) {169 switch(m_dev->m_processState) {
@@ -176,6 +173,8 @@
176 m_errorCount++;173 m_errorCount++;
177 waitForEmulatorStart();174 waitForEmulatorStart();
178 break;175 break;
176 } else {
177 m_errorCount = 0;
179 }178 }
180179
181 m_dev->m_emulatorSerial = m_reply.trimmed();180 m_dev->m_emulatorSerial = m_reply.trimmed();
@@ -191,6 +190,8 @@
191 m_errorCount++;190 m_errorCount++;
192 waitForBoot();191 waitForBoot();
193 break;192 break;
193 } else {
194 m_errorCount = 0;
194 }195 }
195 //for now the script will wait forever until the shell is available196 //for now the script will wait forever until the shell is available
196 detect();197 detect();
@@ -220,6 +221,8 @@
220 break;221 break;
221 }222 }
222223
224 m_errorCount = 0;
225
223 m_dev->m_framework = framework;226 m_dev->m_framework = framework;
224227
225 //will trigger the device updated signal228 //will trigger the device updated signal
@@ -235,6 +238,8 @@
235 m_errorCount++;238 m_errorCount++;
236 detectHasNetworkConnection();239 detectHasNetworkConnection();
237 break;240 break;
241 } else {
242 m_errorCount = 0;
238 }243 }
239244
240 if (m_reply.trimmed() == QString::fromLatin1(Constants::ONE_STR)) {245 if (m_reply.trimmed() == QString::fromLatin1(Constants::ONE_STR)) {
@@ -258,6 +263,7 @@
258 break;263 break;
259 }264 }
260 case UbuntuDevice::CloneNetwork:{265 case UbuntuDevice::CloneNetwork:{
266 m_errorCount = 0;
261 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_NETWORK_CONF_COPIED));267 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_NETWORK_CONF_COPIED));
262 detectHasNetworkConnection();268 detectHasNetworkConnection();
263 break;269 break;
@@ -267,6 +273,8 @@
267 m_errorCount++;273 m_errorCount++;
268 detectOpenSsh();274 detectOpenSsh();
269 break;275 break;
276 } else {
277 m_errorCount = 0;
270 }278 }
271279
272 if (m_reply.trimmed() != QLatin1String(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_NONE)280 if (m_reply.trimmed() != QLatin1String(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_NONE)
@@ -299,12 +307,14 @@
299 break;307 break;
300 }308 }
301 case UbuntuDevice::InstallOpenSSH:{309 case UbuntuDevice::InstallOpenSSH:{
310 m_errorCount = 0;
302 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_SSH_WAS_INSTALLED));311 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_SSH_WAS_INSTALLED));
303312
304 detectOpenSsh();313 detectOpenSsh();
305 break;314 break;
306 }315 }
307 case UbuntuDevice::RemoveOpenSSH:{316 case UbuntuDevice::RemoveOpenSSH:{
317 m_errorCount = 0;
308 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_SSH_WAS_REMOVED));318 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_SSH_WAS_REMOVED));
309319
310 detectOpenSsh();320 detectOpenSsh();
@@ -315,6 +325,8 @@
315 m_errorCount++;325 m_errorCount++;
316 startSshService();326 startSshService();
317 break;327 break;
328 } else {
329 m_errorCount = 0;
318 }330 }
319331
320 if(m_dev->m_openSSHStarted != UbuntuDevice::Available) {332 if(m_dev->m_openSSHStarted != UbuntuDevice::Available) {
@@ -327,6 +339,7 @@
327 break;339 break;
328 }340 }
329 case UbuntuDevice::EnablePortForwarding:{341 case UbuntuDevice::EnablePortForwarding:{
342 m_errorCount = 0;
330 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_PORTS_FORWARDED));343 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_PORTS_FORWARDED));
331344
332 deployPublicKey();345 deployPublicKey();
@@ -337,6 +350,8 @@
337 m_errorCount++;350 m_errorCount++;
338 deployPublicKey();351 deployPublicKey();
339 break;352 break;
353 } else {
354 m_errorCount = 0;
340 }355 }
341 //ready to use356 //ready to use
342 ProjectExplorer::DeviceManager::instance()->setDeviceState(m_dev->id(),ProjectExplorer::IDevice::DeviceReadyToUse);357 ProjectExplorer::DeviceManager::instance()->setDeviceState(m_dev->id(),ProjectExplorer::IDevice::DeviceReadyToUse);
@@ -350,6 +365,8 @@
350 m_errorCount++;365 m_errorCount++;
351 detectDeviceWritableImage();366 detectDeviceWritableImage();
352 break;367 break;
368 } else {
369 m_errorCount = 0;
353 }370 }
354371
355 if (m_reply.trimmed() == QLatin1String(Constants::ZERO_STR)) {372 if (m_reply.trimmed() == QLatin1String(Constants::ZERO_STR)) {
@@ -369,6 +386,8 @@
369 m_errorCount++;386 m_errorCount++;
370 detectDeveloperTools();387 detectDeveloperTools();
371 break;388 break;
389 } else {
390 m_errorCount = 0;
372 }391 }
373392
374 setProcessState(UbuntuDevice::Done);393 setProcessState(UbuntuDevice::Done);
@@ -385,18 +404,22 @@
385 break;404 break;
386 }405 }
387 case UbuntuDevice::EnableRWImage:406 case UbuntuDevice::EnableRWImage:
407 m_errorCount = 0;
388 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_WRITABLE_ENABLED));408 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_WRITABLE_ENABLED));
389 detectDeviceWritableImage();409 detectDeviceWritableImage();
390 break;410 break;
391 case UbuntuDevice::DisableRWImage:411 case UbuntuDevice::DisableRWImage:
412 m_errorCount = 0;
392 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_WRITABLE_DISABLED));413 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_WRITABLE_DISABLED));
393 detectDeviceWritableImage();414 detectDeviceWritableImage();
394 break;415 break;
395 case UbuntuDevice::InstallDevTools:416 case UbuntuDevice::InstallDevTools:
417 m_errorCount = 0;
396 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_DEVELOPERTOOLS_WAS_INSTALLED));418 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_DEVELOPERTOOLS_WAS_INSTALLED));
397 detectDeveloperTools();419 detectDeveloperTools();
398 break;420 break;
399 case UbuntuDevice::RemoveDevTools:421 case UbuntuDevice::RemoveDevTools:
422 m_errorCount = 0;
400 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_DEVELOPERTOOLS_REMOVED));423 endAction(QString::fromLatin1(Constants::UBUNTUDEVICESWIDGET_ONFINISHED_DEVELOPERTOOLS_REMOVED));
401 detectDeveloperTools();424 detectDeveloperTools();
402 break;425 break;

Subscribers

People subscribed via source and target branches