Logo von Connecting To Devices

Connecting To Devices

Community
skydoves
connecting-to-devices

Use this skill to attach a USB device or emulator to ADB, list transports with `adb devices` / `adb devices -l`, disambiguate among multiple devices using `-s SERIAL`, `-d` (single USB), `-e` (single TCP/IP), or `-t TRANSPORT_ID`, gate scripts on a transport with the canonical `adb wait-for[-TRANSPORT]-<state>` syntax (TRANSPORT in {usb, local, any}; state in {device, recovery, rescue, sideload, bootloader, disconnect}), interpret device states (`device`, `offline`, `unauthorized`, `no permissions`, `recovery`, `sideload`, `bootloader`, `rescue`), accept the RSA fingerprint dialog on first connect, and install Linux udev rules. Use when the user mentions `error: more than one device/emulator`, `error: device not found`, `unauthorized`, `no permissions`, `daemon not running`, "wait for device to boot", `wait-for-device-online` (which is not a real subcommand), or asks how to script around emulator startup.

Übersicht

Herausgeberskydoves
Repositoryandroid-testing-skills
Skill-Nameconnecting-to-devices
Sterne
338
Forks
14
Mitgelieferte Dateien
Nur Anweisungen
LizenzApache-2.0
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • In sich abgeschlossen

    Alles, was das Modell braucht, steht in den Anweisungen — keine zusätzlichen Dateien zum Synchronisieren.

  • Open Source

    Von skydoves auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Connecting To Devices in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/skydoves/android-testing-skills/tree/main/adb/devices/connecting-to-devices
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/skydoves/android-testing-skills.git /tmp/android-testing-skills
mkdir -p .claude/skills
cp -r /tmp/android-testing-skills/adb/devices/connecting-to-devices .claude/skills/connecting-to-devices
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Connecting To Devices in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Connecting To Devices automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Connecting To Devices nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

Connecting to Devices — Listing, Selecting, and Waiting on Transports

adb devices is the most-typed adb command. The follow-on traps are real: scripts run before the device is actually online, multi-device shells fail with more than one device/emulator, Linux misses udev rules, and tutorials reference a fictional wait-for-device-online form. This skill encodes the truth set.

When to use this skill

  • The user runs adb shell with two devices plugged in and gets error: more than one device/emulator.
  • The user reports a device showing as unauthorized, offline, or no permissions in adb devices.
  • The user wants a CI script to wait until a device finishes booting before running tests.
  • The user copy-pasted adb wait-for-device-online from a blog post and it errors with usage text.
  • The user is on Linux and a freshly plugged phone never appears in adb devices.

When NOT to use this skill

  • The user wants the high-level architecture / server lifecycle / env vars — use ../../architecture/understanding-adb-architecture/SKILL.md.
  • The user wants Wi-Fi / wireless debugging — use ../connecting-over-wifi/SKILL.md.
  • The user wants to install or clear app state on the connected device — use ../../apps/installing-and-managing-apps/SKILL.md.

Prerequisites

  • Working ADB server (see ../../architecture/understanding-adb-architecture/SKILL.md).
  • Device with USB debugging enabled in Settings → System → Developer options. On Android 4.2+ developer options is hidden until "Build number" is tapped seven times in About phone.
  • On Linux: ability to write /etc/udev/rules.d/51-android.rules with sudo.
  • On Windows: a vendor USB driver (Google USB Driver via SDK Manager for Pixel/Nexus; OEM driver for other manufacturers).

