summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/radio-reset/radio-reset.init
blob: 1326feeb72e5bbf2f5b535bd5da6888588d61336 (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
#!/bin/sh

# set default values
ENABLED="yes"
ONSTART="no"
ONSTOP="yes"

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

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