()
| 459 | # Return a list of the serial numbers of connected devices. Emulators will have |
| 460 | # serials of the form "emulator-5678". |
| 461 | async def list_devices(): |
| 462 | serials = [] |
| 463 | header_found = False |
| 464 | |
| 465 | lines = (await async_check_output(adb, "devices")).splitlines() |
| 466 | for line in lines: |
| 467 | # Ignore blank lines, and all lines before the header. |
| 468 | line = line.strip() |
| 469 | if line == "List of devices attached": |
| 470 | header_found = True |
| 471 | elif header_found and line: |
| 472 | try: |
| 473 | serial, status = line.split() |
| 474 | except ValueError: |
| 475 | raise ValueError(f"failed to parse {line!r}") |
| 476 | if status == "device": |
| 477 | serials.append(serial) |
| 478 | |
| 479 | if not header_found: |
| 480 | raise ValueError(f"failed to parse {lines}") |
| 481 | return serials |
| 482 | |
| 483 | |
| 484 | async def find_device(context, initial_devices): |
no test coverage detected
searching dependent graphs…