Workflow

  • 1. Run adb devices first, every time. It prints one line per attached transport in the form <serial> <state> [details...]. Add -l whenever scripting:

    bash
    adb devices -l
    # List of devices attached
    # emulator-5556  device  product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 transport_id:1
    # 0a388e93       device  usb:1-1 product:razor model:Nexus_7 device:flo transport_id:2

    -l adds product, model, device, transport_id, and (for USB) the USB bus path.

  • 2. Pick the right selector for the situation:

    FlagMeaningFails when
    -s <serial>Explicit serial. Works for USB serials (0a388e93), emulators (emulator-5554), and TCP devices (192.168.1.42:5555). Overrides $ANDROID_SERIAL.Serial not connected.
    -dThe single USB device.Zero or more than one USB device.
    -eThe single TCP/IP device (covers emulators and adb connect-ed phones).Zero or more than one TCP device.
    -t <transport_id>Numeric transport ID from adb devices -l. Stable across re-plugs of the same port.Transport ID not present.

    Note: -t is the transport ID, not a timeout flag. Wrap with shell timeout (or gtimeout on macOS) if the goal is a per-command time limit.

  • 3. Filter to "ready" devices in scripts:

    bash
    adb devices | awk '$2=="device"{print $1}'

    Single-device shortcuts: adb get-serialno returns the serial, adb get-state returns one of offline | bootloader | device, adb get-devpath returns the USB path. For the full state set, parse adb devices directly.

  • 4. Use the canonical wait-for-* form. The variants you may have seen are wrong. From adb help (scripting section), the only valid syntax is:

    wait-for[-TRANSPORT]-STATE
        TRANSPORT ∈ { usb, local, any }            (transport defaults to any)
        STATE     ∈ { device, recovery, rescue, sideload, bootloader, disconnect }

    Common forms:

    CommandBlocks until...
    adb wait-for-deviceAny transport, state device. The default — used at the start of CI scripts.
    adb wait-for-usb-deviceA USB-attached device reaches state device.
    adb wait-for-local-deviceA TCP/IP device (emulator or wireless) reaches state device.
    adb wait-for-bootloaderDevice shows up in bootloader (fastboot) state.
    adb wait-for-recovery / wait-for-sideload / wait-for-rescueSame idea for those modes.
    adb wait-for-disconnectThe currently selected device disconnects (e.g. after adb reboot).

    The doc does NOT define a wait-for-device-online form. wait-for-* only checks the transport, not boot completion — pair it with a sys.boot_completed poll:

    bash
    adb wait-for-device
    until [[ "$(adb shell getprop sys.boot_completed | tr -d '\r')" == "1" ]]; do
      sleep 1
    done
    adb shell input keyevent 82   # unlock the AOSP slide-up screen

    Compound flow around a reboot:

    bash
    adb shell reboot
    adb wait-for-disconnect
    adb wait-for-device
  • 5. Read device states correctly. From the adb page (Query for devices) plus adb help:

    StateMeaningRecovery
    deviceOnline, adbd is responsive. Does not imply boot complete — gate on sys.boot_completed.n/a
    offlineTransport exists but adbd isn't talking. Common after suspend/resume or USB hubs.adb reconnect offline, then re-plug if needed.
    unauthorizedHost RSA key not yet accepted on-device.Unlock device, tap Allow on the on-device dialog. Try a different USB cable if no dialog appears (some "charge-only" cables block data).
    recoveryBooted into recovery. Only a small subset of adb works.n/a
    sideloadOTA sideload mode. Use adb sideload package.zip.n/a
    bootloaderAt the bootloader (fastboot). adb cannot talk; use fastboot.n/a
    rescueRescue Party mode (Android 10+).n/a
    connectingTransient TLS handshake state over wireless.wait.
    no permissions(Linux only) USB visible but blocked by missing udev rules.install rules — see step 7.
  • 6. Accept the RSA fingerprint dialog on first connect.

    "When you connect a device running Android 4.2.2 (API level 17) or higher, the system shows a dialog asking whether to accept an RSA key that allows debugging through this computer." — developer.android.com/tools/adb Sequence:

    1. adbd sees a new client offering an RSA public key.
    2. The OS pops the "Allow USB debugging?" dialog showing the workstation's key fingerprint.
    3. Until the user taps Allow, adb devices reports unauthorized.
    4. After acceptance, the public key is appended to /data/misc/adb/adb_keys on the device. Tick Always allow from this computer so future connections from the same ~/.android/adbkey skip the prompt.

    Revoke an old workstation's permission via Settings → Developer options → Revoke USB debugging authorizations.

  • 7. (Linux) install udev rules so a freshly plugged phone is not stuck at no permissions. Canonical file: /etc/udev/rules.d/51-android.rules. Minimal example (one line per OEM):

    # Google
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0660", GROUP="plugdev", TAG+="uaccess"
    # Samsung
    SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0660", GROUP="plugdev", TAG+="uaccess"

    Apply without reboot:

    bash
    sudo udevadm control --reload-rules
    sudo udevadm trigger
    # unplug and re-plug the device

    Most distros also ship a comprehensive android-udev / android-sdk-platform-tools-common package that drops the same file in /lib/udev/rules.d/.

  • 8. (Windows) install the vendor USB driver. Pixel / Nexus / generic AOSP devices use the Google USB Driver from SDK Manager → SDK Tools → Google USB Driver (files at android_sdk\extras\google\usb_driver\). Other OEMs require manufacturer drivers from https://developer.android.com/tools/extras/oem-usb. macOS and Linux do not need vendor drivers.

  • 9. Multi-device fan-out. ADB has no built-in --all flag. Two patterns:

    bash
    # Sequential
    for s in $(adb devices | awk '$2=="device"{print $1}'); do
      adb -s "$s" install -r app.apk
    done
    
    # Parallel (4 jobs at a time)
    adb devices | awk '$2=="device"{print $1}' \
      | xargs -I{} -P 4 adb -s {} install -r app.apk

    For sharded CI runners that each own one phone, lock the server to a single device:

    bash
    adb --one-device 0a388e93 start-server

