blob: 2bdb9def06931d3cb50cd6a162d43e852bcc4b72 [file] [log] [blame]
Nils Fürstea8263f42020-11-23 14:45:15 +01001#!/bin/bash
Andre Puschmanne98e1292021-03-08 16:40:48 +01002# This script reads the network type of an Android phone via ADB/SSH
3# If the first argument (serial) is 0, SSH is used to remotely connect to the phone
Nils Fürstea8263f42020-11-23 14:45:15 +01004# usage: osmo-gsm-tester_androidue_conn_chk.sh $serial $remote_ip $remote_port
Andre Puschmanne98e1292021-03-08 16:40:48 +01005#set -x
6
7# check if all parameters have been passed
8if ([ ! $3 ])
9then
10 echo "Please call script with osmo-gsm-tester_androidue_conn_chk.sh $serial $remote_ip $remote_port"
11 echo "E.g. ./osmo-gsm-tester_androidue_conn_chk.sh df2df 10.12.1.106 130 10"
12 exit
13fi
14
Nils Fürstea8263f42020-11-23 14:45:15 +010015serial=$1
16remote_ip=$2
17remote_port=$3
Andre Puschmanne98e1292021-03-08 16:40:48 +010018
19echo "Waiting for Android UE to become available .."
20
21# Check adb is available, if needed
22if [ "$serial" != "0" ]; then
23 if ! [ -x "$(command -v adb)" ]; then
24 echo 'Error: adb is not installed.' >&2
25 exit 1
26 fi
27 echo "Using SSH to access device"
28fi
29
Nils Fürstea8263f42020-11-23 14:45:15 +010030while true; do
Andre Puschmanne98e1292021-03-08 16:40:48 +010031 if [ "$serial" == "0" ]; then
Nils Fürstea8263f42020-11-23 14:45:15 +010032 # run_type == ssh
33 ssh -p "${remote_port}" root@"${remote_ip}" getprop "gsm.network.type"
34 else
35 # run_type = local
36 adb -s "${serial}" shell getprop "gsm.network.type"
37 fi
38 sleep 1
Andre Puschmanne98e1292021-03-08 16:40:48 +010039done