Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.os.linux > #82865

Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing

From Maria Sophia <mariasophia@comprehension.com>
Newsgroups alt.os.linux, comp.mobile.android, alt.comp.os.windows-10
Subject Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing
Date 2026-06-27 08:58 -0400
Organization BWH Usenet Archive (https://usenet.blueworldhosting.com)
Message-ID <111ohcu$2qlo$1@nnrp.usenet.blueworldhosting.com> (permalink)
References <110b60u$25n1$1@nnrp.usenet.blueworldhosting.com>

Cross-posted to 3 groups.

Show all headers | View raw


UPDATE! 
Things have drastically changed for the better! Ports are not needed!

Aurgh. I just found out, by accident, that Android 12+ introduced a *new*
way to connect to adb over Wi-Fi that does not need pairing or debug ports.

So the previous script will work to connect over the LAN for Android 11+, 
but this works on Android 12+ because of the new TLS design, which... 
 a. bypasses pairing
 b. bypasses USB authorization
 c. bypasses debug ports
 d. auto-connects whenever ADB restarts

Android added a second Wi-Fi ADB system called ADB-over-TLS Auto-Discovery.
It is fundamentally completely different from classic Wireless Debugging.

What's DIFFERENT is Wi-Fi ADB-over-TLS Auto-Discovery works even when
 a. USB is dead
 b. We never paired
 c. No pairing code appears
 d. No debug ports are open
 e. Wireless Debugging toggle is OFF or ON
 f. We never authorized the desktop PC

When the desktop PC's ADB server starts, it automatically:
 a. Scans the LAN for TLS ADB devices
 b. Finds the phone (if the phone's broadcast is awake)
 c. Connects with no pairing
 d. Shows it as:
    adb-SERIAL-GUID._adb-tls-connect._tcp    device

This TLS connection:
 a. uses encrypted channels
 b. uses dynamic ports (which we do not need to know)
 c. requires no pairing
 d. requires no USB authorization
 e. works even if Wireless Debugging toggle is OFF after reboot

Even though ADB shows the TLS device as "device", scrcpy will fail unless 
the connection is converted to TCP/IP mode because scrcpy only supports
 a. USB
 b. Classic TCP/IP ADB (port 5555)

While scrcpy cannot use this TLS device directly, scrcpy *can* use it 
indirectly by switching it to classic TCP/IP mode (port 5555).

The simple solution is to convert TLS to TCP/IP (port 5555):
    adb -s adb-SERIAL-GUID._adb-tls-connect._tcp tcpip 5555

This forces Android to:
 a. drop the TLS session
 b. start the classic ADB-over-WiFi daemon
 c. open port 5555
 d. stay reachable on 5555 until the PHONE reboots

Then this simple sequence works every time:
    adb connect PHONE_IP:5555
    scrcpy --tcpip=PHONE_IP

The caveat is that the TLS ADB service is flaky. It can:
 a. go idle
 b. stop advertising
 c. come back as "offline"
 d. restart only when Wireless Debugging is toggled OFF -> ON

We can write a launcher to avoid this TLS flakiness by:
 a. killing the PC ADB server
 b. disconnecting all devices
 c. reconnecting only to 5555
This removes the TLS ghost device entirely.

Below is the first rev of a vbs script for Windows 10 (Linux can be added 
later) which connects without USB and without knowing any pairing ports!

  :: adbconnecttls.bat 
  ::   Connects Android 12+ to adb & scrcpy WITHOUT needing any information!
  :: v1p0 (Android 12+ TLS-to-TCPIP scrcpy launcher)
  ::   Simplest possible Wi-Fi scrcpy launcher for Android 12+ devices that
  ::   auto-advertise ADB-over-TLS. This script avoids pairing, avoids USB,
  ::   avoids debug ports, and avoids the TLS "ghost device" problem.
  ::   Android 12+ added a new ADB system called ADB-over-TLS Auto-Discovery.
  ::   It broadcasts on the LAN using mDNS as:
  ::       _adb-tls-connect._tcp
  ::   The desktop ADB server auto-connects to this TLS service with:
  ::       adb-SERIAL-GUID._adb-tls-connect._tcp
  ::   This TLS connection:
  ::     a. bypasses pairing
  ::     b. bypasses USB authorization
  ::     c. bypasses debug ports
  ::     d. auto-connects whenever ADB restarts
  ::   BUT scrcpy cannot use TLS directly. It only supports:
  ::     a. USB
  ::     b. Classic TCP/IP ADB (port 5555)
  ::  Note this script has no need for pairing or debug ports.
  ::  This script does not require USB nor does it depend on TLS being awake.
  ::  But Android's TLS ADB service is rather flaky in that it can:
  ::     a. go idle
  ::     b. stop advertising
  ::     c. return as "offline"
  ::     d. require Wireless Debugging toggle OFF->ON to wake up
  :: So this script avoids TLS entirely by connecting only to port 5555.
  ::   This script:
  ::   1. Kills the ADB server (removes stale TLS sessions)
  ::   2. Starts the ADB server cleanly
  ::   3. Disconnects all devices (removes TLS ghost device)
  ::   4. Connects directly to PHONE_IP:5555
  ::   5. Launches scrcpy silently using classic TCP/IP mode
  ::   Running "adb -s <tls-id> tcpip 5555" forces Android to open port 5555
  ::   even when Wireless Debugging is ON. Once opened, port 5555 stays active
  ::   until the PHONE reboots. This makes reconnections simple and stable.
  
  @echo off
  setlocal enabledelayedexpansion
  
  echo ============================================
  echo ADB-over-TLS to TCP/IP Launcher (Debug Mode)
  echo ============================================
  echo.
  
  :: Set your phone IP here
  set PHONE_IP=192.168.1.4
  set SCRCPY_OPTS=--keyboard=sdk --always-on-top
  
  echo STEP 1: adb kill-server
  echo adb kill-server
  adb kill-server
  echo.
  
  echo STEP 2: adb start-server
  echo adb start-server
  adb start-server
  echo.
  
  echo STEP 3: adb disconnect (kills TLS ghost)
  echo adb disconnect
  adb disconnect
  echo.
  
  echo STEP 4: adb connect %PHONE_IP%:5555
  echo adb connect %PHONE_IP%:5555
  adb connect %PHONE_IP%:5555
  echo.
  
  echo STEP 5: Launch scrcpy silently
  set VBS_TEMP=%TEMP%\scrcpy_tls_runner.vbs
  
  echo strCommand = "cmd /c scrcpy.exe --tcpip=%PHONE_IP% %SCRCPY_OPTS%" > "%VBS_TEMP%"
  echo CreateObject("Wscript.Shell").Run strCommand, 0, false >> "%VBS_TEMP%"
  
  echo Running: scrcpy.exe --tcpip=%PHONE_IP% %SCRCPY_OPTS%
  wscript.exe "%VBS_TEMP%"
  
  echo.
  echo Done.
  echo.
  
  endlocal
  exit /b
  
  :: end of adbconnecttls.bat 

-- 
Usenet isn't for amusement; it's for learning from and teaching each other.

Back to alt.os.linux | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-10 02:07 -0600
  Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-11 21:49 -0500
    Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-12 16:17 -0500
      Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Hank Rogers <Hank@nospam.invalid> - 2026-06-12 16:32 -0500
        Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Give It A Try <try.it@invalid.invalid> - 2026-06-12 23:20 +0100
        Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-13 11:31 -0500
  Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing 🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl> - 2026-06-15 11:08 +0200
    Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Paul <nospam@needed.invalid> - 2026-06-15 12:11 -0400
      Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing 🇵🇱Jacek Marcin Jaworski🇵🇱 <jmj@energokod.gda.pl> - 2026-06-15 19:24 +0200
        Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-15 14:10 -0500
          Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-15 14:43 -0500
          Re: PSA: Streamlined persistent ADB port over   Wi‑Fi without repeated pairing vallor <vallor@vallor.earth> - 2026-06-17 00:16 +0000
            Re: PSA: Streamlined persistent ADB port over   Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-16 23:23 -0500
      Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-15 13:56 -0500
        Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Warpinator <invalid@invalid.invalid> - 2026-06-16 00:23 +0100
          Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-15 19:18 -0500
            Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing "Carlos E. R." <robin_listas@es.invalid> - 2026-06-16 12:15 +0200
    Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Chris <ithinkiam@gmail.com> - 2026-06-16 07:07 +0000
      Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-16 02:21 -0500
        Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing "Carlos E. R." <robin_listas@es.invalid> - 2026-06-16 12:30 +0200
          Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-16 12:07 -0500
            Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing "Carlos E. R." <robin_listas@es.invalid> - 2026-06-16 20:11 +0200
              Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-16 14:40 -0500
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing "Carlos E. R." <robin_listas@es.invalid> - 2026-06-16 22:47 +0200
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-16 15:51 -0500
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing "Carlos E. R." <robin_listas@es.invalid> - 2026-06-18 00:45 +0200
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Hank Rogers <Hank@nospam.invalid> - 2026-06-17 17:56 -0500
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing "....winston" <winstonmvp@gmail.com> - 2026-06-16 19:47 -0400
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-16 23:26 -0500
        Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Chris <ithinkiam@gmail.com> - 2026-06-16 12:10 +0000
          Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-16 12:09 -0500
            Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-26 06:38 -0400
  Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-20 02:22 -0500
    Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-20 02:31 -0500
    Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-21 00:53 -0500
  Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-27 08:58 -0400
    Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Nadia Jarvis <invalid@invalid.invalid> - 2026-06-27 19:38 +0100
      Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Hank Rogers <Hank@nospam.invalid> - 2026-06-27 19:53 -0500
        Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-27 23:01 -0600

csiph-web