Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
tools: EHOSTUNREACH on macOS is Local Network privacy, not an unreachable TV
qsomethingkfc06b0eae67c
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.mdindex 9476cc49f..2635a35bb 100644--- a/docs/TROUBLESHOOTING.md+++ b/docs/TROUBLESHOOTING.md@@ -5,9 +5,20 @@ Things that bit us or contributors, so they don't bite you. Commands use `tools/## Connecting-- **macOS: `adb connect` says "No route to host"** although the port is open. Recent macOS treats- the Google-signed `adb` as its own app under Local Network privacy and silently blocks it.- `tools/tv.py` avoids the binary entirely.+- **macOS: "No route to host" (`EHOSTUNREACH`)** although the port is open. Recent macOS keeps a+ process off the local subnet under Local Network privacy, and the kernel reports that as this+ error, the same one a TV that is switched off gives. `tools/tv.py` does **not** avoid it: the+ permission belongs to the app that runs the client (Terminal, iTerm2, VS Code), not to the `adb`+ binary or to `python`, so changing ADB client makes no difference. Allow that app under System+ Settings > Privacy & Security > Local Network, then quit and reopen it; a denial sticks once it+ has happened, and a prompt with no window to appear in is denied for you.+ Confirm it before changing anything on the network, with the **default gateway**: in practice it+ keeps answering while every other address on the subnet gives this error, so if the router+ connects and nothing else does, it is the permission and not the network. ARP and mDNS keep+ working throughout, which is what makes it read as AP isolation or a router firewall: `arp -an`+ shows the TV's MAC and `dns-sd -B _androidtvremote2._tcp` still finds it by name while no port on+ it can be opened. Seen on macOS 26 (Darwin 25.6) against a Hisense `hengshan` set, Google TV 12,+ where the stock `adb` and `tools/tv.py` failed identically.- **No "wireless debugging" toggle** on some TVs, Xiaomi among them. USB debugging alone opensnetwork ADB on port 5555.- **USB debugging is greyed out and there is no Wireless debugging entry either**, seen on a carrierdiff --git a/tests/test_tv_connect_errors.py b/tests/test_tv_connect_errors.pyindex e4556c1cc..e3d0c7f76 100644--- a/tests/test_tv_connect_errors.py+++ b/tests/test_tv_connect_errors.py@@ -234,6 +234,25 @@ class TvConnectErrorTest(unittest.TestCase):self.assertIn("could not reach 192.0.2.1:5555 ([Errno 65] No route to host). Is the TV on and on ""this network?", result.stderr)+ # RUNNER raises OSError(65, ...), and 65 is EHOSTUNREACH on macOS but ENOPKG on Linux, so this is the+ # platform tv.py adds the Local Network note on. Skipped elsewhere rather than faked: the note exists to+ # be read on a Mac, and a test that passed on Linux CI while failing on a contributor's Mac is worse+ # than no test. The sentence above stays in both messages, so the test before this one covers both.+ @unittest.skipUnless(sys.platform == "darwin", "the Local Network note is macOS-only")+ def test_macos_adds_the_local_network_privacy_note_to_an_unreachable_host(self):+ result = self.run_tv(["-c", RUNNER, str(self.tv), "OSError", "No route to host"], TV_HOST="192.0.2.1")+ self.assertExplained(result)+ self.assertIn("On macOS this is also what Local Network privacy looks like.", result.stderr)+ # The two things a reader gets wrong: which app to allow, and whether the network is at fault.+ self.assertIn("granting it to python or adb does nothing", result.stderr)+ self.assertIn("try the default gateway", result.stderr)++ @unittest.skipIf(sys.platform == "darwin", "the Local Network note belongs on macOS")+ def test_other_platforms_keep_the_plain_unreachable_message(self):+ result = self.run_tv(["-c", RUNNER, str(self.tv), "OSError", "No route to host"], TV_HOST="192.0.2.1")+ self.assertExplained(result)+ self.assertNotIn("Local Network privacy", result.stderr)+def test_an_error_it_has_nothing_to_add_to_keeps_its_traceback(self):# Only the STLS answer is a Wireless debugging port; any other unknown command is left as it was.for error, message in (("InvalidChecksumError", "Received checksum 1 != 2"),diff --git a/tools/tv.py b/tools/tv.pyindex cf2ce6f79..c390adbcc 100644--- a/tools/tv.py+++ b/tools/tv.py@@ -12,6 +12,7 @@ Set TV_HOST to the TV's IP (or IP:port). Usage:tv.py --reboot return once the reboot request is accepted; the TV may still be restartingtv.py --help this text; needs neither the venv nor a TV"""+import errnoimport osimport reimport sys@@ -153,6 +154,20 @@ def connect_error(e):# carry the file's name, which no socket error does: they keep the traceback, which names the file. A# connection reset or broken in the handshake keeps its traceback too, as the port was reached.if isinstance(e, OSError) and e.filename is None and not isinstance(e, ConnectionError):+ # macOS Local Network privacy denies a process the local subnet and the kernel reports that as+ # EHOSTUNREACH, the same errno as a TV that is switched off, so "is the TV on?" sends people+ # rebuilding a network that was never broken. The permission belongs to the app that runs this+ # script (Terminal, iTerm2, VS Code), not to python or adb: switching ADB client does not avoid it,+ # and a denial sticks once it happens. ARP and mDNS keep answering while it is denied, so the TV+ # stays discoverable and only unicast fails, which is what makes it read as a network fault. The+ # default gateway kept answering throughout, so it is the one address that tells the two apart.+ if sys.platform == "darwin" and e.errno == errno.EHOSTUNREACH:+ return (f"could not reach {target} ({e}). Is the TV on and on this network?\n"+ f"On macOS this is also what Local Network privacy looks like. Allow the app that runs "+ f"tv.py (Terminal, iTerm2, VS Code) under System Settings > Privacy & Security > Local "+ f"Network, then quit and reopen it; granting it to python or adb does nothing. To tell "+ f"the two apart, try the default gateway: if it answers while every other address on "+ f"the subnet gives this error, it is the permission and not the TV. {see}")return f"could not reach {target} ({e}). Is the TV on and on this network? {see}"return None