summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjklug <jklug@jklugUB14LTS>2016-07-29 10:02:30 -0500
committerjklug <jklug@jklugUB14LTS>2016-07-29 10:02:30 -0500
commit978c785494031a90fd8b5d414d5d2e29378b6f90 (patch)
tree01b2e8eafe36109383363b6e80f018479560499e
parent2947896e00850272acf4c8ca494f520c800081c9 (diff)
downloadmeta-multitech-978c785494031a90fd8b5d414d5d2e29378b6f90.tar.gz
meta-multitech-978c785494031a90fd8b5d414d5d2e29378b6f90.tar.bz2
meta-multitech-978c785494031a90fd8b5d414d5d2e29378b6f90.zip
Reset the conduit systems -- first USB hub, then the others.
-rwxr-xr-x[-rw-r--r--]recipes-bsp/multitech/mts-io/mts-io.init74
1 files changed, 67 insertions, 7 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init
index e770f90..24b891d 100644..100755
--- a/recipes-bsp/multitech/mts-io/mts-io.init
+++ b/recipes-bsp/multitech/mts-io/mts-io.init
@@ -1,18 +1,72 @@
#!/bin/bash
+fail=0
+
sysdir=/sys/devices/platform/mts-io
gpiodir=/sys/class/gpio
-RS9113RST=${sysdir}/wifi-bt-reset
+USBRST=${sysdir}/usbhub-reset
+
+RST[0]="${sysdir}/wifi-bt-reset"
+RST[1]="${sysdir}/ap1-reset"
+RST[2]="${sysdir}/ap2-reset"
+RST[3]="${sysdir}/gnss-reset"
+RST[4]="${sysdir}/radio-reset"
+RST[5]="${sysdir}/ap2-reset"
+RST[6]="${sysdir}/ap2-reset"
+RST[7]="${sysdir}/mtq-reset"
+RST[8]="${sysdir}/secure-reset"
+RST[9]="${sysdir}/eth-reset"
+RST[10]="${sysdir}/mtq-reset"
+
+USLPTIME=30000 # 30 milliseconds
+WAIT="/bin/busybox usleep ${USLPTIME}"
-reset_rs9113() {
+reset_usb() {
/usr/bin/logger -t "mts-io" -p info Reset the WiFi Bluetooth device
- if [[ -f ${RS9113RST} ]] ; then
- if ! ( (echo 1 >${RS9113RST}) && (echo 0 >${RS9113RST}) && (echo 1 >${RS9113RST}) ) ; then
- /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${RS9113RST}"
+ if [[ -f ${USBRST} ]] ; then
+ if ! ( (echo 1 >${USBRST}) && (echo 0 >${USBRST}) && ${WAIT} && (echo 1 >${USBRST}) ) ; then
+ /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${USBRST}"
fi
+ else
+ /usr/bin/logger -t "mts-io" -p error -s "${USBRST} does not exist"
+ return 1
fi
+ return 0
+}
+reset_array() {
+ ((i=${#RST[@]}-1))
+ while ((i>=0)) ; do
+ if [[ -f ${RST[$i]} ]] ; then
+ if ! ( (echo 1 >${RST[i]}) ) ; then
+ /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${RST[$i]}"
+ fi
+ else
+ /usr/bin/logger -t "mts-io" -p info -s "${RST[$i]} does not exist"
+ RST[$i]=""
+ fi
+ ((i--))
+ done
+ while ((i>0)) ; do
+ if ((${#RST[$i] > 0)) && [[ -f ${RST[$i]} ]] ; then
+ if ! ( (echo 0 >${RST[i]}) ) ; then
+ /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${RST[$i]}"
+ fi
+ else
+ /usr/bin/logger -t "mts-io" -p info -s "${RST[$i]} does not exist"
+ fi
+ done
+ ${WAIT}
+ while ((i>0)) ; do
+ if ((${#RST[$i] > 0)) && [[ -f ${RST[$i]} ]] ; then
+ if ! ( (echo 1 >${RST[i]}) ) ; then
+ /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${RST[$i]}"
+ fi
+ else
+ /usr/bin/logger -t "mts-io" -p info -s "${RST[$i]} does not exist"
+ fi
+ done
}
read_card_info() {
ap1_product_id=""
@@ -51,10 +105,16 @@ mfser_init() {
case $1 in
start)
/usr/bin/logger -t "mts-io" -p info -s "Loading mts-io module"
- modprobe mts_io
+ if ! modprobe mts_io ; then
+ ((fail++))
+ fi
read_card_info
- reset_rs9113
+ if ! reset_usb ; then
+ ((fail++))
+ fi
+ reset_array
mfser_init
+ exit $fail
;;
stop)