wpj428/files/usr/sbin/promsignal

24 lines
821 B
Text
Raw Normal View History

2021-03-23 12:38:36 +00:00
#!/bin/sh
# Global Configuration
mmcli -m 0 --signal-setup=10 2>&1 1>/dev/null
# Fetch & parse signal from MM
RES=$(mmcli -m 0 --signal-get -K)
RSRQ=$(echo -en "$RES" | grep modem.signal.lte.rsrq | grep -Eo "\-?[0-9]*.[0-9]*$")
RSRP=$(echo -en "$RES" | grep modem.signal.lte.rsrp | grep -Eo "\-?[0-9]*.[0-9]*$")
SNR=$(echo -en "$RES" | grep modem.signal.lte.snr | grep -Eo "\-?[0-9]*.[0-9]*$")
# Run AT Command to get LCID not reported by MM
rm -f /tmp/logread.txt
logread -f > /tmp/logread.txt &
LOGREAD_PID=$!
mmcli -m 0 --command="AT+CREG?" > /dev/null
kill -9 ${LOGREAD_PID}
ATRES=$(grep -Eo '\+CREG: [0-9],[0-9],"[0-9A-F]+","[0-9A-F]+"' /tmp/logread.txt)
rm -f /tmp/logread.txt
LCID=$(echo $ATRES | cut -d, -f4 | grep -Eo '[0-9A-F]+')
# Display parsed data
echo "rsrq=$RSRQ, rsrp=$RSRP, snr=$SNR, lcid=$LCID"