summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--recipes-bsp/multitech/mts-io/mts-io.mtcap.init25
1 files changed, 15 insertions, 10 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.mtcap.init b/recipes-bsp/multitech/mts-io/mts-io.mtcap.init
index faebc6f..e047c40 100644
--- a/recipes-bsp/multitech/mts-io/mts-io.mtcap.init
+++ b/recipes-bsp/multitech/mts-io/mts-io.mtcap.init
@@ -1,6 +1,14 @@
#!/bin/bash
+
sysdir=/sys/devices/platform/mts-io
+setwificap() {
+ WIFICAP=0
+ if [[ -f ${sysdir}/capability/wifi ]] && (($(cat ${sysdir}/capability/wifi) == 1)) ; then
+ WIFICAP=1
+ fi
+}
+
lora_init() {
# reset lora chip
mts-io-sysfs store lora/reset 1
@@ -19,7 +27,7 @@ eth_init() {
# Normal state when powered up
wifi_init1() {
- [[ -f ${sysdir}/capability/wifi ]] || return 0
+ (($WIFICAP)) || return 0
# reset wlan
mts-io-sysfs store wlan-rst 0
# disable wlan
@@ -27,7 +35,7 @@ wifi_init1() {
}
wifi_init2() {
- [[ -f ${sysdir}/capability/wifi ]] || return 0
+ (($WIFICAP)) || return 0
mts-io-sysfs store wlan-en 1
usleep 30000 # 30mS according to WILC1000 spec.
mts-io-sysfs store wlan-rst 1
@@ -54,6 +62,7 @@ case $1 in
echo "Loading mts-io module"
modprobe -r atmel_mci
modprobe mts_io
+ setwificap
wifi_init1
lora_init
eth_init
@@ -61,19 +70,15 @@ case $1 in
start_lora_led_updater
wifi_init2
modprobe atmel_mci
- if [[ -f ${sysdir}/capability/wifi ]] ; then
- modprobe wilc1000
- modprobe wilc1000-sdio
- fi
+ (($WIFICAP)) && modprobe wilc1000
+ (($WIFICAP)) && modprobe wilc1000-sdio
;;
stop)
echo "Unloading mts-io module"
wifi_init1 # Power down wifi
- if [[ -f ${sysdir}/capability/wifi ]] ; then
- modprobe -r wilc1000-sdio >/dev/null 2>&1
- modprobe -r wilc1000 >/dev/null 2>&1
- fi
+ modprobe -r wilc1000 >/dev/null 2>&1
+ modprobe -r wilc1000-sdio >/dev/null 2>&1
modprobe -r mts_io >/dev/null 2>&1
;;