-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
9,317 additions
and
1,768 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ MAINTAINER:=Rafał Wabik <[email protected]> | |
LUCI_DESCRIPTION:=LuCI JS interface for the 3ginfo-lite. The package allows you to view the parameters of the mobile internet connection. | ||
LUCI_DEPENDS:=+sms-tool +comgt +kmod-usb-serial-option | ||
LUCI_PKGARCH:=all | ||
PKG_VERSION:=1.0.61-20240102 | ||
PKG_VERSION:=1.0.62-20240113 | ||
|
||
include $(TOPDIR)/feeds/luci/luci.mk | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# (c) 2010-2023 Cezary Jackiewicz <[email protected]> | ||
# (c) 2010-2024 Cezary Jackiewicz <[email protected]> | ||
# | ||
# (c) 2021-2023 modified by Rafał Wabik - IceG - From eko.one.pl forum | ||
# (c) 2021-2024 modified by Rafał Wabik - IceG - From eko.one.pl forum | ||
# | ||
|
||
|
||
|
@@ -151,20 +151,29 @@ band5g() { | |
getdevicevendorproduct() { | ||
devname="$(basename $1)" | ||
case "$devname" in | ||
'wwan'*'at'*) | ||
devpath="$(readlink -f /sys/class/wwan/$devname/device)" | ||
T=${devpath%/*/*/*} | ||
if [ -e $T/vendor ] && [ -e $T/device ]; then | ||
V=$(cat $T/vendor) | ||
D=$(cat $T/device) | ||
echo "pci/${V/0x/}${D/0x/}" | ||
fi | ||
;; | ||
'ttyACM'*) | ||
devpath="$(readlink -f /sys/class/tty/$devname/device)" | ||
T=${devpath%/*} | ||
echo "$(cat $T/idVendor)$(cat $T/idProduct)" | ||
echo "usb/$(cat $T/idVendor)$(cat $T/idProduct)" | ||
;; | ||
'tty'*) | ||
devpath="$(readlink -f /sys/class/tty/$devname/device)" | ||
T=${devpath%/*/*} | ||
echo "$(cat $T/idVendor)$(cat $T/idProduct)" | ||
echo "usb/$(cat $T/idVendor)$(cat $T/idProduct)" | ||
;; | ||
*) | ||
devpath="$(readlink -f /sys/class/usbmisc/$devname/device)" | ||
T=${devpath%/*} | ||
echo "$(cat $T/idVendor)$(cat $T/idProduct)" | ||
echo "usb/$(cat $T/idVendor)$(cat $T/idProduct)" | ||
;; | ||
esac | ||
} | ||
|
@@ -246,6 +255,8 @@ else | |
fi | ||
|
||
# COPS numeric | ||
# see https://mcc-mnc.com/ | ||
# Update: 13/01/2024 items: 2965 | ||
COPS="" | ||
COPS_MCC="" | ||
COPS_MNC="" | ||
|
@@ -258,13 +269,35 @@ fi | |
if [ -z "$FORCE_PLMN" ]; then | ||
COPS=$(echo "$O" | awk -F[\"] '/^\+COPS: .,0/ {print $2}') | ||
else | ||
[ -n "$COPS_NUM" ] && COPS=$(awk -F[\;] '/^'$COPS_NUM';/ {print $2}' $RES/mccmnc.dat) | ||
if [ -n "$COPS_NUM" ]; then | ||
COPS=$(awk -F[\;] '/^'$COPS_NUM';/ {print $3}' $RES/mccmnc.dat) | ||
LOC=$(awk -F[\;] '/^'$COPS_NUM';/ {print $2}' $RES/mccmnc.dat) | ||
fi | ||
fi | ||
[ -z "$COPS" ] && COPS=$COPS_NUM | ||
|
||
COPZ=$(echo $COPS | sed ':s;s/\(\<\S*\>\)\(.*\)\<\1\>/\1\2/g;ts') | ||
COPS=$(echo $COPZ | awk '{for(i=1;i<=NF;i++){ $i=toupper(substr($i,1,1)) substr($i,2) }}1') | ||
|
||
# operator location from temporary config | ||
LOCATIONFILE=/tmp/location | ||
if [ -e "$LOCATIONFILE" ]; then | ||
touch $LOCATIONFILE | ||
LOC=$(cat $LOCATIONFILE) | ||
if [ -n "$LOC" ]; then | ||
LOC=$(cat $LOCATIONFILE) | ||
else | ||
echo "-" > /tmp/location | ||
fi | ||
else | ||
LOC=$(awk -F[\;] '/^'$COPS_NUM';/ {print $2}' $RES/mccmnc.dat) | ||
if [ -n "$LOC" ]; then | ||
echo "$LOC" > /tmp/location | ||
else | ||
echo "-" > /tmp/location | ||
fi | ||
fi | ||
|
||
T=$(echo "$O" | awk -F[,\ ] '/^\+CPIN:/ {print $0;exit}' | xargs) | ||
if [ -n "$T" ]; then | ||
[ "$T" = "+CPIN: READY" ] || REG=$(echo "$T" | cut -f2 -d: | xargs) | ||
|
@@ -333,13 +366,13 @@ fi | |
CONF_DEVICE=$(uci -q get 3ginfo.@3ginfo[0].device) | ||
if echo "x$CONF_DEVICE" | grep -q "192.168."; then | ||
if grep -q "Vendor=1bbb" /sys/kernel/debug/usb/devices; then | ||
. $RES/hilink/alcatel_hilink.sh $DEVICE | ||
. $RES/modem/hilink/alcatel_hilink.sh $DEVICE | ||
fi | ||
if grep -q "Vendor=12d1" /sys/kernel/debug/usb/devices; then | ||
. $RES/hilink/huawei_hilink.sh $DEVICE | ||
. $RES/modem/hilink/huawei_hilink.sh $DEVICE | ||
fi | ||
if grep -q "Vendor=19d2" /sys/kernel/debug/usb/devices; then | ||
. $RES/hilink/zte.sh $DEVICE | ||
. $RES/modem/hilink/zte.sh $DEVICE | ||
fi | ||
SEC=$(uci -q get 3ginfo.@3ginfo[0].network) | ||
SEC=${SEC:-wan} | ||
|
@@ -352,7 +385,7 @@ if [ -e /usr/bin/sms_tool ]; then | |
if [ -e "$RES/modem/$VIDPID" ]; then | ||
case $(cat /tmp/sysinfo/board_name) in | ||
"zte,mf289f") | ||
. "$RES/modem/19d21485" | ||
. "$RES/modem/usb/19d21485" | ||
;; | ||
*) | ||
. "$RES/modem/$VIDPID" | ||
|
@@ -379,6 +412,7 @@ cat <<EOF | |
"operator_name":"$COPS", | ||
"operator_mcc":"$COPS_MCC", | ||
"operator_mnc":"$COPS_MNC", | ||
"location":"$LOC", | ||
"mode":"$MODE", | ||
"registration":"$REG", | ||
"simslot":"$SSIM", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# (c) 2023 Cezary Jackiewicz <[email protected]> | ||
# (c) 2023-2024 Cezary Jackiewicz <[email protected]> | ||
# | ||
# (c) 2023 modified by Rafał Wabik - IceG - From eko.one.pl forum | ||
# (c) 2023-2024 modified by Rafał Wabik - IceG - From eko.one.pl forum | ||
# | ||
|
||
|
||
|
@@ -43,6 +43,10 @@ fi | |
getdevicepath() { | ||
devname="$(basename $1)" | ||
case "$devname" in | ||
'wwan'*'at'*) | ||
devpath="$(readlink -f /sys/class/wwan/$devname/device)" | ||
echo ${devpath%/*/*/*} | ||
;; | ||
'ttyACM'*) | ||
devpath="$(readlink -f /sys/class/tty/$devname/device)" | ||
echo ${devpath%/*} | ||
|
@@ -75,18 +79,19 @@ if [ -n "$DEVICE" ]; then | |
fi | ||
|
||
# find any device | ||
DEVICES=$(find /dev -name "ttyUSB*" -o -name "ttyACM*" | sort -r) | ||
DEVICES=$(find /dev -name "ttyUSB*" -o -name "ttyACM*" -o -name "wwan*at*" | sort -r) | ||
# limit to devices from the modem | ||
WAN=$(uci -q get network.wan.device) | ||
if [ -e "$WAN" ]; then | ||
USBPATH=$(getdevicepath "$WAN") | ||
DEVPATH=$(getdevicepath "$WAN") | ||
DEVICESFOUND="" | ||
for DEVICE in $DEVICES; do | ||
T=$(getdevicepath $DEVICE) | ||
[ "x$T" = "x$USBPATH" ] && DEVICESFOUND="$DEVICESFOUND $DEVICE" | ||
[ "x$T" = "x$DEVPATH" ] && DEVICESFOUND="$DEVICESFOUND $DEVICE" | ||
done | ||
DEVICES="$DEVICESFOUND" | ||
fi | ||
|
||
for DEVICE in $DEVICES; do | ||
gcom -d $DEVICE -s /usr/share/3ginfo-lite/check.gcom >/dev/null 2>&1 | ||
if [ $? = 0 ]; then | ||
|
Oops, something went wrong.