Patterns

Pattern: WRONG vs RIGHT — more than one device/emulator

bash
# WRONG
adb shell getprop ro.product.model
# adb: more than one device/emulator
# WRONG because: with two transports attached (e.g. an emulator + a USB phone),
# every non-server adb command needs an explicit selector. The command did not
# fail; it never even ran.
bash
# RIGHT
adb -s emulator-5554 shell getprop ro.product.model
# Or, if there is exactly one USB phone:
adb -d shell getprop ro.product.model
# Or set $ANDROID_SERIAL once and stop typing -s:
export ANDROID_SERIAL=emulator-5554
adb shell getprop ro.product.model

Pattern: WRONG vs RIGHT — fictional wait-for-device-online

bash
# WRONG
adb wait-for-device-online
# error: usage: ...
# WRONG because: this command does not exist. The canonical syntax is
# wait-for[-TRANSPORT]-<state> with state in {device, recovery, rescue,
# sideload, bootloader, disconnect}. There is no -online state.
bash
# RIGHT
adb wait-for-device                  # any transport, state=device
# Then poll boot complete (transport up != system booted):
until [[ "$(adb shell getprop sys.boot_completed | tr -d '\r')" == "1" ]]; do
  sleep 1
done

Pattern: WRONG vs RIGHT — racing emulator startup

bash
# WRONG
emulator -avd Pixel_API_34 &
adb install -r app.apk            # races: emulator may not be online yet
# Often: error: device 'emulator-5554' not found
bash
# RIGHT
adb start-server                  # important: see corner case below
emulator -avd Pixel_API_34 &
adb -s emulator-5554 wait-for-device
until [[ "$(adb -s emulator-5554 shell getprop sys.boot_completed | tr -d '\r')" == "1" ]]; do
  sleep 1
done
adb -s emulator-5554 install -r app.apk

Corner case (verbatim from the adb page): "running emulators [may] not show up in adb devices ... when all of the following are true: the adb server is not running; you use the emulator command with the -port or -ports option with an odd-numbered port between 5554 and 5584; ... You start the adb server after you start the emulator." Workaround: adb start-server BEFORE emulator.

Pattern: WRONG vs RIGHT — transport_id vs -t confusion

bash
# WRONG
adb -t 60 shell getprop ro.product.model
# WRONG because: -t is transport_id, not a 60-second timeout. Either there is
# no transport with id=60 (error: device not found) or the command runs against
# the wrong device.
bash
# RIGHT
# Real timeout via the shell tool:
timeout 60 adb -s emulator-5554 shell getprop ro.product.model     # GNU timeout
gtimeout 60 adb -s emulator-5554 shell getprop ro.product.model    # macOS (coreutils via brew)
# Use -t only with a transport_id from adb devices -l:
adb -t 2 shell getprop ro.product.model

