INNER CODE UNIT · Python
_pick_auto_device
CursorTouch/Android-MCP · src/android_mcp/__main__.py:127
def _pick_auto_device(connection: str) -> Optional[str]:
devices = Mobile.list_devices()
online = [serial for serial, state in devices if state == "device"]
if not online:
return None
if connection == "wifi":
for serial in online:
if ":" in serial:
return serial
return None
if connection == "usb":
# Genuine USB-connected physical devices: no colon and not an emulator.
for serial in online:
if ":" not in serial and not _is_emulator(serial):
return serial
return None