diff --git a/luci-app-openmptcprouter/root/bin/omr-modemmanager b/luci-app-openmptcprouter/root/bin/omr-modemmanager index 1bf4ec611..cce31181e 100755 --- a/luci-app-openmptcprouter/root/bin/omr-modemmanager +++ b/luci-app-openmptcprouter/root/bin/omr-modemmanager @@ -1,7 +1,11 @@ #!/bin/sh MODEM_INTF=$1 [ -z "$MODEM_INTF" ] && return -SIGNAL_INFO=$(mmcli -m $MODEM_INTF --output-keyvalue) -[ -z "$SIGNAL_INFO" ] && return -PERCENT=$(echo $SIGNAL_INFO | grep 'status.signal-quality' | awk -F": " '{print $2}') +ALL_MODEMS=$(mmcli -L) +for MODEM in $ALL_MODEMS; do + MODEM_ID=$(echo $MODEM | awk -F' ' '{print $1}' | awk -F/ '{print $6}') + MODEM_INFO=$(mmcli -m $MODEM_ID --output-keyvalue | grep $MODEM_INTF) +done +[ -z "$MODEM_INFO" ] && return +PERCENT=$(echo $MODEM_INFO | grep 'modem.generic.signal-quality.value' | awk -F": " '{print $2}') echo $PERCENT diff --git a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter index bdb205389..0faccb253 100755 --- a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter +++ b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter @@ -1020,16 +1020,18 @@ function interfaces_status() connectivity = "ERROR" end - local proto = section['proto'] - if proto == "qmi" then - local device = section['device'] - signal = sys.exec("omr-qmi " .. device) - elseif proto == "3g" then - local device = section['device'] - signal = sys.exec("omr-3g " .. device) - elseif proto == "modemmanager" then - local device = section['device'] - signal = sys.exec("omr-modemmanager " .. device) + if ifname ~= "" and ifname ~= nil then + local proto = section['proto'] + if proto == "qmi" then + local device = section['device'] + signal = sys.exec("omr-qmi " .. device) + elseif proto == "3g" then + local device = section['device'] + signal = sys.exec("omr-3g " .. device) + elseif proto == "modemmanager" then + local device = section['device'] + signal = sys.exec("omr-modemmanager " .. ifname) + end end local latency = ""