Mandatory rules

  • MUST add a selector (-s/-d/-e/-t) on every adb command when more than one transport is attached, OR set $ANDROID_SERIAL.
  • MUST use the documented wait-for[-TRANSPORT]-<state> syntax. There is no wait-for-device-online.
  • MUST poll getprop sys.boot_completed after wait-for-device when the script needs the OS fully booted (e.g. before installing an APK or invoking am instrument).
  • MUST NOT confuse -t TRANSPORT_ID with a timeout flag. Wrap with timeout / gtimeout for actual timeouts.
  • MUST NOT delete ~/.android/adbkey* to "fix" unauthorized — see ../../architecture/understanding-adb-architecture/SKILL.md for the correct recovery.
  • PREFERRED: use adb devices -l and transport_id for scripts that may see two devices with the same serial (rare hardware bug or duplicate AVDs).
  • PREFERRED: install the distro's android-udev package on Linux instead of hand-maintaining 51-android.rules.

Verification

  • adb devices -l lists every connected transport with state device (no offline, unauthorized, or no permissions).
  • adb devices | awk '$2=="device"{print $1}' returns one line per ready device.
  • adb -s <serial> get-state prints device.
  • adb wait-for-device returns immediately when at least one transport is in state device.
  • adb shell getprop sys.boot_completed prints 1 after a fresh boot.
  • adb -d shell echo ok (or -e, or -s) succeeds without more than one device/emulator.
  • On Linux, lsusb shows the device and adb devices reports device (not no permissions) after udev rules apply.

References

  • ADB user guide (adb devices, wait-for-*, RSA dialog): https://developer.android.com/tools/adb
  • Run-on-device setup (Linux udev rules and Windows drivers): https://developer.android.com/studio/run/device
  • OEM USB drivers (Windows): https://developer.android.com/tools/extras/oem-usb
  • AOSP adb man page: https://android.googlesource.com/platform/packages/modules/adb/+/refs/heads/main/docs/user/adb.1.md
  • tasks/research/A1-adb-architecture-devices.md — verbatim wait-for-* table, the wait-for-device-online correction, full state set, udev rule recipe.
  • docs/CORPUS.md §I.3 (state truth set) and §I.10 (research findings).
  • Sibling skills:
    • High-level architecture: ../../architecture/understanding-adb-architecture/SKILL.md
    • Wireless ADB: ../connecting-over-wifi/SKILL.md
    • Install / clear apps: ../../apps/installing-and-managing-apps/SKILL.md
    • Run instrumented tests: ../../tests/running-instrumented-tests-via-adb/SKILL.md
  • Cross-set neighbours:
    • Run instrumented tests with AndroidJUnit4: ../../../instrumentation/runner/running-instrumented-tests-with-androidjunit4/SKILL.md
    • Configure JUnit4 on Android: ../../../jvm-tests/runner/configuring-junit4-on-android/SKILL.md
    • Source-set strategy: ../../../fundamentals/strategies/organizing-test-source-sets/SKILL.md

Häufig gestellte Fragen

Was macht der KI-Skill Connecting To Devices?

Use this skill to attach a USB device or emulator to ADB, list transports with `adb devices` / `adb devices -l`, disambiguate among multiple devices using `-s SERIAL`, `-d` (single USB), `-e` (single TCP/IP), or `-t TRANSPORT_ID`, gate scripts on a transport with the canonical `adb wait-for[-TRANSPORT]-<state>` syntax (TRANSPORT in {usb, local, any}; state in {device, recovery, rescue, sideload, bootloader, disconnect}), interpret device states (`device`, `offline`, `unauthorized`, `no permissions`, `recovery`, `sideload`, `bootloader`, `rescue`), accept the RSA fingerprint dialog on first...

Warum Connecting To Devices in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Connecting To Devices besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Connecting To Devices in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/skydoves/android-testing-skills/tree/main/adb/devices/connecting-to-devices ein. TypingMind liest die Datei SKILL.md und installiert den Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Connecting To Devices nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Connecting To Devices verwenden?

So viele Sie möchten. In TypingMind können Sie Connecting To Devices mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Connecting To Devices kostenlos?

Ja. Der Skill wird von skydoves auf GitHub unter der Lizenz Apache-2.0 veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