Repository navigation
fix: select an mDNS-connected phone over Wi-Fi without adb connect - #46
Merged
Jeomon merged 2 commits intoNov 22, 2026
Merged
Conversation
A phone paired for wireless debugging is connected by adb itself over mDNS and listed under its service name, e.g. "adb-RF8M12345-AbC9Zz._adb-tls-connect._tcp". CursorTouch#43 taught pick_device that such a serial is a network device, but the explicit Wi-Fi path did not know it: with --connection wifi --device <that serial>, ANDROID_MCP_CONNECTION=wifi + ANDROID_MCP_DEVICE, or --wifi <serial>, normalize_wifi_address appended ":5555" and connect_wifi ran `adb connect adb-…_tcp:5555`, which fails to resolve the name as a host. Even past that, the ":5555" serial no longer matched the device adb lists, so the attached, ready phone could never be selected. normalize_wifi_address now leaves an mDNS serial as it is, and connect_wifi selects it without `adb connect`, since adb already holds the connection. Host and host:port addresses are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014TonJ1geSd97oAtSBZofUK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a phone is paired for wireless debugging, adb connects to it itself over mDNS and lists it under its service name, e.g.
adb-RF8M12345-AbC9Zz._adb-tls-connect._tcp. #43 taughtpick_deviceto treat that serial as a network device. The explicit Wi-Fi path still didn't handle it.When a user names that serial together with Wi-Fi, through any of:
--connection wifi --device adb-RF8M12345-AbC9Zz._adb-tls-connect._tcpANDROID_MCP_CONNECTION=wifiwithANDROID_MCP_DEVICE=<that serial>--wifi <that serial>then
normalize_wifi_addressappends:5555, andconnect_wifirunsadb connect adb-…_tcp:5555. That fails because the name doesn't resolve as a host:Even if it didn't fail there, the
:5555serial would no longer match the device adb lists, so a phone that's attached and ready can never be selected.Change (
mobile/service.py)_is_mdns_serial(), the same rule fix: recognize wireless-debugging devices adb connects to over mDNS #43 uses._is_network()now calls it.normalize_wifi_addressreturns an mDNS serial unchanged (no:5555).connect_wifiselects an mDNS serial directly, withoutadb connect, because adb already holds that connection.Host and
host:portaddresses behave exactly as before.Testing
uv run pytest: 587 passed, 21 skipped.ruff checkandruff format --checkare clean.masterand passing with this change:TestWifi.test_normalize: an mDNS serial is kept whole.TestWifi.test_mdns_serial_is_selected_without_adb_connectTestResolvePreference.test_wifi_option_keeps_an_mdns_serial_wholeresolve_preference(device=<mDNS serial>, connection="wifi")→Session.connect_configured()and the real subprocess layer, withANDROID_MCP_ADB_PATHpointing at a fakeadbthat lists the phone asdeviceand answersadb connectlike real adb does for an unresolvable name:connect adb-…_tcp:5555AdbError: failed to resolve host …devices -ladb-RF8M12345-AbC9Zz._adb-tls-connect._tcpI don't have a wireless-debugging setup here. The serial format is the one from the scrcpy report cited in #43.