summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/radio-reset/radio-reset.init
blob: 8da9f875fe0e7b35c6572b03764955edf91de698 (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
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

# set default values
ENABLED="yes"
ONSTART="no"
ONSTOP="yes"
# Do radio-reset in the background
BACKGROUND="no"


if ! [[ -w /sys/devices/platform/mts-io/radio-reset ]] ; then
    exit 0
fi

# load the values from /etc/default/radio-reset
[ -r /etc/default/radio-reset ] && source /etc/default/radio-reset

[[ $BACKGROUND == yes ]] && BG="&"

case $1 in
  start)
    if [[ $ENABLED == "yes" ]] && [[ $ONSTART == "yes" ]] ; then
        eval mts-io-sysfs store radio-reset 0 $BG
        echo "Resetting cellular radio"
    fi
    ;;
  stop)
    if [[ $ENABLED == "yes" ]] && [[ $ONSTOP == "yes" ]] ; then
        eval mts-io-sysfs store radio-reset 0 $BG
        echo "Resetting cellular radio"
    fi
    ;;
  reload)
    eval mts-io-sysfs store radio-reset 0 $BG
    ;;
  *)
    echo "Usage: $0 {start|stop|reload}"
    exit 2
    ;;
esac