summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2021-12-09 14:52:00 -0600
committerJohn Klug <john.klug@multitech.com>2021-12-29 08:36:49 -0600
commit7da4ce909ae3da31faf70de2decb638ae8886db9 (patch)
treed1d4e1ca321d3df4589fa162cb67ff2c3c0b8acd
parente4fee5bce103cbb1b60f171cd162bc57f1e0539f (diff)
downloadmeta-multitech-atmel-7da4ce909ae3da31faf70de2decb638ae8886db9.tar.gz
meta-multitech-atmel-7da4ce909ae3da31faf70de2decb638ae8886db9.tar.bz2
meta-multitech-atmel-7da4ce909ae3da31faf70de2decb638ae8886db9.zip
Add logging to evaluate rs9113 initialization
-rwxr-xr-xrecipes-kernel/rs9113/files/rs9113/rs9113.init45
1 files changed, 39 insertions, 6 deletions
diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init
index 0fffb94..ced9e35 100755
--- a/recipes-kernel/rs9113/files/rs9113/rs9113.init
+++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init
@@ -16,18 +16,49 @@ MTS_IODIR=/sys/devices/platform/mts-io
RS9113_RESET=${MTS_IODIR}/wifi-bt-reset
RS9113_INT=${MTS_IODIR}/wifi-bt-int
RS9113_WKUP=${MTS_IODIR}/wifi-bt-lpwkup
+RSTLOG=/var/config/rs9113rstlog
[ -f $CONFIG ] || exit 1
. $CONFIG
+pid=$$
+LOG_ERR=3
+LOG_INFO=6
+
+prefix="<${pr}>rs9113[${pid}]: "
+function syslog {
+ pr=$1
+ shift
+ [[ $(cat /proc/uptime =~ ([^[:space:]]+) ]]
+ s=$(printf "%12.12fs %s" ${BASH_REMATCH[1]} "${prefix}$@")
+ echo "$s" >/dev/kmsg
+ echo "$s"
+ echo "$s" >>${RSTLOG}
+}
+
+function logfile {
+ [[ $(cat /proc/uptime =~ ([^[:space:]]+) ]]
+ s=$(printf "%12.12fs %s" ${BASH_REMATCH[1]} "${prefix}$@")
+ echo "$s" >${RSTLOG}
+}
+
+function logpipe {
+ OIFS="${IFS}"
+ IFS=$'\n'
+ while read ln ; do
+ syslog $1 $ln
+ done
+ IFS="${OIFS}"
+}
+
function rs9113_reset {
for i in {1..5} ; do
if [[ -f $RS9113_RESET ]] ; then
break
fi
done
-
+
# Reset the RS9113 chip is ready, and
# wait for it to settle.
for i in {1..5} ; do
@@ -39,15 +70,17 @@ function rs9113_reset {
# No WiFi BT, so exit quietly
exit 0
fi
+ logfile "After reset $i complete"
for j in {0..250} ; do
if /usr/bin/lsusb -d 1618:9113 ; then
+ logfile "lsusb found 1618:9113 after reset $i"
break 2
fi
usleep 100000
done
if ((i > 1)) ; then
- logger -t rs9113 -p error -s "RS9113 not found after $i resets"
- /usr/bin/lsusb | logger -t rs9113 -p error -s
+ syslog $LOG_ERR "RS9113 not found after $i resets"
+ /usr/bin/lsusb | logpipe $LOG_ERR
fi
done
}
@@ -59,7 +92,7 @@ case "$1" in
exit 0
fi
rs9113_reset
- /usr/bin/logger -t "rs9113" -p info -s "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE"
+ syslog LOG_INFO "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE"
/usr/sbin/rs9113_load_modules.sh $CONFIG
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
@@ -70,7 +103,7 @@ case "$1" in
;;
stop)
- /usr/bin/logger -t "rs9113" -p info -s "Unloading rs9113 modules"
+ syslog LOG_INFO "Unloading rs9113 modules"
/usr/sbin/rs9113_remove_modules.sh
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
@@ -98,7 +131,7 @@ case "$1" in
rs9113_reset
;;
*)
- "Usage: $0 {start|stop|status|restart|reset}"
+ echo "Usage: $0 {start|stop|status|restart|reset}"
exit 2
;;
esac