Merge pull request #15 from sfwtw/main
feat: Added support for Simcom devices, added FM350-GL soft reboot su…
This commit is contained in:
commit
0f5f8be961
39
luci/luci-app-qmodem/root/etc/init.d/qmodem_reboot
Normal file
39
luci/luci-app-qmodem/root/etc/init.d/qmodem_reboot
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
USE_PROCD=1
|
||||
|
||||
START=95
|
||||
STOP=0
|
||||
|
||||
start_service() {
|
||||
:
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
procd_set_param timeout 30
|
||||
config_load qmodem
|
||||
config_foreach _reboot_usb modem-device
|
||||
|
||||
}
|
||||
|
||||
_reboot_usb() {
|
||||
config_get data_interface $1 data_interface
|
||||
if [ "$data_interface" == "usb" ]; then
|
||||
config_get name $1 name
|
||||
if [ "$name" == "fm350-gl" ]; then
|
||||
config_get at_port $1 at_port
|
||||
response=$(tom_modem -d "$at_port" -o a -c "AT+CFUN=1,1")
|
||||
retries=3
|
||||
while ! echo "$response" | grep -qi "ok" && [ $retries -gt 0 ]; do
|
||||
sleep 1
|
||||
response=$(tom_modem -d "$at_port" -o a -c "AT+CFUN=1,1")
|
||||
retries=$((retries - 1))
|
||||
done
|
||||
max_retries=15
|
||||
while [ -e "/dev/$at_port" ] && [ $max_retries -gt 0 ]; do
|
||||
sleep 1
|
||||
max_retries=$((max_retries - 1))
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
3
luci/luci-app-qmodem/root/usr/share/qmodem/modem_ctrl.sh
Executable file → Normal file
3
luci/luci-app-qmodem/root/usr/share/qmodem/modem_ctrl.sh
Executable file → Normal file
@ -23,6 +23,9 @@ case $vendor in
|
||||
"sierra")
|
||||
. /usr/share/qmodem/vendor/sierra.sh
|
||||
;;
|
||||
"simcom")
|
||||
. /usr/share/qmodem/vendor/simcom.sh
|
||||
;;
|
||||
*)
|
||||
. /usr/share/qmodem/generic.sh
|
||||
;;
|
||||
|
35
luci/luci-app-qmodem/root/usr/share/qmodem/modem_dial.sh
Executable file → Normal file
35
luci/luci-app-qmodem/root/usr/share/qmodem/modem_dial.sh
Executable file → Normal file
@ -270,22 +270,35 @@ check_ip()
|
||||
;;
|
||||
"mediatek")
|
||||
check_ip_command="AT+CGPADDR=3"
|
||||
mtk=1
|
||||
stric=1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"simcom")
|
||||
case $platform in
|
||||
"qualcomm")
|
||||
check_ip_command="AT+CGPADDR=6"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
ipaddr=$(at "$at_port" "$check_ip_command" |grep +CGPADDR:)
|
||||
if [ -n "$ipaddr" ];then
|
||||
if [ $mtk -eq 1 ] && [ "$pdp_type" = "IPv4v6" ];then
|
||||
if ! ping -c 2 -w 5 2400:3200::1 > /dev/null 2>&1; then
|
||||
m_debug "ipv6 is down,try to restart"
|
||||
ifdown "$interface"V6 && sleep 2 && ifup "$interface"V6
|
||||
if [ $mtk -eq 1 ] && echo "$ipv4_config" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||
if [ "$pdp_type" = "IPv4v6" ];then
|
||||
if ! ping -c 2 -w 5 2400:3200::1 > /dev/null 2>&1; then
|
||||
m_debug "ipv6 is down,try to restart"
|
||||
ifdown "$interface"V6 && sleep 2 && ifup "$interface"V6
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
ipv6=$(echo $ipaddr | grep -oE "\b([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}\b")
|
||||
ipv4=$(echo $ipaddr | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
|
||||
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)
|
||||
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")
|
||||
fi
|
||||
disallow_ipv4="0.0.0.0"
|
||||
#remove the disallow ip
|
||||
if [ "$ipv4" == *"$disallow_ipv4"* ];then
|
||||
@ -768,7 +781,15 @@ at_dial()
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
"simcom")
|
||||
case $platform in
|
||||
"qualcomm")
|
||||
local cnmp=$(at ${at_port} "AT+CNMP?" | grep "+CNMP:" | sed 's/+CNMP: //g' | sed 's/\r//g')
|
||||
at_command="AT+CNMP=$cnmp;+CNWINFO=1"
|
||||
cgdcont_command="AT+CGDCONT=1,\"IPV4V6\",\"$apn\""
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
m_debug "dialing vendor:$manufacturer;platform:$platform; $cgdcont_command ; $at_command"
|
||||
at "${at_port}" "${cgdcont_command}"
|
||||
@ -949,7 +970,7 @@ at_dial_monitor()
|
||||
fi
|
||||
sleep 10
|
||||
else
|
||||
#检测ipv4是否变化
|
||||
#检测ipv4是否变化
|
||||
sleep 15
|
||||
if [ "$ipv4" != "$ipv4_cache" ];then
|
||||
handle_ip_change
|
||||
|
@ -1,4 +1,5 @@
|
||||
{ "modem_support": {
|
||||
{
|
||||
"modem_support": {
|
||||
"usb": {
|
||||
"em05": {
|
||||
"manufacturer_id": "2c7c",
|
||||
@ -469,6 +470,17 @@
|
||||
"mbim",
|
||||
"rmnet"
|
||||
]
|
||||
},
|
||||
"simcom_d8200g": {
|
||||
"manufacturer_id": "1a0e",
|
||||
"manufacturer": "simcom",
|
||||
"platform": "qualcomm",
|
||||
"data_interface": "usb",
|
||||
"define_connect": "1",
|
||||
"modes": [
|
||||
"qmi",
|
||||
"rndis"
|
||||
]
|
||||
}
|
||||
},
|
||||
"pcie": {
|
||||
@ -755,7 +767,18 @@
|
||||
"4d59"
|
||||
]
|
||||
}
|
||||
},
|
||||
"simcom": {
|
||||
"qualcomm": {
|
||||
"vendor_id": [
|
||||
"1a0e"
|
||||
],
|
||||
"product_id": [
|
||||
"9001",
|
||||
"9011"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
18
luci/luci-app-qmodem/root/usr/share/qmodem/modem_util.sh
Executable file → Normal file
18
luci/luci-app-qmodem/root/usr/share/qmodem/modem_util.sh
Executable file → Normal file
@ -112,7 +112,23 @@ at_get_slot()
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
"simcom")
|
||||
at_res=$(at $at_port AT+SMSIMCFG? | grep "+SMSIMCFG:" | awk -F',' '{print $2}' | sed 's/\r//g')
|
||||
case $at_res in
|
||||
"1")
|
||||
sim_slot="1"
|
||||
;;
|
||||
"2")
|
||||
sim_slot="2"
|
||||
;;
|
||||
*)
|
||||
sim_slot="1"
|
||||
;;
|
||||
*)
|
||||
sim_slot="1"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
at_q_res=$(at $at_port AT+QSIMDET? |grep +QSIMDET: |awk -F: '{print $2}')
|
||||
at_f_res=$(at $at_port AT+GTDUALSIM? |grep +GTDUALSIM: |awk -F: '{print $2}')
|
||||
|
1014
luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh
vendored
Normal file
1014
luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user