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


Groups > comp.mobile.android > #154251

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-20 02:31 -0500
Organization BWH Usenet Archive (https://usenet.blueworldhosting.com)
Message-ID <1115fjs$875$1@nnrp.usenet.blueworldhosting.com> (permalink)
References <110b60u$25n1$1@nnrp.usenet.blueworldhosting.com> <1115f42$2l12$1@nnrp.usenet.blueworldhosting.com>

Cross-posted to 3 groups.

Show all headers | View raw


Maria Sophia wrote:
> The debug port is a legacy step that ADB no longer strictly requires!

Here's the Linux equivalent to the Windows script, but I did not test it.

  #!/bin/sh
  #
  # adbconnect.sh
  # Wi-Fi-only ADB + scrcpy auto-connect
  # Linux bash version of adbconnect.bat
  # v1p8 (20260619)
  # Mirrors the Windows logic but adapted for Linux shell behavior.
  # No debug port is used because adb pairing makes it unnecessary.
  #
  
  PHONE_IP="192.168.1.4"
  SCRCPY_OPTS="--keyboard=sdk --always-on-top"
  
  echo
  echo "=== ADB Wireless Auto-Connect (Linux) ==="
  echo "=== [Developer options > Wireless debugging > on] ==="
  echo
  
  # 1. Find adb
  ADB="$(command -v adb)"
  
  if [ -z "$ADB" ]; then
      echo "[ERROR] adb not found in PATH."
      exit 1
  fi
  
  echo "Using ADB: $ADB"
  echo
  
  # 2. Check if already connected
  echo "Checking existing ADB devices..."
  
  DEVICE_ID=""
  # Skip header line and match only lines containing the phone IP
  $ADB devices | tail -n +2 | while read -r line; do
      echo "$line" | grep -q "$PHONE_IP" && DEVICE_ID="$(echo "$line" | awk '{print $1}')"
  done
  
  # If DEVICE_ID was found, skip pairing
  if $ADB devices | grep -q "$PHONE_IP"; then
      DEVICE_ID="$PHONE_IP:5555"
      echo "Already connected on $DEVICE_ID"
      echo "Switching device to TCP/IP 5555..."
      $ADB -s "$DEVICE_ID" tcpip 5555
      $ADB connect "$PHONE_IP:5555"
      echo
      # Jump to scrcpy section
  else
      echo "Not connected. Need to pair."
      echo
  
      echo "Necessary pairing information will be shown on the phone."
      printf "Phone IP [%s]: " "$PHONE_IP"
      read USER_IP
      [ -n "$USER_IP" ] && PHONE_IP="$USER_IP"
  
      printf "Wireless debugging pairing port: "
      read PAIR_PORT
  
      printf "Wireless debugging pairing code: "
      read PAIR_CODE
  
      echo
      echo "Pairing with: $PHONE_IP:$PAIR_PORT"
  
      ATTEMPTS_PAIR=0
      while true; do
          ATTEMPTS_PAIR=$((ATTEMPTS_PAIR + 1))
          $ADB pair "$PHONE_IP:$PAIR_PORT" "$PAIR_CODE"
          if [ $? -eq 0 ]; then
              break
          fi
          if [ $ATTEMPTS_PAIR -ge 3 ]; then
              echo "[ERROR] adb pair failed after $ATTEMPTS_PAIR attempts."
              exit 1
          fi
          echo "Pair failed, retrying..."
          sleep 2
      done
  
      echo
      echo "Switching to TCP/IP 5555..."
      $ADB tcpip 5555
      echo
  
      echo "Connecting final port: $PHONE_IP:5555"
      $ADB connect "$PHONE_IP:5555"
      echo
  
      DEVICE_ID="$PHONE_IP:5555"
  fi
  
  # 3. Launch scrcpy
  echo "Launching scrcpy..."
  
  # NEW: Do not relaunch scrcpy if already running
  if pgrep -x "scrcpy" >/dev/null; then
      echo "scrcpy is already running. Skipping relaunch."
      echo "Done."
      exit 0
  fi
  
  # Linux scrcpy has no console window to hide, so just run it normally
  scrcpy --tcpip="$PHONE_IP" $SCRCPY_OPTS >/dev/null 2>&1 &
  
  echo "Done."
  exit 0
    
  # end of adbconnect.sh

-- 
Posted out of the goodness of my heart to help others do what I do.

Back to comp.mobile.android | 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 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 Chris <ithinkiam@gmail.com> - 2026-06-16 23:34 +0000
              Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Chris <ithinkiam@gmail.com> - 2026-06-17 18:59 +0000
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing "Carlos E. R." <robin_listas@es.invalid> - 2026-06-18 01:31 +0200
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Chris <ithinkiam@gmail.com> - 2026-06-18 06:00 +0000
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-18 15:09 -0500
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing "Carlos E. R." <robin_listas@es.invalid> - 2026-06-19 00:24 +0200
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Maria Sophia <mariasophia@comprehension.com> - 2026-06-18 19:19 -0500
                Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Chris <ithinkiam@gmail.com> - 2026-06-19 06:59 +0000
              Re: PSA: Streamlined persistent ADB port over Wi‑Fi without repeated pairing Chris <ithinkiam@gmail.com> - 2026-06-17 23:32 +0000
              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