summaryrefslogtreecommitdiff
path: root/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-cell-radio-ready
blob: 99304255dabeb0874450052f5dc290af64c0fbc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

COUNTER=0
TIMEOUT=60

if [ $# -gt 1 ]; then
    echo "usage: $0 [timeout]"
    exit 1
fi

[ $# -eq 1 ] && TIMEOUT=$1

# Wait for the radio to be ready before continuing
while [ $COUNTER -lt $TIMEOUT ]; do
  TYPE=$(radio-query --type)
  MODEL=$(radio-query --model)
  if [ $? == 0 ]; then
    echo "Cellular radio is ready."
    exit 0
  fi
  let COUNTER=COUNTER+1

  echo "Waiting for radio to come up in order to identify type ..."

  sleep 1
done

echo "Cellular radio is not ready."
exit 1