aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/comgt/files
diff options
context:
space:
mode:
authorGiuseppe Lippolis <giu.lippolis@gmail.com>2016-12-22 22:12:44 +0100
committerFelix Fietkau <nbd@nbd.name>2017-05-25 19:01:08 +0200
commit4ba2f4dc6357e85a8dbc98266a14197fb058159c (patch)
tree9a71f46fb4b280dad1acce3dd4dbba7053ae3eee /package/network/utils/comgt/files
parent8851a18a88aff548ae2648e26deb7595ebb45733 (diff)
downloadupstream-4ba2f4dc6357e85a8dbc98266a14197fb058159c.tar.gz
upstream-4ba2f4dc6357e85a8dbc98266a14197fb058159c.tar.bz2
upstream-4ba2f4dc6357e85a8dbc98266a14197fb058159c.zip
DWR-512: adding wwan support for the dwr-512 3G modem
This PR allow the 3G modem embedded in the DWR-512 to be managed by the wwan-ncm scripts. The modem will use the usb-option and usb-cdc-ether drivers. The DWR-512 DT is updated accordingly. Signed-off-by: Giuseppe Lippolis <giu.lippolis@gmail.com>
Diffstat (limited to 'package/network/utils/comgt/files')
-rw-r--r--package/network/utils/comgt/files/ncm.json11
-rw-r--r--package/network/utils/comgt/files/ncm.sh27
2 files changed, 36 insertions, 2 deletions
diff --git a/package/network/utils/comgt/files/ncm.json b/package/network/utils/comgt/files/ncm.json
index 8f74e173d1..bbdb30c5ee 100644
--- a/package/network/utils/comgt/files/ncm.json
+++ b/package/network/utils/comgt/files/ncm.json
@@ -63,5 +63,16 @@
},
"connect": "AT*ENAP=1,${profile}",
"disconnect": "AT*ENAP=0"
+ },
+ "mtk1": {
+ "initialize": [
+ "AT+CFUN=1"
+ ],
+ "configure": [
+ "AT+CGDCONT=${profile},\\\"${pdptype}\\\",\\\"${apn}\\\",0,0"
+ ],
+ "connect": "AT+CGACT=1,${profile}",
+ "finalize": "AT+CGDATA=\\\"M-MBIM\\\",${profile},1",
+ "disconnect": "AT+CGACT=0,${profile}"
}
}
diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh
index 73d1e05e3f..60b39655ec 100644
--- a/package/network/utils/comgt/files/ncm.sh
+++ b/package/network/utils/comgt/files/ncm.sh
@@ -25,7 +25,7 @@ proto_ncm_init_config() {
proto_ncm_setup() {
local interface="$1"
- local manufacturer initialize setmode connect ifname devname devpath
+ local manufacturer initialize setmode connect finalize ifname devname devpath
local device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
json_get_vars device apn auth username password pincode delay mode pdptype profile $PROTO_DEFAULT_OPTIONS
@@ -105,9 +105,21 @@ proto_ncm_setup() {
return 1
}
}
+
+ json_get_values configure configure
+ echo "Configuring modem"
+ for i in $configure; do
+ eval COMMAND="$i" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
+ echo "Failed to configure modem"
+ proto_notify_error "$interface" CONFIGURE_FAILED
+ return 1
+ }
+ done
+
[ -n "$mode" ] && {
json_select modes
json_get_var setmode "$mode"
+ echo "Setting mode"
eval COMMAND="$setmode" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
echo "Failed to set operating mode"
proto_notify_error "$interface" SETMODE_FAILED
@@ -118,14 +130,16 @@ proto_ncm_setup() {
echo "Starting network $interface"
json_get_vars connect
+ echo "Connecting modem"
eval COMMAND="$connect" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
echo "Failed to connect"
proto_notify_error "$interface" CONNECT_FAILED
return 1
}
+ json_get_vars finalize
+
echo "Setting up $ifname"
-
proto_init_update "$ifname" 1
proto_add_data
json_add_string "manufacturer" "$manufacturer"
@@ -150,6 +164,15 @@ proto_ncm_setup() {
proto_add_dynamic_defaults
ubus call network add_dynamic "$(json_dump)"
}
+
+ [ -n "$finalize" ] && {
+ eval COMMAND="$finalize" gcom -d "$device" -s /etc/gcom/runcommand.gcom || {
+ echo "Failed to configure modem"
+ proto_notify_error "$interface" FINALIZE_FAILED
+ return 1
+ }
+ }
+
}
proto_ncm_teardown() {