Skip to content

Commit

Permalink
Up to 1.0.71-20240512
Browse files Browse the repository at this point in the history
Fix for duplicate operator name
  • Loading branch information
4IceG authored May 12, 2024
1 parent 1a6c522 commit a592d3f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 32 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.70-20240510
PKG_VERSION:=1.0.71-20240512

include $(TOPDIR)/feeds/luci/luci.mk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,25 @@ function formatDateTime(s) {
return s;
}

function checkOperatorName(t) {
var w = t.split(" ");
var f = {};

for (var i = 0; i < w.length; i++) {
var wo = w[i].toLowerCase();
if (!f.hasOwnProperty(wo)) {
f[wo] = i;
}
}

var u = Object.keys(f).map(function(wo) {
return w[f[wo]];
});

var r = u.join(" ");
return r;
}

return view.extend({


Expand Down Expand Up @@ -361,7 +380,7 @@ simDialog: baseclass.extend({

render: function(content) {

let json = JSON.parse(content);
var json = JSON.parse(content);

if (json) {
if (!json.imei.length > 2) {
Expand Down Expand Up @@ -570,7 +589,7 @@ simDialog: baseclass.extend({
view.textContent = '-';
}
else {
view.textContent = json.operator_name;
view.textContent = checkOperatorName(json.operator_name);
}
}

Expand Down
33 changes: 7 additions & 26 deletions luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -217,27 +217,6 @@ getpath() {
esac
}

rmduplicates() {
local rv=""
set_uplow() {
echo "$1" | tr '[:upper:]' '[:lower:]'
}
for name in $1; do
d_name=$(set_uplow "$name")
d=false
for vn in $rv; do
if [ "$(set_uplow "$vn")" = "$d_name" ]; then
d=true
break
fi
done
if [ "$d" = false ]; then
rv="$rv $name"
fi
done
echo "$rv" | xargs
}

# --- modemdefine - WAN config ---
CONFIG=modemdefine
MODEMZ=$(uci show $CONFIG | grep -o "@modemdefine\[[0-9]*\]\.modem" | wc -l | xargs)
Expand Down Expand Up @@ -319,18 +298,20 @@ if [ -n "$COPS_NUM" ]; then
COPS_MNC=${COPS_NUM:3:3}
fi

if [ -z "$FORCE_PLMN" ]; then
T=$(echo "$O" | awk -F[\"] '/^\+COPS:\s*.,0/ {print $2}')
[ "x$T" != "x" ] && COPS="$T"
else
TCOPS=$(echo "$O" | awk -F[\"] '/^\+COPS:\s*.,0/ {print $2}')
[ "x$TCOPS" != "x" ] && COPS="$TCOPS"

if [ -z "$COPS" ]; then
if [ -n "$COPS_NUM" ]; then
COPS=$(awk -F[\;] '/^'$COPS_NUM';/ {print $3}' $RES/mccmnc.dat | xargs)
LOC=$(awk -F[\;] '/^'$COPS_NUM';/ {print $2}' $RES/mccmnc.dat)
fi
fi
[ -z "$COPS" ] && COPS=$COPS_NUM

COPS=$(rmduplicates "$COPS")
if [[ $COPS =~ " " ]]; then
COPS=$(echo "$COPS" | awk '{if(NF==2 && tolower($1)==tolower($2)){print $1}else{print $0}}')
fi

isp=$(sms_tool -d $DEVICE at "AT+COPS?"|sed -n '2p'|cut -d '"' -f2|tr -d '\r')
isp_num="$COPS_MCC $COPS_MNC"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ if [ -n "$T" ]; then
# [ -n "$T" ] && addon 68 "(S4) SNR" "$T"
fi

MODE=$(echo $MODE | sed 's,/,+,' | sed 's,LTE_A,LTE-A | ,')
MODE=$(echo $MODE | sed 's,/,+,' | sed 's,LTE_A,LTE-A | ,' | sed 's,LTE B,LTE | B,')

# Cell ID & LAC & TAC
LAC_HEX=$(printf "%X" $LAC_DEC)
Expand Down Expand Up @@ -184,8 +184,9 @@ if [ -z "$MODEL" ]
then
MODELBCUT=$(echo $PVMODEL | awk -F 'Manufacturer=|S: Product=' '{print $2}' | sed s/"Inc. "// | xargs)
MODELACUT=$(echo $PVMODEL | awk -F 'Product=| S: SerialNumber' '{print $2}'| xargs)
MODELC="$MODELBCUT "$MODELACUT
MODEL=$(echo "$MODELC" | awk '{for (i=1;i<=NF;i++) if (!a[$i]++) printf("%s%s",$i,FS)}{printf("\n")}' | tr -d '\r\n')
MODEL="$MODELBCUT "$MODELACUT
# MODELC="$MODELBCUT "$MODELACUT
# MODEL=$(echo "$MODELC" | awk '{for (i=1;i<=NF;i++) if (!a[$i]++) printf("%s%s",$i,FS)}{printf("\n")}' | tr -d '\r\n')
fi

# FW
Expand Down

0 comments on commit a592d3f

Please sign in to comment.