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:
parent
19af5eac57
commit
d2c9d4643b
2 changed files with 26 additions and 0 deletions
20
luci-app-openmptcprouter/root/bin/omr-qmi
Executable file
20
luci-app-openmptcprouter/root/bin/omr-qmi
Executable 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
|
|
@ -1019,6 +1019,12 @@ function interfaces_status()
|
||||||
gw_ping = "DOWN"
|
gw_ping = "DOWN"
|
||||||
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 = ""
|
||||||
|
|
Loading…
Reference in a new issue