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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 | 453 |
454 def MakeSystemFolderWritable(self): | 454 def MakeSystemFolderWritable(self): |
455 """Remounts the /system folder rw.""" | 455 """Remounts the /system folder rw.""" |
456 out = self._adb.SendCommand('remount') | 456 out = self._adb.SendCommand('remount') |
457 if out.strip() != 'remount succeeded': | 457 if out.strip() != 'remount succeeded': |
458 raise errors.MsgException('Remount failed: %s' % out) | 458 raise errors.MsgException('Remount failed: %s' % out) |
459 | 459 |
460 def RestartAdbServer(self): | 460 def RestartAdbServer(self): |
461 """Restart the adb server.""" | 461 """Restart the adb server.""" |
462 self.KillAdbServer() | 462 self.KillAdbServer() |
463 self.StartAdbServer() | 463 self.StartAdbServer() |
frankf
2013/08/14 18:34:11
Looks like we ignore the return code and silently
bulach
2013/08/14 19:23:56
ha, good catch! it's worse than that.. :)
I tried
| |
464 | 464 |
465 def KillAdbServer(self): | 465 def KillAdbServer(self): |
466 """Kill adb server.""" | 466 """Kill adb server.""" |
467 adb_cmd = [constants.ADB_PATH, 'kill-server'] | 467 adb_cmd = [constants.ADB_PATH, 'kill-server'] |
468 return cmd_helper.RunCmd(adb_cmd) | 468 return cmd_helper.RunCmd(adb_cmd) |
469 | 469 |
470 def StartAdbServer(self): | 470 def StartAdbServer(self): |
471 """Start adb server.""" | 471 """Start adb server.""" |
472 adb_cmd = [constants.ADB_PATH, 'start-server'] | 472 adb_cmd = ['taskset', '-c', '0', constants.ADB_PATH, 'start-server'] |
473 return cmd_helper.RunCmd(adb_cmd) | 473 return cmd_helper.RunCmd(adb_cmd) |
474 | 474 |
475 def WaitForSystemBootCompleted(self, wait_time): | 475 def WaitForSystemBootCompleted(self, wait_time): |
476 """Waits for targeted system's boot_completed flag to be set. | 476 """Waits for targeted system's boot_completed flag to be set. |
477 | 477 |
478 Args: | 478 Args: |
479 wait_time: time in seconds to wait | 479 wait_time: time in seconds to wait |
480 | 480 |
481 Raises: | 481 Raises: |
482 WaitForResponseTimedOutError if wait_time elapses and flag still not | 482 WaitForResponseTimedOutError if wait_time elapses and flag still not |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1519 """ | 1519 """ |
1520 def __init__(self, output): | 1520 def __init__(self, output): |
1521 self._output = output | 1521 self._output = output |
1522 | 1522 |
1523 def write(self, data): | 1523 def write(self, data): |
1524 data = data.replace('\r\r\n', '\n') | 1524 data = data.replace('\r\r\n', '\n') |
1525 self._output.write(data) | 1525 self._output.write(data) |
1526 | 1526 |
1527 def flush(self): | 1527 def flush(self): |
1528 self._output.flush() | 1528 self._output.flush() |
OLD | NEW |