feat: add pcie dial support for rw350r-gl and other mtk_t7xx devices
This commit is contained in:
parent
ce8cae0f69
commit
f21eb3b3e9
@ -26,6 +26,8 @@ LUCI_DEPENDS:=+luci-compat \
|
|||||||
+usbutils \
|
+usbutils \
|
||||||
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_PCI_SUPPORT:kmod-pcie_mhi \
|
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_PCI_SUPPORT:kmod-pcie_mhi \
|
||||||
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_PCI_SUPPORT:pciutils \
|
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_PCI_SUPPORT:pciutils \
|
||||||
|
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_MTK_T7XX_SUPPORT:umbim \
|
||||||
|
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_MTK_T7XX_SUPPORT:kmod-mtk-t7xx \
|
||||||
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_QFIREHOSE_SUPPORT:qfirehose \
|
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_QFIREHOSE_SUPPORT:qfirehose \
|
||||||
+PACKAGE_luci-app-qmodem_USE_TOM_CUSTOMIZED_QUECTEL_CM:quectel-CM-5G-M \
|
+PACKAGE_luci-app-qmodem_USE_TOM_CUSTOMIZED_QUECTEL_CM:quectel-CM-5G-M \
|
||||||
+PACKAGE_luci-app-qmodem_USING_QWRT_QUECTEL_CM_5G:quectel-CM-5G \
|
+PACKAGE_luci-app-qmodem_USING_QWRT_QUECTEL_CM_5G:quectel-CM-5G \
|
||||||
@ -33,7 +35,6 @@ LUCI_DEPENDS:=+luci-compat \
|
|||||||
+tom_modem \
|
+tom_modem \
|
||||||
+jq +bc\
|
+jq +bc\
|
||||||
+coreutils +coreutils-stat
|
+coreutils +coreutils-stat
|
||||||
|
|
||||||
|
|
||||||
define Package/luci-app-qmodem/conffiles
|
define Package/luci-app-qmodem/conffiles
|
||||||
/etc/config/qmodem
|
/etc/config/qmodem
|
||||||
@ -69,6 +70,10 @@ endchoice
|
|||||||
bool "Add PCIe Modem SUPPORT"
|
bool "Add PCIe Modem SUPPORT"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config PACKAGE_luci-app-qmodem_INCLUDE_ADD_MTK_T7XX_SUPPORT
|
||||||
|
bool "Add MTK-T7XX Modem PCI SUPPORT"
|
||||||
|
default n
|
||||||
|
|
||||||
config PACKAGE_luci-app-qmodem_INCLUDE_ADD_QFIREHOSE_SUPPORT
|
config PACKAGE_luci-app-qmodem_INCLUDE_ADD_QFIREHOSE_SUPPORT
|
||||||
bool "Add Qfirehose SUPPORT"
|
bool "Add Qfirehose SUPPORT"
|
||||||
default n
|
default n
|
||||||
|
@ -735,7 +735,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update(){
|
update(){
|
||||||
this.get_config();
|
this.get_config();
|
||||||
}
|
}
|
||||||
@ -750,7 +750,7 @@
|
|||||||
this.task = null;
|
this.task = null;
|
||||||
this.init_nc_table();
|
this.init_nc_table();
|
||||||
}
|
}
|
||||||
|
|
||||||
scan_neighborcell(){
|
scan_neighborcell(){
|
||||||
this.get_config();
|
this.get_config();
|
||||||
}
|
}
|
||||||
@ -769,15 +769,15 @@
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
nr_options(){
|
nr_options(){
|
||||||
if (this.rat_input.selectedIndex == 0) {
|
if (this.rat_input.selectedIndex == 0) {
|
||||||
this.band_tr.style.display = "none";
|
this.band_tr.style.display = "none";
|
||||||
this.scs_tr.style.display = "none";
|
this.scs_tr.style.display = "none";
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.band_tr.style.display = "";
|
|
||||||
this.scs_tr.style.display = "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
this.band_tr.style.display = "";
|
||||||
|
this.scs_tr.style.display = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init_nc_table(){
|
init_nc_table(){
|
||||||
var neighborcell_table,setting_table,status_table ;
|
var neighborcell_table,setting_table,status_table ;
|
||||||
@ -840,7 +840,6 @@
|
|||||||
scs_tr.appendChild(td);
|
scs_tr.appendChild(td);
|
||||||
scs_tr.appendChild(td1);
|
scs_tr.appendChild(td1);
|
||||||
|
|
||||||
|
|
||||||
status_th = this.createTH("<%:Status%>");
|
status_th = this.createTH("<%:Status%>");
|
||||||
status_trh = this.createTRHeader();
|
status_trh = this.createTRHeader();
|
||||||
status_trh.appendChild(status_th);
|
status_trh.appendChild(status_th);
|
||||||
@ -870,11 +869,10 @@
|
|||||||
this.set_config(JSON.stringify(config));
|
this.set_config(JSON.stringify(config));
|
||||||
});
|
});
|
||||||
|
|
||||||
//add scan button
|
//add scan button
|
||||||
var scan_btn = this.createBTN("<%:Scan%>",() => {
|
var scan_btn = this.createBTN("<%:Scan%>",() => {
|
||||||
this.scan_neighborcell();
|
this.scan_neighborcell();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.setting_table.appendChild(header);
|
this.setting_table.appendChild(header);
|
||||||
this.setting_table.appendChild(rat_tr);
|
this.setting_table.appendChild(rat_tr);
|
||||||
@ -896,7 +894,7 @@
|
|||||||
nr = this.config.NR;
|
nr = this.config.NR;
|
||||||
lte = this.config.LTE;
|
lte = this.config.LTE;
|
||||||
for (let cell_info of nr) {
|
for (let cell_info of nr) {
|
||||||
this.create_nc_tr(1,cell_info);
|
this.create_nc_tr(1,cell_info);
|
||||||
}
|
}
|
||||||
for (let cell_info of lte) {
|
for (let cell_info of lte) {
|
||||||
this.create_nc_tr(0,cell_info);
|
this.create_nc_tr(0,cell_info);
|
||||||
|
@ -102,6 +102,52 @@ add_avalible_band_entry()
|
|||||||
json_close_object
|
json_close_object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_driver()
|
||||||
|
{
|
||||||
|
for i in $(find $modem_path -name driver);do
|
||||||
|
lsfile=$(ls -l $i)
|
||||||
|
type=${lsfile:0:1}
|
||||||
|
if [ "$type" == "l" ];then
|
||||||
|
link=$(basename $(ls -l $i | awk '{print $11}'))
|
||||||
|
case $link in
|
||||||
|
"mtk_t7xx")
|
||||||
|
mode="mtk_pcie"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"qmi_wwan"*)
|
||||||
|
mode="qmi"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"cdc_mbim")
|
||||||
|
mode="mbim"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"cdc_ncm")
|
||||||
|
mode="ncm"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"cdc_ether")
|
||||||
|
mode="ecm"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"rndis_host")
|
||||||
|
mode="rndis"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
"mhi_netdev")
|
||||||
|
mode="mhi"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -z "$mode" ]; then
|
||||||
|
mode="unknown"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo $mode
|
||||||
|
}
|
||||||
|
|
||||||
get_dns()
|
get_dns()
|
||||||
{
|
{
|
||||||
@ -260,32 +306,45 @@ get_rat()
|
|||||||
#return raw data
|
#return raw data
|
||||||
get_connect_status()
|
get_connect_status()
|
||||||
{
|
{
|
||||||
#get active pdp context
|
|
||||||
at_cmd="AT+CGACT?"
|
|
||||||
expect="+CGACT:"
|
|
||||||
result=`at $at_port $at_cmd | grep $expect|tr '\r' '\n'`
|
|
||||||
connect_status="No"
|
connect_status="No"
|
||||||
for pdp_index in `echo "$result" | tr -d "\r" | awk -F'[,:]' '$3 == 1 {print $2}'`; do
|
driver=$(get_driver)
|
||||||
at_cmd="AT+CGPADDR=%s"
|
if [ "$driver" = "mtk_pcie" ]; then
|
||||||
at_cmd=$(printf "$at_cmd" "$pdp_index")
|
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
|
||||||
expect="+CGPADDR:"
|
local config=$(umbim -d $mbim_port config)
|
||||||
result=$(at $at_port $at_cmd | grep $expect)
|
local ipv4=$(echo "$config" | grep "ipv4address:" | awk '{print $2}' | cut -d'/' -f1)
|
||||||
if [ -n "$result" ];then
|
local ipv6=$(echo "$config" | grep "ipv6address:" | awk '{print $2}' | cut -d'/' -f1)
|
||||||
ipv6=$(echo $result | grep -oE "\b([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}\b")
|
|
||||||
ipv4=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
|
disallow_ipv4="0.0.0.0"
|
||||||
disallow_ipv4="0.0.0.0"
|
if [ -n "$ipv4" ] && [ "$ipv4" != "$disallow_ipv4" ] || [ -n "$ipv6" ] && [ "$ipv6" != "::" ]; then
|
||||||
#remove the disallow ip
|
|
||||||
if [ "$ipv4" == "$disallow_ipv4" ];then
|
|
||||||
ipv4=""
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -n "$ipv4" ] || [ -n "$ipv6" ];then
|
|
||||||
connect_status="Yes"
|
connect_status="Yes"
|
||||||
break
|
|
||||||
else
|
|
||||||
connect_status="No"
|
|
||||||
fi
|
fi
|
||||||
done
|
else
|
||||||
|
at_cmd="AT+CGACT?"
|
||||||
|
expect="+CGACT:"
|
||||||
|
result=`at $at_port $at_cmd | grep $expect|tr '\r' '\n'`
|
||||||
|
|
||||||
|
for pdp_index in `echo "$result" | tr -d "\r" | awk -F'[,:]' '$3 == 1 {print $2}'`; do
|
||||||
|
at_cmd="AT+CGPADDR=%s"
|
||||||
|
at_cmd=$(printf "$at_cmd" "$pdp_index")
|
||||||
|
expect="+CGPADDR:"
|
||||||
|
result=$(at $at_port $at_cmd | grep $expect)
|
||||||
|
if [ -n "$result" ];then
|
||||||
|
ipv6=$(echo $result | grep -oE "\b([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}\b")
|
||||||
|
ipv4=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
|
||||||
|
disallow_ipv4="0.0.0.0"
|
||||||
|
#remove the disallow ip
|
||||||
|
if [ "$ipv4" == "$disallow_ipv4" ];then
|
||||||
|
ipv4=""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -n "$ipv4" ] || [ -n "$ipv6" ];then
|
||||||
|
connect_status="Yes"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
connect_status="No"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
add_plain_info_entry "connect_status" "$connect_status" "Connect Status"
|
add_plain_info_entry "connect_status" "$connect_status" "Connect Status"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,53 +71,6 @@ EOF
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
get_driver()
|
|
||||||
{
|
|
||||||
for i in $(find $modem_path -name driver);do
|
|
||||||
lsfile=$(ls -l $i)
|
|
||||||
type=${lsfile:0:1}
|
|
||||||
if [ "$type" == "l" ];then
|
|
||||||
link=$(basename $(ls -l $i | awk '{print $11}'))
|
|
||||||
case $link in
|
|
||||||
"mtk_t7xx")
|
|
||||||
mode="mtk_pcie"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
"qmi_wwan"*)
|
|
||||||
mode="qmi"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
"cdc_mbim")
|
|
||||||
mode="mbim"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
"cdc_ncm")
|
|
||||||
mode="ncm"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
"cdc_ether")
|
|
||||||
mode="ecm"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
"rndis_host")
|
|
||||||
mode="rndis"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
"mhi_netdev")
|
|
||||||
mode="mhi"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
if [ -z "$mode" ]; then
|
|
||||||
mode="unknown"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo $mode
|
|
||||||
}
|
|
||||||
|
|
||||||
unlock_sim()
|
unlock_sim()
|
||||||
{
|
{
|
||||||
pin=$1
|
pin=$1
|
||||||
@ -299,7 +252,16 @@ check_ip()
|
|||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
ipaddr=$(at "$at_port" "$check_ip_command" | grep +CGPADDR:)
|
|
||||||
|
if [ "$driver" = "mtk_pcie" ]; then
|
||||||
|
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
|
||||||
|
local config=$(umbim -d $mbim_port config)
|
||||||
|
ipaddr=$(echo "$config" | grep "ipv4address:" | awk '{print $2}' | cut -d'/' -f1)
|
||||||
|
ipaddr="$ipaddr $(echo "$config" | grep "ipv6address:" | awk '{print $2}' | cut -d'/' -f1)"
|
||||||
|
else
|
||||||
|
ipaddr=$(at "$at_port" "$check_ip_command" | grep +CGPADDR:)
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$ipaddr" ];then
|
if [ -n "$ipaddr" ];then
|
||||||
if [ $mtk -eq 1 ] && echo "$ipv4_config" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
|
if [ $mtk -eq 1 ] && echo "$ipv4_config" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||||
if [ "$pdp_type" = "ipv4v6" ];then
|
if [ "$pdp_type" = "ipv4v6" ];then
|
||||||
@ -313,7 +275,6 @@ check_ip()
|
|||||||
ipv4=$(echo $ipaddr | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
|
ipv4=$(echo $ipaddr | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
|
||||||
if [ "$manufacturer" = "simcom" ];then
|
if [ "$manufacturer" = "simcom" ];then
|
||||||
ipv4=$(echo $ipaddr | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | grep -v "0\.0\.0\.0" | head -n 1)
|
ipv4=$(echo $ipaddr | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | grep -v "0\.0\.0\.0" | head -n 1)
|
||||||
ipaddr=$(echo $ipaddr | sed 's/\./:/g' | sed 's/+CGPADDR: //g' | sed 's/'$ipv4',//g')
|
|
||||||
ipv6=$(echo $ipaddr | grep -oE "\b([0-9a-fA-F]{0,4}.){2,7}[0-9a-fA-F]{0,4}\b")
|
ipv6=$(echo $ipaddr | grep -oE "\b([0-9a-fA-F]{0,4}.){2,7}[0-9a-fA-F]{0,4}\b")
|
||||||
fi
|
fi
|
||||||
disallow_ipv4="0.0.0.0"
|
disallow_ipv4="0.0.0.0"
|
||||||
@ -629,21 +590,21 @@ wwan_hang()
|
|||||||
ecm_hang()
|
ecm_hang()
|
||||||
{
|
{
|
||||||
if [ "$manufacturer" = "quectel" ]; then
|
if [ "$manufacturer" = "quectel" ]; then
|
||||||
at_command="AT+QNETDEVCTL=1,2,1"
|
at_command="AT+QNETDEVCTL=1,2,1"
|
||||||
elif [ "$manufacturer" = "fibocom" ]; then
|
elif [ "$manufacturer" = "fibocom" ]; then
|
||||||
#联发科平台(广和通FM350-GL)
|
#联发科平台(广和通FM350-GL)
|
||||||
if [ "$platform" = "mediatek" ]; then
|
if [ "$platform" = "mediatek" ]; then
|
||||||
at_command="AT+CGACT=0,3"
|
at_command="AT+CGACT=0,3"
|
||||||
else
|
else
|
||||||
at_command="AT+GTRNDIS=0,1"
|
at_command="AT+GTRNDIS=0,1"
|
||||||
fi
|
fi
|
||||||
elif [ "$manufacturer" = "meig" ]; then
|
elif [ "$manufacturer" = "meig" ]; then
|
||||||
at_command="AT$QCRMCALL=0,1,1,2,1"
|
at_command="AT$QCRMCALL=0,1,1,2,1"
|
||||||
else
|
else
|
||||||
at_command='ATI'
|
at_command='ATI'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmp=$(at "${at_port}" "${at_command}")
|
tmp=$(at "${at_port}" "${at_command}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -688,29 +649,29 @@ qmi_dial()
|
|||||||
{
|
{
|
||||||
cmd_line="quectel-CM"
|
cmd_line="quectel-CM"
|
||||||
[ -e "/usr/bin/quectel-CM-M" ] && cmd_line="quectel-CM-M"
|
[ -e "/usr/bin/quectel-CM-M" ] && cmd_line="quectel-CM-M"
|
||||||
case $pdp_type in
|
case $pdp_type in
|
||||||
"ip") cmd_line="$cmd_line -4" ;;
|
"ip") cmd_line="$cmd_line -4" ;;
|
||||||
"ipv6") cmd_line="$cmd_line -6" ;;
|
"ipv6") cmd_line="$cmd_line -6" ;;
|
||||||
"ipv4v6") cmd_line="$cmd_line -4 -6" ;;
|
"ipv4v6") cmd_line="$cmd_line -4 -6" ;;
|
||||||
*) cmd_line="$cmd_line -4 -6" ;;
|
*) cmd_line="$cmd_line -4 -6" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$network_bridge" = "1" ]; then
|
if [ "$network_bridge" = "1" ]; then
|
||||||
cmd_line="$cmd_line -b"
|
cmd_line="$cmd_line -b"
|
||||||
fi
|
fi
|
||||||
if [ -n "$apn" ]; then
|
if [ -n "$apn" ]; then
|
||||||
cmd_line="$cmd_line -s $apn"
|
cmd_line="$cmd_line -s $apn"
|
||||||
fi
|
fi
|
||||||
if [ -n "$username" ]; then
|
if [ -n "$username" ]; then
|
||||||
cmd_line="$cmd_line $username"
|
cmd_line="$cmd_line $username"
|
||||||
fi
|
fi
|
||||||
if [ -n "$password" ]; then
|
if [ -n "$password" ]; then
|
||||||
cmd_line="$cmd_line $password"
|
cmd_line="$cmd_line $password"
|
||||||
fi
|
fi
|
||||||
if [ "$auth" != "none" ]; then
|
if [ "$auth" != "none" ]; then
|
||||||
cmd_line="$cmd_line $auth"
|
cmd_line="$cmd_line $auth"
|
||||||
fi
|
fi
|
||||||
if [ -n "$modem_netcard" ]; then
|
if [ -n "$modem_netcard" ]; then
|
||||||
qmi_if=$modem_netcard
|
qmi_if=$modem_netcard
|
||||||
#if is wwan* ,use the first part of the name
|
#if is wwan* ,use the first part of the name
|
||||||
if [[ "$modem_netcard" = "wwan"* ]];then
|
if [[ "$modem_netcard" = "wwan"* ]];then
|
||||||
@ -720,8 +681,8 @@ qmi_dial()
|
|||||||
if [[ "$modem_netcard" = "rmnet"* ]];then
|
if [[ "$modem_netcard" = "rmnet"* ]];then
|
||||||
qmi_if=$(echo "$modem_netcard" | cut -d. -f1)
|
qmi_if=$(echo "$modem_netcard" | cut -d. -f1)
|
||||||
fi
|
fi
|
||||||
cmd_line="${cmd_line} -i ${qmi_if}"
|
cmd_line="${cmd_line} -i ${qmi_if}"
|
||||||
fi
|
fi
|
||||||
if [ "$en_bridge" = "1" ];then
|
if [ "$en_bridge" = "1" ];then
|
||||||
cmd_line="${cmd_line} -b"
|
cmd_line="${cmd_line} -b"
|
||||||
fi
|
fi
|
||||||
@ -749,7 +710,7 @@ at_dial()
|
|||||||
pdp_type="IP"
|
pdp_type="IP"
|
||||||
fi
|
fi
|
||||||
local at_command='AT+COPS=0,0'
|
local at_command='AT+COPS=0,0'
|
||||||
tmp=$(at "${at_port}" "${at_command}")
|
tmp=$(at "${at_port}" "${at_command}")
|
||||||
pdp_type=$(echo $pdp_type | tr 'a-z' 'A-Z')
|
pdp_type=$(echo $pdp_type | tr 'a-z' 'A-Z')
|
||||||
case $manufacturer in
|
case $manufacturer in
|
||||||
"quectel")
|
"quectel")
|
||||||
@ -821,50 +782,81 @@ at_dial()
|
|||||||
esac
|
esac
|
||||||
m_debug "dialing vendor:$manufacturer;platform:$platform; $cgdcont_command ; $at_command"
|
m_debug "dialing vendor:$manufacturer;platform:$platform; $cgdcont_command ; $at_command"
|
||||||
at "${at_port}" "${cgdcont_command}"
|
at "${at_port}" "${cgdcont_command}"
|
||||||
if [ $mtk -eq 1 ];then
|
[ $mtk -eq 1 ] && sleep 1
|
||||||
sleep 3
|
|
||||||
fi
|
|
||||||
at "$at_port" "$at_command"
|
at "$at_port" "$at_command"
|
||||||
if [ $mtk -eq 1 ];then
|
[ $mtk -eq 1 ] && sleep 1
|
||||||
sleep 3
|
if [ "$driver" = "mtk_pcie" ];then
|
||||||
|
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
|
||||||
|
umbim -d $mbim_port disconnect > /dev/null 2>&1
|
||||||
|
sleep 1
|
||||||
|
umbim -d $mbim_port connect > /dev/null 2>&1
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ip_change_fm350()
|
ip_change_fm350()
|
||||||
{
|
{
|
||||||
m_debug "ip_change_fm350"
|
m_debug "ip_change_fm350"
|
||||||
at_command="AT+CGPADDR=3"
|
local ipv4_config=""
|
||||||
local ipv4_config=$(at ${at_port} ${at_command} | cut -d, -f2 | grep -oE '[0-9]+.[0-9]+.[0-9]+.[0-9]+')
|
local ipv4_dns1=""
|
||||||
local public_dns1_ipv4="223.5.5.5"
|
local ipv4_dns2=""
|
||||||
local public_dns2_ipv4="119.29.29.29"
|
local ipv6_dns1=""
|
||||||
local public_dns1_ipv6="2400:3200::1"
|
local ipv6_dns2=""
|
||||||
local public_dns2_ipv6="2402:4e00::"
|
local gateway=""
|
||||||
at_command="AT+GTDNS=3" | grep "+GTDNS: "| grep -E '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | sed -n '1p'
|
local netmask="255.255.255.0"
|
||||||
local ipv4_dns1=$(echo "${response}" | awk -F'"' '{print $2}' | awk -F',' '{print $1}')
|
|
||||||
[ -z "$ipv4_dns1" ] && {
|
|
||||||
ipv4_dns1="${public_dns1_ipv4}"
|
|
||||||
}
|
|
||||||
|
|
||||||
local ipv4_dns2=$(echo "${response}" | awk -F'"' '{print $4}' | awk -F',' '{print $1}')
|
if [ "$driver" = "mtk_pcie" ]; then
|
||||||
[ -z "$ipv4_dns2" ] && {
|
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
|
||||||
ipv4_dns2="${public_dns2_ipv4}"
|
|
||||||
}
|
|
||||||
|
|
||||||
local ipv6_dns1=$(echo "${response}" | awk -F'"' '{print $2}' | awk -F',' '{print $2}')
|
local config=$(umbim -d $mbim_port config)
|
||||||
[ -z "$ipv6_dns1" ] && {
|
ipv4_config=$(echo "$config" | grep "ipv4address:" | awk '{print $2}' | cut -d'/' -f1)
|
||||||
ipv6_dns1="${public_dns1_ipv6}"
|
gateway=$(echo "$config" | grep "ipv4gateway:" | awk '{print $2}')
|
||||||
}
|
|
||||||
|
|
||||||
local ipv6_dns2=$(echo "${response}" | awk -F'"' '{print $4}' | awk -F',' '{print $2}')
|
ipv4_dns1=$(echo "$config" | grep "ipv4dnsserver:" | head -n 1 | awk '{print $2}')
|
||||||
[ -z "$ipv6_dns2" ] && {
|
ipv4_dns2=$(echo "$config" | grep "ipv4dnsserver:" | tail -n 1 | awk '{print $2}')
|
||||||
ipv6_dns2="${public_dns2_ipv6}"
|
if [ "$ipv4_dns1" = "$ipv4_dns2" ]; then
|
||||||
}
|
ipv4_dns2="119.29.29.29"
|
||||||
uci_ipv4=$(uci -q get network.$interface_name.ipaddr)
|
fi
|
||||||
|
|
||||||
|
ipv6_dns1=$(echo "$config" | grep "ipv6dnsserver:" | head -n 1 | awk '{print $2}')
|
||||||
|
ipv6_dns2=$(echo "$config" | grep "ipv6dnsserver:" | tail -n 1 | awk '{print $2}')
|
||||||
|
|
||||||
|
m_debug "umbim config: ipv4=$ipv4_config, gateway=$gateway, netmask=$netmask, dns1=$ipv4_dns1, dns2=$ipv4_dns2"
|
||||||
|
else
|
||||||
|
at_command="AT+CGPADDR=3"
|
||||||
|
ipv4_config=$(at ${at_port} ${at_command} | cut -d, -f2 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
|
||||||
|
gateway="${ipv4_config%.*}.1"
|
||||||
|
|
||||||
|
local public_dns1_ipv4="223.5.5.5"
|
||||||
|
local public_dns2_ipv4="119.29.29.29"
|
||||||
|
local public_dns1_ipv6="2400:3200::1"
|
||||||
|
local public_dns2_ipv6="2402:4e00::"
|
||||||
|
at_command="AT+GTDNS=3" | grep "+GTDNS: "| grep -E '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | sed -n '1p'
|
||||||
|
local ipv4_dns1=$(echo "${response}" | awk -F'"' '{print $2}' | awk -F',' '{print $1}')
|
||||||
|
[ -z "$ipv4_dns1" ] && {
|
||||||
|
ipv4_dns1="${public_dns1_ipv4}"
|
||||||
|
}
|
||||||
|
|
||||||
|
local ipv4_dns2=$(echo "${response}" | awk -F'"' '{print $4}' | awk -F',' '{print $1}')
|
||||||
|
[ -z "$ipv4_dns2" ] && {
|
||||||
|
ipv4_dns2="${public_dns2_ipv4}"
|
||||||
|
}
|
||||||
|
|
||||||
|
local ipv6_dns1=$(echo "${response}" | awk -F'"' '{print $2}' | awk -F',' '{print $2}')
|
||||||
|
[ -z "$ipv6_dns1" ] && {
|
||||||
|
ipv6_dns1="${public_dns1_ipv6}"
|
||||||
|
}
|
||||||
|
|
||||||
|
local ipv6_dns2=$(echo "${response}" | awk -F'"' '{print $4}' | awk -F',' '{print $2}')
|
||||||
|
[ -z "$ipv6_dns2" ] && {
|
||||||
|
ipv6_dns2="${public_dns2_ipv6}"
|
||||||
|
}
|
||||||
|
uci_ipv4=$(uci -q get network.$interface_name.ipaddr)
|
||||||
|
fi
|
||||||
uci set network.${interface_name}.proto='static'
|
uci set network.${interface_name}.proto='static'
|
||||||
uci set network.${interface_name}.ipaddr="${ipv4_config}"
|
uci set network.${interface_name}.ipaddr="${ipv4_config}"
|
||||||
uci set network.${interface_name}.netmask='255.255.255.0'
|
uci set network.${interface_name}.netmask="${netmask}"
|
||||||
uci set network.${interface_name}.gateway="${ipv4_config%.*}.1"
|
uci set network.${interface_name}.gateway="${gateway}"
|
||||||
uci set network.${interface_name}.peerdns='0'
|
uci set network.${interface_name}.peerdns='0'
|
||||||
uci -q del network.${interface_name}.dns
|
uci -q del network.${interface_name}.dns
|
||||||
uci add_list network.${interface_name}.dns="${ipv4_dns1}"
|
uci add_list network.${interface_name}.dns="${ipv4_dns1}"
|
||||||
@ -989,7 +981,7 @@ at_dial_monitor()
|
|||||||
check_ip
|
check_ip
|
||||||
if [ $connection_status -eq 0 ];then
|
if [ $connection_status -eq 0 ];then
|
||||||
at_dial
|
at_dial
|
||||||
sleep 5
|
sleep 3
|
||||||
elif [ $connection_status -eq -1 ];then
|
elif [ $connection_status -eq -1 ];then
|
||||||
unexpected_response_count=$((unexpected_response_count+1))
|
unexpected_response_count=$((unexpected_response_count+1))
|
||||||
if [ $unexpected_response_count -gt 3 ];then
|
if [ $unexpected_response_count -gt 3 ];then
|
||||||
|
@ -176,12 +176,12 @@ scan_pcie_slot_interfaces()
|
|||||||
#mt_t7xx device
|
#mt_t7xx device
|
||||||
wwan_path="$slot_path/wwan"
|
wwan_path="$slot_path/wwan"
|
||||||
if [ -d "$wwan_path" ]; then
|
if [ -d "$wwan_path" ]; then
|
||||||
net_devices=$(ls "$wwan_path" | grep -E "wwan[0-9]")
|
net_devices=$(ls "$wwan_path" | grep -E "wwan[0-9]")
|
||||||
devices_path="$wwan_path/$net_devices"
|
devices_path="$wwan_path/$net_devices"
|
||||||
if [ -d "$devices_path" ];then
|
if [ -d "$devices_path" ];then
|
||||||
mbim_devices=$(ls "$devices_path" | grep -E "wwan[0-9]mbim[0-9]")
|
mbim_devices=$(ls "$devices_path" | grep -E "wwan[0-9]mbim[0-9]")
|
||||||
dun_devices=$(ls "$devices_path" | grep -E "wwan[0-9]at[0-9]")
|
dun_devices=$(ls "$devices_path" | grep -E "wwan[0-9]at[0-9]")
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo "net_devices: $net_devices dun_devices: $dun_devices"
|
echo "net_devices: $net_devices dun_devices: $dun_devices"
|
||||||
at_ports="$dun_devices"
|
at_ports="$dun_devices"
|
||||||
@ -283,25 +283,23 @@ match_config()
|
|||||||
[[ "$name" = *"nl668"* ]] && name="nl668"
|
[[ "$name" = *"nl668"* ]] && name="nl668"
|
||||||
[[ "$name" = *"nl678"* ]] && name="nl678"
|
[[ "$name" = *"nl678"* ]] && name="nl678"
|
||||||
|
|
||||||
[[ "$name" = *"em120k"* ]] && name="em120k"
|
[[ "$name" = *"em120k"* ]] && name="em120k"
|
||||||
|
|
||||||
#FM350-GL-00 5G Module
|
#FM350-GL-00 5G Module
|
||||||
[[ "$name" = *"fm350-gl"* ]] && name="fm350-gl"
|
[[ "$name" = *"fm350-gl"* ]] && name="fm350-gl"
|
||||||
|
|
||||||
#RM500U-CNV
|
#RM500U-CNV
|
||||||
[[ "$name" = *"rm500u-cn"* ]] && name="rm500u-cn"
|
[[ "$name" = *"rm500u-cn"* ]] && name="rm500u-cn"
|
||||||
|
|
||||||
[[ "$name" = *"rm500u-ea"* ]] && name="rm500u-ea"
|
[[ "$name" = *"rm500u-ea"* ]] && name="rm500u-ea"
|
||||||
#t99w175
|
#t99w175
|
||||||
[[ "$name" = *"mv31-w"* ]] && name="t99w175"
|
[[ "$name" = *"mv31-w"* ]] || [[ "$name" = *"T99W175"* ]] && name="t99w175"
|
||||||
|
|
||||||
[[ "$name" = *"T99W175"* ]] && name="t99w175"
|
[[ "$name" = *"T99W373"* ]] && name="t99w373"
|
||||||
|
|
||||||
[[ "$name" = *"T99W373"* ]] && name="t99w373"
|
[[ "$name" = *"SIM8380G"* ]] && name="SIM8380G-M2"
|
||||||
|
|
||||||
[[ "$name" = *"SIM8380G"* ]] && name="SIM8380G-M2"
|
#rg200u-cn
|
||||||
|
|
||||||
#rg200u-cn
|
|
||||||
[[ "$name" = *"rg200u-cn"* ]] && name="rg200u-cn"
|
[[ "$name" = *"rg200u-cn"* ]] && name="rg200u-cn"
|
||||||
|
|
||||||
modem_config=$(echo $modem_support | jq '.modem_support."'$slot_type'"."'$name'"')
|
modem_config=$(echo $modem_support | jq '.modem_support."'$slot_type'"."'$name'"')
|
||||||
|
@ -1005,6 +1005,15 @@
|
|||||||
"mbim"
|
"mbim"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"rw350r-gl": {
|
||||||
|
"manufacturer": "fibocom",
|
||||||
|
"platform": "mediatek",
|
||||||
|
"data_interface": "pcie",
|
||||||
|
"define_connect": "1",
|
||||||
|
"modes": [
|
||||||
|
"mbim"
|
||||||
|
]
|
||||||
|
},
|
||||||
"fm150-ae": {
|
"fm150-ae": {
|
||||||
"manufacturer": "fibocom",
|
"manufacturer": "fibocom",
|
||||||
"platform": "qualcomm",
|
"platform": "qualcomm",
|
||||||
|
@ -58,6 +58,11 @@ get_mode()
|
|||||||
"41") mode="rndis" ;;
|
"41") mode="rndis" ;;
|
||||||
*) mode="$mode_num" ;;
|
*) mode="$mode_num" ;;
|
||||||
esac
|
esac
|
||||||
|
driver=$(get_driver)
|
||||||
|
case "$driver" in
|
||||||
|
"mtk_pcie")
|
||||||
|
mode="mbim" ;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
mode="$mode_num"
|
mode="$mode_num"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user