OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Provides an interface to communicate with the device via the adb command. | 5 """Provides an interface to communicate with the device via the adb command. |
6 | 6 |
7 Assumes adb binary is currently on system path. | 7 Assumes adb binary is currently on system path. |
8 """ | 8 """ |
9 | 9 |
10 import collections | 10 import collections |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 return ret | 495 return ret |
496 | 496 |
497 def StartAdbServer(self): | 497 def StartAdbServer(self): |
498 """Start adb server.""" | 498 """Start adb server.""" |
499 adb_cmd = ['taskset', '-c', '0', constants.ADB_PATH, 'start-server'] | 499 adb_cmd = ['taskset', '-c', '0', constants.ADB_PATH, 'start-server'] |
500 ret = cmd_helper.RunCmd(adb_cmd) | 500 ret = cmd_helper.RunCmd(adb_cmd) |
501 retry = 0 | 501 retry = 0 |
502 while retry < 3: | 502 while retry < 3: |
503 ret = cmd_helper.RunCmd(['pgrep', 'adb']) | 503 ret = cmd_helper.RunCmd(['pgrep', 'adb']) |
504 if ret == 0: | 504 if ret == 0: |
505 # pgrep fonud adb, start-server succeeded. | 505 # pgrep found adb, start-server succeeded. |
| 506 # Waiting for device to reconnect before returning success. |
| 507 self._adb.SendCommand('wait-for-device') |
506 return 0 | 508 return 0 |
507 retry += 1 | 509 retry += 1 |
508 time.sleep(retry) | 510 time.sleep(retry) |
509 return ret | 511 return ret |
510 | 512 |
511 def WaitForSystemBootCompleted(self, wait_time): | 513 def WaitForSystemBootCompleted(self, wait_time): |
512 """Waits for targeted system's boot_completed flag to be set. | 514 """Waits for targeted system's boot_completed flag to be set. |
513 | 515 |
514 Args: | 516 Args: |
515 wait_time: time in seconds to wait | 517 wait_time: time in seconds to wait |
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 """ | 1705 """ |
1704 def __init__(self, output): | 1706 def __init__(self, output): |
1705 self._output = output | 1707 self._output = output |
1706 | 1708 |
1707 def write(self, data): | 1709 def write(self, data): |
1708 data = data.replace('\r\r\n', '\n') | 1710 data = data.replace('\r\r\n', '\n') |
1709 self._output.write(data) | 1711 self._output.write(data) |
1710 | 1712 |
1711 def flush(self): | 1713 def flush(self): |
1712 self._output.flush() | 1714 self._output.flush() |
OLD | NEW |