1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 02:51:50 +00:00
openmptcprouter-feeds/luci-app-openmptcprouter/root/bin/omr-3g
Ycarus (Yannick Chabanois) 453d349ff3 Set timeout to get signal
2020-02-22 14:12:13 +01:00

10 lines
308 B
Bash
Executable file

#!/bin/sh
MODEM_INTF=$1
[ -z "$MODEM_INTF" ] && return
SIGNAL_INFO=$(timeout 1 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