INNER CODE UNIT · Python

_normalize_connection

CursorTouch/Android-MCP · src/android_mcp/__main__.py:62

def _normalize_connection(value: Optional[str]) -> str:
    if not value:
        return "auto"
    normalized = value.strip().lower()
    if normalized in {"usb", "wifi", "auto"}:
        return normalized
    raise RuntimeError(
        "Invalid connection type. Use --connection auto|usb|wifi or ANDROID_MCP_CONNECTION."
    )


def _configured_preference() -> DevicePreference:
    env_device = _clean_env("ANDROID_MCP_DEVICE")
    env_connection = _normalize_connection(_clean_env("ANDROID_MCP_CONNECTION"))
    env_host = _clean_env("ANDROID_MCP_HOST")

    if args.wifi is not None:
        serial = Mobile.normalize_wifi_serial(args.wifi or env_host)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…