From 28e453540f0b0882ddda8557bf2fa25e9f81de08 Mon Sep 17 00:00:00 2001 From: jklug Date: Fri, 29 Jul 2016 10:56:47 -0500 Subject: Reset the Conduit. Some pins are not exposed yet. --- recipes-bsp/multitech/mts-io/mts-io.init | 56 +++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init index 24b891d..3973661 100755 --- a/recipes-bsp/multitech/mts-io/mts-io.init +++ b/recipes-bsp/multitech/mts-io/mts-io.init @@ -1,36 +1,44 @@ #!/bin/bash +### BEGIN INIT INFO +# Provides: mts-io +# Default-Start: 2345 +# Default-Stop: 016 +# Short-Description: load the mts-io driver +# Description: mts-io driver initializes the Conduit hardware and +# provides user mode access through the driver to the +# Conduit features. +### END INIT INFO -fail=0 +((fail=0)) sysdir=/sys/devices/platform/mts-io gpiodir=/sys/class/gpio USBRST=${sysdir}/usbhub-reset -RST[0]="${sysdir}/wifi-bt-reset" +RST[0]="${sysdir}/mtq-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" +RST[5]="${sysdir}/secure-reset" +RST[6]="${sysdir}/eth-reset" +#RST[7]="${sysdir}/wifi-bt-reset" +RS9113RST="${sysdir}/wifi-bt-reset" USLPTIME=30000 # 30 milliseconds WAIT="/bin/busybox usleep ${USLPTIME}" -reset_usb() { - /usr/bin/logger -t "mts-io" -p info Reset the WiFi Bluetooth device +reset_path() { + pin=$1 + /usr/bin/logger -t "mts-io" -p info Reset $pin - 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}" + if [[ -f ${pin} ]] ; then + if ! ( (echo 1 >${pin}) && (echo 0 >${pin}) && ${WAIT} && (echo 1 >${pin}) ) ; then + /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${pin}" fi else - /usr/bin/logger -t "mts-io" -p error -s "${USBRST} does not exist" + /usr/bin/logger -t "mts-io" -p error -s "${pin} does not exist" return 1 fi return 0 @@ -109,17 +117,33 @@ case $1 in ((fail++)) fi read_card_info - if ! reset_usb ; then + if ! reset_path $USBRST ; then ((fail++)) fi + /bin/busybox usleep 100000 reset_array mfser_init + if ! reset_path $RS9113RST ; then + ((fail++)) + fi + + if ((fail == 0)) ; then + echo "OK" + else + echo "FAIL" + fi exit $fail ;; stop) /usr/bin/logger -t "mts-io" -p info -s "Unloading mts-io module" modprobe -r mts_io + RETVAL=$? + if ((RETVAL == 0)) ; then + echo "OK" + else + echo "FAIL" + fi ;; status) if [[ -d ${sysdir} ]] ; then @@ -131,7 +155,7 @@ case $1 in fi ;; *) - echo "Usage: $0 {start|stop}" + echo "Usage: $0 {start|stop|status}" exit 2 ;; esac -- cgit v1.2.3