mirror of
https://github.com/LiBwrt/nss-packages.git
synced 2025-12-16 17:15:09 +00:00
Add config for PDN index, cleanup modem boot delay
This commit is contained in:
parent
01fe8de919
commit
28cc54ff77
@ -66,7 +66,7 @@ return network.registerProtocol('quectel', {
|
||||
};
|
||||
|
||||
apn = s.taboption('general', form.Value, 'apn', _('APN'));
|
||||
apn.depends('pdptype', 'ipv4v6');
|
||||
apn.depends('pdptype', 'ipv4v6');
|
||||
apn.depends('pdptype', 'ipv4');
|
||||
apn.validate = function(section_id, value) {
|
||||
if (value == null || value == '')
|
||||
@ -78,8 +78,8 @@ return network.registerProtocol('quectel', {
|
||||
return true;
|
||||
};
|
||||
|
||||
apnv6 = s.taboption('general', form.Value, 'apnv6', _('APN IPv6'));
|
||||
apnv6.depends('pdptype', 'ipv4v6');
|
||||
apnv6 = s.taboption('general', form.Value, 'apnv6', _('IPv6 APN'));
|
||||
apnv6.depends('pdptype', 'ipv4v6');
|
||||
apnv6.depends('pdptype', 'ipv6');
|
||||
apnv6.validate = function(section_id, value) {
|
||||
if (value == null || value == '')
|
||||
@ -88,10 +88,10 @@ return network.registerProtocol('quectel', {
|
||||
if (!/^[a-zA-Z0-9\-.]*[a-zA-Z0-9]$/.test(value))
|
||||
return _('Invalid APN provided');
|
||||
|
||||
var apn_value = apn.formvalue(section_id);
|
||||
|
||||
if (value === apn_value)
|
||||
return _('APN IPv6 must be different from APN');
|
||||
var apn_value = apn.formvalue(section_id);
|
||||
|
||||
if (value.toLowerCase() === apn_value.toLowerCase())
|
||||
return _('APN IPv6 must be different from APN');
|
||||
|
||||
return true;
|
||||
};
|
||||
@ -119,13 +119,27 @@ return network.registerProtocol('quectel', {
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'delay', _('Modem init timeout'),
|
||||
_('Maximum amount of seconds to wait for the modem to become ready'));
|
||||
o.placeholder = '10';
|
||||
o.placeholder = '5';
|
||||
o.datatype = 'min(1)';
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'mtu', _('Override MTU'));
|
||||
o.placeholder = dev ? (dev.getMTU() || '1500') : '1500';
|
||||
o.datatype = 'max(9200)';
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'pdnindex', _('PDN index'));
|
||||
o.depends('pdptype', 'ipv4v6');
|
||||
o.depends('pdptype', 'ipv4');
|
||||
o.placeholder = '1';
|
||||
o.default = 1;
|
||||
o.datatype = 'and(uinteger,min(1),max(7))';
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'pdnindexv6', _('IPv6 PDN index'));
|
||||
o.depends('pdptype', 'ipv4v6');
|
||||
o.depends('pdptype', 'ipv6');
|
||||
o.placeholder = '2';
|
||||
o.default = 2;
|
||||
o.datatype = 'and(uinteger,min(1),max(7))';
|
||||
|
||||
o = s.taboption('general', form.ListValue, 'pdptype', _('PDP Type'));
|
||||
o.value('ipv4v6', 'IPv4/IPv6');
|
||||
o.value('ipv4', 'IPv4');
|
||||
|
||||
@ -12,6 +12,8 @@ proto_quectel_init_config() {
|
||||
proto_config_add_string "device:device"
|
||||
proto_config_add_string "apn"
|
||||
proto_config_add_string "apnv6"
|
||||
proto_config_add_string "pdnindex"
|
||||
proto_config_add_string "pdnindexv6"
|
||||
proto_config_add_string "auth"
|
||||
proto_config_add_string "username"
|
||||
proto_config_add_string "password"
|
||||
@ -28,19 +30,19 @@ proto_quectel_init_config() {
|
||||
|
||||
proto_quectel_setup() {
|
||||
local interface="$1"
|
||||
local device apn apnv6 auth username password pincode delay pdptype
|
||||
local device apn apnv6 auth username password pincode delay pdptype pdnindex pdnindexv6
|
||||
local dhcp dhcpv6 sourcefilter delegate mtu $PROTO_DEFAULT_OPTIONS
|
||||
local ip4table ip6table
|
||||
local pid zone
|
||||
|
||||
json_get_vars device apn apnv6 auth username password pincode delay
|
||||
json_get_vars device apn apnv6 auth username password pincode delay pdnindex pdnindexv6
|
||||
json_get_vars pdptype dhcp dhcpv6 sourcefilter delegate ip4table
|
||||
json_get_vars ip6table mtu $PROTO_DEFAULT_OPTIONS
|
||||
|
||||
echo -ne "AT+CFUN=1\r\n" > /dev/ttyUSB2
|
||||
[ -n "$delay" ] && sleep "$delay"
|
||||
|
||||
sleep 5
|
||||
|
||||
[ -n "$delay" ] || delay="5"
|
||||
sleep "$delay"
|
||||
|
||||
[ -n "$metric" ] || metric="0"
|
||||
[ -z "$ctl_device" ] || device="$ctl_device"
|
||||
@ -73,15 +75,17 @@ proto_quectel_setup() {
|
||||
[ "$pdptype" = "ipv4" -o "$pdptype" = "ipv4v6" ] && ipv4opt="-4"
|
||||
[ "$pdptype" = "ipv6" -o "$pdptype" = "ipv4v6" ] && ipv6opt="-6"
|
||||
[ -n "$auth" ] || auth="none"
|
||||
[ -n "$pdnindex" ] || pdnindex="1"
|
||||
[ -n "$pdnindexv6" ] || pdnindexv6="2"
|
||||
|
||||
quectel-qmi-proxy &
|
||||
sleep 3
|
||||
|
||||
if [ -n "$ipv4opt" ]; then
|
||||
quectel-cm -i "$ifname" $ipv4opt -n 1 -m 1 ${pincode:+-p $pincode} -s "$apn" "$username" "$password" "$auth" &
|
||||
quectel-cm -i "$ifname" $ipv4opt -n $pdnindex -m 1 ${pincode:+-p $pincode} -s "$apn" "$username" "$password" "$auth" &
|
||||
fi
|
||||
if [ -n "$ipv6opt" ]; then
|
||||
quectel-cm -i "$ifname" $ipv6opt -n 4 -m 2 ${pincode:+-p $pincode} -s "$apnv6" "$username" "$password" "$auth" &
|
||||
quectel-cm -i "$ifname" $ipv6opt -n $pdnindexv6 -m 2 ${pincode:+-p $pincode} -s "$apnv6" "$username" "$password" "$auth" &
|
||||
fi
|
||||
sleep 5
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user