From 64ed54b14ec142e9126af988ef5778c2ac1ef2a2 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 21 Feb 2020 11:59:12 +0100 Subject: [PATCH] Try to add signal from 3g proto --- luci-app-openmptcprouter/root/bin/omr-3g | 10 ++++++++++ luci-app-openmptcprouter/root/bin/omr-qmi | 7 +++++++ .../root/usr/libexec/rpcd/openmptcprouter | 3 +++ 3 files changed, 20 insertions(+) create mode 100755 luci-app-openmptcprouter/root/bin/omr-3g diff --git a/luci-app-openmptcprouter/root/bin/omr-3g b/luci-app-openmptcprouter/root/bin/omr-3g new file mode 100755 index 000000000..870688b15 --- /dev/null +++ b/luci-app-openmptcprouter/root/bin/omr-3g @@ -0,0 +1,10 @@ +#!/bin/sh +MODEM_INTF=$1 +[ -z "$MODEM_INTF" ] && return +SIGNAL_INFO=$(gcom info -d $MODEM_INTF) +[ -z "$SIGNAL_INFO" ] && return +RSSI=$(echo $SIGNAL_INFO | grep RSSI | awk -F: '{print $2}') +[ -z "$RSSI" ] && return +ASU=$(((RSSI + 113) / 2 )) +PERCENT=$((((ASU - 0) * 100) / ( 91 - 0 ))) +echo $PERCENT diff --git a/luci-app-openmptcprouter/root/bin/omr-qmi b/luci-app-openmptcprouter/root/bin/omr-qmi index 17e9c1ede..327cdb1bd 100755 --- a/luci-app-openmptcprouter/root/bin/omr-qmi +++ b/luci-app-openmptcprouter/root/bin/omr-qmi @@ -4,6 +4,13 @@ MODEM_INTF=$1 SIGNAL_INFO=$(uqmi -d $MODEM_INTF --get-signal-info) [ -z "$SIGNAL_INFO" ] && return TYPE=$(echo $SIGNAL_INFO | jsonfilter -e '@.type') +if [ "$TYPE" = "gsm" ]; then + RSSI=$(echo $SIGNAL_INFO | jsonfilter -e '@.rssi') + [ -z "$RSSI" ] && return + ASU=$(((RSSI + 113) / 2 )) + PERCENT=$((((ASU - 0) * 100) / ( 91 - 0 ))) + echo $PERCENT +fi if [ "$TYPE" = "umts" ]; then RSCP=$(echo $SIGNAL_INFO | jsonfilter -e '@.rscp') [ -z "$RSCP" ] && return diff --git a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter index 41810a517..c72e84a58 100755 --- a/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter +++ b/luci-app-openmptcprouter/root/usr/libexec/rpcd/openmptcprouter @@ -1024,6 +1024,9 @@ function interfaces_status() 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) end local latency = ""