summaryrefslogtreecommitdiff
path: root/openwrt/package/gcom/files
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt/package/gcom/files')
-rw-r--r--openwrt/package/gcom/files/getcardinfo.gcom14
-rw-r--r--openwrt/package/gcom/files/getstrength.gcom14
-rw-r--r--openwrt/package/gcom/files/setmode.gcom26
-rw-r--r--openwrt/package/gcom/files/setpin.gcom55
4 files changed, 109 insertions, 0 deletions
diff --git a/openwrt/package/gcom/files/getcardinfo.gcom b/openwrt/package/gcom/files/getcardinfo.gcom
new file mode 100644
index 0000000000..5c69a64604
--- /dev/null
+++ b/openwrt/package/gcom/files/getcardinfo.gcom
@@ -0,0 +1,14 @@
+opengt
+ set com 115200n81
+ set comecho off
+ set senddelay 0.02
+ waitquiet 0.2 0.2
+ flash 0.1
+
+:start
+ send "ATI^m"
+ get 1 "" $s
+ print $s
+
+:continue
+ exit 0
diff --git a/openwrt/package/gcom/files/getstrength.gcom b/openwrt/package/gcom/files/getstrength.gcom
new file mode 100644
index 0000000000..2886285971
--- /dev/null
+++ b/openwrt/package/gcom/files/getstrength.gcom
@@ -0,0 +1,14 @@
+opengt
+ set com 115200n81
+ set comecho off
+ set senddelay 0.02
+ waitquiet 0.2 0.2
+ flash 0.1
+
+:start
+ send "AT+CSQ^m"
+ get 1 "" $s
+ print $s
+
+:continue
+ exit 0
diff --git a/openwrt/package/gcom/files/setmode.gcom b/openwrt/package/gcom/files/setmode.gcom
new file mode 100644
index 0000000000..4ce0b5fa78
--- /dev/null
+++ b/openwrt/package/gcom/files/setmode.gcom
@@ -0,0 +1,26 @@
+# set wwan mode from environment
+opengt
+ set com 115200n81
+ set senddelay 0.02
+ waitquiet 1 0.2
+ flash 0.1
+
+:start
+ print "Trying to set mode\n"
+ send $env("MODE")
+ send "^m"
+
+ waitfor 15 "OK","ERR","ERROR"
+ if % = 0 goto continue
+ if % = 1 goto modeerror
+ if % = 2 goto modeerror
+
+ print "Timeout setting WWAN mode!\n"
+ exit 1
+
+:modeerror
+ print "Error setting WWAN mode!\n"
+ exit 1
+
+:continue
+ exit 0
diff --git a/openwrt/package/gcom/files/setpin.gcom b/openwrt/package/gcom/files/setpin.gcom
new file mode 100644
index 0000000000..66350fe20b
--- /dev/null
+++ b/openwrt/package/gcom/files/setpin.gcom
@@ -0,0 +1,55 @@
+# set pin code from evnironment "$PINCODE"
+opengt
+ set com 115200n81
+ set senddelay 0.05
+ waitquiet 3 0.5
+ flash 0.1
+
+ let c=0
+:start
+ send "AT+CPIN?^m"
+ waitfor 15 "SIM PUK","SIM PIN","READY","ERROR","ERR"
+ if % = -1 goto timeout
+ if % = 0 goto ready
+ if % = 1 goto setpin
+ if % = 2 goto ready
+ if % = 3 goto checkrepeat
+ if % = 4 goto checkrepeat
+
+:checkrepeat
+ inc c
+ if c>3 goto pinerror
+ waitquiet 12 0.5
+ goto start
+
+:timeout
+ print "timeout checking for PIN."
+ exit 1
+
+:ready
+ print "SIM ready\n"
+ goto continue
+ exit 0
+
+:setpin
+ # check if output was "SIM PIN2", that's ok.
+ waitfor 1 "2"
+ if % = 0 goto ready
+
+ print "Trying to set PIN\n"
+ send "AT+CPIN=\""
+ send $env("PINCODE")
+ send "\"^m"
+
+ waitfor 20 "OK","ERR"
+ if % = -1 goto pinerror
+ if % = 0 goto continue
+ if % = 1 goto pinerror
+
+:pinerror
+ print "Error setting PIN, check card manually\n"
+ exit 1
+
+:continue
+ print "PIN set successfully\n"
+ exit 0