Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.os.linux > #82884
| From | Maria Sophia <mariasophia@comprehension.com> |
|---|---|
| Newsgroups | comp.mobile.android, alt.os.linux, alt.comp.os.windows-10 |
| Subject | Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing |
| Date | 2026-06-30 21:46 -0400 |
| Organization | BWH Usenet Archive (https://usenet.blueworldhosting.com) |
| Message-ID | <1121ria$21vf$1@nnrp.usenet.blueworldhosting.com> (permalink) |
| References | (7 earlier) <110s8r5$2233$1@nnrp.usenet.blueworldhosting.com> <n9dr3bFff49U1@mid.individual.net> <110sd0g$19hh$1@nnrp.usenet.blueworldhosting.com> <n9gmcdFugfkU1@mid.individual.net> <110v8n7$27b9k$1@dont-email.me> |
Cross-posted to 3 groups.
In the beginning, we used USB to connect adb & scrcpy to the desktop PC.
Then in Android 11 we used Wi-Fi pairing with the pairing & debug port.
$ adbconnect.bat
I used that method even up to Android 13, but I didn't know that in
Android 12, the ability to pair without knowing the ports was added.
$ adbconnecttls.bat
In using that script to pair without knowing the ports, I've run into a
bunch of situations depending on the state of the phone & the computer.
Hence, I wrote this debugging-only script to catch all known errors.
As always, please fix where I accidentally omit or err for overall value.
:: adbdebugtls.bat (Android 12+ ADB/TLS Diagnostic Tool)
::
:: Runs a full diagnostic of ADB-over-TLS, TCP/IP mode, adbd state,
:: Wireless Debugging state, and scrcpy readiness for Android 12+.
@echo off
setlocal enabledelayedexpansion
:: Version string
set SCRIPT_VERSION=v1p6
set SCRIPT_DATE=20260630
echo ============================================
echo ADB Debug Tool Android 12+ TLS Diagnostic
echo Running adbdebugtls.bat %SCRIPT_VERSION% %SCRIPT_DATE%
echo ============================================
echo.
::
:: v1p6 20260630
:: When in deep sleep, a reboot and wireless debugging toggle isn't enough.
:: Either we have to authenticate over USB or over Android 11 pairing so
:: this version will tell the user what they need to do so as to pair.
::
:: v1p5 20260629
:: Added hard deep-sleep check & warning that the phone must be rebooted
:: as just toggling Wireless debugging will not wake from hard deep sleep
:: Note that we might have to reboot and pair using Android 11 methods.
::
:: v1p4 20260628
:: Show TLS recovery suggestions whenever TLS advertiser is ASLEEP
:: Added Android 11 pairing-mode instructions (adb pair / adb connect)
:: Added Android 12+ Wireless Debugging toggle instructions
:: Kept USB fallback instructions for classic TCP/IP mode
::
:: v1p3 20260627
:: Added recovery suggestions
:: such as toggle Wireless Debugging, USB fallback, reboot
::
:: v1p2 20260626
:: Added TLS-only mode detection
:: Added TCP/IP mode detection
:: Added USB fallback detection
:: Added ADB Deep Sleep Summary block
:: Added auto-suggestions inside summary (v1p2)
::
:: v1p1 20260625
:: Added script version and date output
:: The TLS advertiser, adbd and the Wireless Debugging service enter
:: a deep sleep sate when the phone has been idle for a long time.
:: Added comments to explain the debug results when that happens.
::
:: v1p0 20260620
:: Diagnose the state of Android's ADB daemon on Android 12+ devices,
:: including TLS advertiser status, TCP/IP mode, adbd internal state,
:: Wireless Debugging service state and scrcpy readiness.
::
:: Android 12+ introduced ADB-over-TLS Auto-Discovery, which broadcasts
:: on the LAN using mDNS as:
:: _adb-tls-connect._tcp
:: The desktop ADB server auto-connects to this TLS service as:
:: adb-SERIAL._adb-tls-connect._tcp
:: This TLS system:
:: 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)
:: Hence, this script checks:
:: 1. TLS advertiser status (adb mdns services)
:: 2. TCP/IP connectivity on port 5555
:: 3. adbd internal state via getprop
:: 4. Wireless Debugging service state via dumpsys
:: Note Samsung may hide or rename the Wireless Debugging service.
:: 5. scrcpy readiness (device state)
:: Note the wake attempts when the phone TLS service goes asleep.
:: i. Restarting the PC ADB server
:: ii. Restarting adbd on the phone (if reachable)
:: iii. Forcing TCP/IP fallback on port 5555
:: Note Android does not expose a command to toggle Wireless Debugging.
:: So the TLS advertiser cannot be automaticaly awakened from ADB.
:: Hence, this script reports TLS sleep but cannot force it awake.
::
:: Set your phone IP here
set PHONE_IP=192.168.1.4
:: Begin 1
echo.
echo === 1. Restart PC ADB Server ===
echo adb kill-server
adb kill-server
echo adb start-server
adb start-server
echo.
:: End 1
:: Begin 2
echo.
echo === 2. TLS Status mDNS Advertiser ===
echo Command: adb mdns services
adb mdns services | findstr /I "_adb-tls-connect._tcp"
if errorlevel 1 (
echo TLS advertiser is ASLEEP.
echo.
echo Meaning:
echo The phone is NOT broadcasting _adb-tls-connect._tcp
echo The Wireless Debugging mDNS service is OFF or in deep sleep
echo ADB-over-TLS cannot auto-discover the device
echo The PC cannot wake the phone via TLS
echo.
echo Why this happens:
echo Phone idle for long periods
echo Wi-Fi reconnected or changed access points
echo Wireless Debugging has not been toggled recently
echo.
echo Result:
echo TLS mode is unavailable
echo Only USB or manual Wireless Debugging toggle can wake adbd
) else (
echo TLS advertiser is ACTIVE.
echo The phone is broadcasting _adb-tls-connect._tcp.
)
echo.
:: TLS-only mode detection
:: This sets %TLS_STATE% for later summary logic
if errorlevel 1 (
set TLS_STATE=ASLEEP
) else (
set TLS_STATE=ACTIVE
)
:: End 2
:: Begin 3
echo.
echo === 3. TCP/IP Status Port 5555 ===
echo Command: adb connect %PHONE_IP%:5555
adb connect %PHONE_IP%:5555
if errorlevel 1 (
echo.
echo TCP/IP mode is OFF.
echo Port 5555 is CLOSED on the phone.
echo.
echo Meaning:
echo Classic ADB-over-TCP is disabled
echo scrcpy cannot connect over Wi-Fi
echo The phone is in TLS-only Wireless Debugging mode
echo.
echo Why this happens:
echo Android 12+ disables TCP/IP mode automatically
echo Happens after reboot, Wi-Fi changes, or long idle periods
echo Happens when Wireless Debugging is ON but not paired recently
echo.
echo Result:
echo adb connect fails with "actively refused 10061"
echo Only USB can re-enable TCP/IP mode via "adb tcpip 5555"
) else (
echo TCP/IP mode is ACTIVE on port 5555.
echo Classic ADB-over-TCP is available.
)
echo.
echo Command: adb devices
adb devices
echo.
:: TCP/IP mode detection
if errorlevel 1 (
set TCPIP_STATE=OFF
) else (
set TCPIP_STATE=ON
)
:: End 3
:: Begin 4
echo.
echo === 4. Attempting to Wake adbd if reachable ===
echo Trying: adb shell stop adbd
adb shell stop adbd 2>nul
echo Trying: adb shell start adbd
adb shell start adbd 2>nul
echo.
:: End 4
:: Begin 5
echo.
echo === 5. adbd Internal State ===
echo Command: adb shell getprop init.svc.adbd
adb shell getprop init.svc.adbd
if errorlevel 1 (
echo.
echo adbd is UNREACHABLE.
echo.
echo Meaning:
echo No TLS connection
echo No TCP/IP connection
echo No USB connection
echo.
echo Result:
echo Cannot read adbd internal state
echo Cannot restart adbd remotely
echo Phone is in ADB Deep Sleep mode
) else (
echo adbd internal state retrieved.
)
echo.
echo Command: adb shell getprop service.adb.tcp.port
adb shell getprop service.adb.tcp.port
echo.
echo Command: adb shell getprop ro.adb.secure
adb shell getprop ro.adb.secure
echo.
:: End 5
:: Begin 6
echo.
echo === 6. Wireless Debugging State ===
echo Command: adb shell dumpsys activity service com.android.adb.adbd
adb shell dumpsys activity service com.android.adb.adbd
if errorlevel 1 (
echo.
echo Wireless Debugging service is ASLEEP.
echo.
echo Meaning:
echo The service is not running
echo The TLS advertiser is not active
echo The phone cannot accept TLS connections
echo.
echo Why this happens:
echo Android put the service into deep sleep
echo Happens after long idle periods or Wi-Fi changes
echo.
echo Result:
echo Wireless Debugging must be toggled OFF -> ON manually
echo Or USB must be used to wake adbd
) else (
echo Wireless Debugging service is ACTIVE.
)
echo.
:: End 6
:: Begin 7
echo.
echo === 7. scrcpy Readiness Check ===
echo If device shows as "device", scrcpy can run.
echo If port 5555 is active, scrcpy --tcpip works.
echo.
echo Command: adb devices
adb devices > devices.tmp
:: USB fallback detection
:: This detects whether
:: USB connected as device appears without an IP
:: TCP/IP connected as device appears with 192.168.x.x:5555
:: Neither, likely meaning deep sleep
findstr /I "device" devices.tmp | findstr /V ":" >nul
if not errorlevel 1 (
set USB_STATE=CONNECTED
) else (
set USB_STATE=DISCONNECTED
)
echo.
echo If no devices appear:
echo ADB cannot reach the phone
echo TLS is asleep
echo TCP/IP mode is off
echo scrcpy cannot run
echo.
echo If the phone appears as "device":
echo scrcpy can run over USB or TCP/IP
echo.
echo If the phone appears as "192.168.x.x:5555 device":
echo scrcpy --tcpip will work
echo.
:: End 7
:: Begin 8
echo.
echo === ADB Deep Sleep Summary ===
:: Determine deep sleep state
if "%TLS_STATE%"=="ASLEEP" (
if "%TCPIP_STATE%"=="OFF" (
if "%USB_STATE%"=="DISCONNECTED" (
echo.
echo OVERALL STATE: PHONE IS IN ADB DEEP SLEEP MODE.
echo.
echo Meaning:
echo TLS advertiser asleep
echo TCP/IP mode off
echo USB not connected
echo.
echo Recovery summary:
echo 1. Toggle Wireless Debugging OFF -> ON
echo 2. Connect USB and run: adb tcpip 5555
echo 3. Reboot the phone to restart adbd
)
)
)
if "%USB_STATE%"=="CONNECTED" (
echo.
echo OVERALL STATE: USB CONNECTED.
echo scrcpy can run over USB.
)
if "%TCPIP_STATE%"=="ON" (
echo.
echo OVERALL STATE: TCP/IP MODE ACTIVE.
echo scrcpy --tcpip will work.
)
:: End 8
:: Begin 9
echo Checking for Hard Deep Sleep...
adb mdns services | findstr /I "_adb-tls-connect._tcp" >nul
if errorlevel 1 (
set TLS_STATE=ASLEEP
) else (
set TLS_STATE=ACTIVE
)
adb connect %PHONE_IP%:5555 >nul
if errorlevel 1 (
set TCPIP_STATE=ASLEEP
) else (
set TCPIP_STATE=ACTIVE
)
adb devices | findstr /I "device" | findstr /V ":" >nul
if errorlevel 1 (
set USB_STATE=NOT_AUTH
) else (
set USB_STATE=AUTHORIZED
)
echo Checking for Hard Deep Sleep...
:: Hard Deep Sleep means:
:: TLS asleep
:: TCPIP refusing
:: adbd unreachable
:: scrcpy failed
if "%TLS_STATE%"=="ASLEEP" (
if "%TCPIP_STATE%"=="ASLEEP" (
echo.
echo Hard Deep Sleep detected.
echo Wireless Debugging is stuck.
echo TLS advertiser did not restart.
echo adbd is unreachable.
echo scrcpy cannot connect.
echo.
echo Fix:
echo Reboot the phone to restart Wireless Debugging.
echo After reboot, enable Wireless debugging.
echo Then re-run adbconnecttls.bat.
echo.
)
)
echo.
echo Android 12+ TLS auto-connect failed.
echo USB fallback unavailable.
echo Android 11 Wireless Debugging pairing mode is available.
echo.
echo This debug tool does not perform pairing or connection steps.
echo Use adbconnect.bat to run Android 11 pairing mode.
echo.
echo Steps:
echo 1. On the phone, open Wireless debugging
echo Choose "Pair device with pairing code"
echo 2. Note the IP, pairing port, pairing code, and debug port
echo 3. Run adbconnect.bat and enter the values when prompted
echo.
echo After pairing, adbconnect.bat will:
echo Connect to the debug port
echo Switch the device to TCP/IP 5555
echo Connect to port 5555
echo Launch scrcpy
echo.
echo This diagnostic script only reports the state and suggests actions.
:: End 9
:: Begin 10
echo.
echo ============================================
echo adbdebugtls.bat %SCRIPT_VERSION% %SCRIPT_DATE% Diagnostics complete
echo ============================================
echo.
echo ============================================
echo === Suggested Commands to Fix Wireless Debugging ===
echo ============================================
echo.
echo Your phone is NOT ready for TLS auto-connect.
echo To make adbconnecttls.bat succeed, do ONE of the following:
echo.
:: Normal Deep Sleep recommendation
if "%TLS_STATE%"=="ASLEEP" (
if "%TCPIP_STATE%"=="OFF" (
if "%USB_STATE%"=="DISCONNECTED" (
echo --- Normal Deep Sleep ---
echo 1. Open Developer options, Wireless debugging
echo Toggle Wireless debugging OFF, then ON
echo This wakes the TLS advertiser in normal Deep Sleep
echo.
)
)
)
:: Hard Deep Sleep recommendation
if "%TLS_STATE%"=="ASLEEP" (
if "%TCPIP_STATE%"=="ACTIVE" (
if "%USB_STATE%"=="AUTHORIZED" (
echo --- Hard Deep Sleep ---
echo 2. Reboot the phone from the power menu
echo Wireless Debugging and TLS will restart cleanly
echo After reboot, enable Wireless debugging again
echo.
)
)
)
echo --- Android 11 Pairing Code Mode ---
echo 3. On the phone, open Wireless debugging and choose
echo Pair device with pairing code
echo Note the IP and port shown on the phone
echo Then run on the PC
echo adb pair ^<ip^>:^<port^>
echo After pairing succeeds, run
echo adb connect ^<ip^>:^<port^>
echo.
echo --- USB fallback if USB works ---
echo 4. Connect USB and run on the PC
echo adb devices
echo adb tcpip 5555
echo adb connect %PHONE_IP%:5555
echo This wakes adbd and enables classic TCP/IP mode
echo.
echo After doing one of these, re-run adbconnecttls.bat
echo It should now be able to connect successfully
echo.
:: End 10
endlocal
exit /b
:: end of adbdebugtls.bat
--
For some people, Usenet is amusement, but for me, it's for adding value.
Back to alt.os.linux | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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 Maria Sophia <mariasophia@comprehension.com> - 2026-06-30 22:12 -0400
Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing "Carlos E. R." <robin_listas@es.invalid> - 2026-07-01 11:51 +0200
Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-07-01 13:57 -0400
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 Maria Sophia <mariasophia@comprehension.com> - 2026-06-30 21:46 -0400
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
Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-30 21:40 -0400
csiph-web