1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 02:51:50 +00:00

Add signal from qmi device

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-02-21 11:35:33 +01:00
parent 19af5eac57
commit d2c9d4643b
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,20 @@
#!/bin/sh
MODEM_INTF=$1
[ -z "$MODEM_INTF" ] && return
SIGNAL_INFO=$(uqmi -d $MODEM_INTF --get-signal-info)
[ -z "$SIGNAL_INFO" ] && return
TYPE=$(echo $SIGNAL_INFO | jsonfilter -e '@.type')
if [ "$TYPE" = "umts" ]; then
RSCP=$(echo $SIGNAL_INFO | jsonfilter -e '@.rscp')
[ -z "$RSCP" ] && return
ASU=$((RSCP + 116))
PERCENT=$((((ASU - 0) * 100) / ( 91 - 0 )))
echo $PERCENT
fi
if [ "$TYPE" = "lte" ]; then
RSRP=$(echo $SIGNAL_INFO | jsonfilter -e '@.rsrp')
[ -z "$RSRP" ] && return
ASU=$((RSRP + 140))
PERCENT=$((((ASU - 3) * 100) / ( 70 - 3 )))
echo $PERCENT
fi

View file

@ -1020,6 +1020,12 @@ function interfaces_status()
connectivity = "ERROR" connectivity = "ERROR"
end end
local proto = section['proto']
if proto == "qmi" then
local device = section['device']
signal = sys.exec("omr-qmi " .. device)
end
local latency = "" local latency = ""
local server_ping = "" local server_ping = ""
--if connectivity ~= "ERROR" and ifname ~= "" and gateway ~= "" and gw_ping ~= "DOWN" and ifname ~= nil and mArray.openmptcprouter["service_addr"] ~= "" and ipaddr ~= "" then --if connectivity ~= "ERROR" and ifname ~= "" and gateway ~= "" and gw_ping ~= "DOWN" and ifname ~= nil and mArray.openmptcprouter["service_addr"] ~= "" and ipaddr ~= "" then