Skip to content

Commit

Permalink
Update to version 1.0.62-20240113
Browse files Browse the repository at this point in the history
  • Loading branch information
4IceG authored Jan 13, 2024
1 parent 4a0cc23 commit 1757a6a
Show file tree
Hide file tree
Showing 48 changed files with 9,317 additions and 1,768 deletions.
2 changes: 1 addition & 1 deletion luci-app-3ginfo-lite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,21 @@ modemDialog: baseclass.extend({
}
}

if (document.getElementById('location')) {
var view = document.getElementById("location");
if (json.signal == 0 || json.signal == '') {
view.textContent = '-';
}
else {
if (json.location == '') {
view.textContent = '-';
}
else {
view.textContent = json.location;
}
}
}

if (document.getElementById('sim')) {
var view = document.getElementById("sim");
var sv = document.getElementById("simv");
Expand Down Expand Up @@ -847,8 +862,13 @@ modemDialog: baseclass.extend({
]),
E('tr', { 'class': 'tr' }, [
E('td', { 'class': 'td left', 'width': '33%' }, [ _('Operator')]),
E('td', { 'class': 'td left', 'id': 'operator' }, [ '-' ]),
E('td', { 'class': 'td left' }, [
E('div', { 'class': 'right' }, [
E('div', { 'style': 'text-align:left;font-size:100%', 'id': 'operator' }, [ '-' ]),
E('div', { 'style': 'text-align:left;font-size:66%', 'id': 'location' }, [ '-' ]),
]),
]),
]),
E('tr', { 'class': 'tr' }, [
E('td', { 'class': 'td left', 'width': '33%' }, [ _('SIM status')]),
E('td', { 'class': 'td left'}, [
Expand Down
54 changes: 44 additions & 10 deletions luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo.sh
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
#


Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -246,6 +255,8 @@ else
fi

# COPS numeric
# see https://mcc-mnc.com/
# Update: 13/01/2024 items: 2965
COPS=""
COPS_MCC=""
COPS_MNC=""
Expand All @@ -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)
Expand Down Expand Up @@ -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}
Expand All @@ -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"
Expand All @@ -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",
Expand Down
15 changes: 10 additions & 5 deletions luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/detect.sh
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
#


Expand Down Expand Up @@ -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%/*}
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 1757a6a

Please sign in to comment.