aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/bin/adb_wait_for_device
blob: 6e92bf94019d603424385a2768998ac2a1b9d91c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
#
# Wait for the device to be connected.

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SKIP_TOOLCHAIN_SETUP="true"
source $SCRIPT_DIR/android_setup.sh
source $SCRIPT_DIR/utils/setup_adb.sh

set -e

# Wait for the device to be connected and fully booted.
while [ "$($ADB $DEVICE_SERIAL shell getprop sys.boot_completed | tr -d '\r')" != "1" ]; do
  echo "Waiting for the device to be connected and ready."
  sleep 5
done

echo "Connected!"

$SCRIPT_DIR/adb_wait_for_charge $DEVICE_SERIAL