summaryrefslogtreecommitdiff
path: root/package/comgt/files/waitready.comgt
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2010-07-19 10:49:49 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2010-07-19 10:49:49 +0200
commit7907e3ee7302ac3fd428989a07b0df74f0c52853 (patch)
treee6de18488a687707667927065724372b40510d65 /package/comgt/files/waitready.comgt
parentb70fdbfbf1139605c22083b647337f2b16f62fc3 (diff)
parent61355d1f054c15673adeb62d32dfd4563f89c165 (diff)
Merge branch 'master' of git+ssh://openadk.org/git/openadk
Diffstat (limited to 'package/comgt/files/waitready.comgt')
-rw-r--r--package/comgt/files/waitready.comgt34
1 files changed, 34 insertions, 0 deletions
diff --git a/package/comgt/files/waitready.comgt b/package/comgt/files/waitready.comgt
new file mode 100644
index 000000000..0de4df5d4
--- /dev/null
+++ b/package/comgt/files/waitready.comgt
@@ -0,0 +1,34 @@
+# wait till the sim is ready
+opengt
+ set com 115200n81
+ set senddelay 0.02
+ waitquiet 1 0.2
+ flash 0.1
+:start
+ print "Waiting for SIM..."
+ let c=0
+:waitready
+ send "AT+CPIN?^m"
+ waitfor 2 "SIM PUK","SIM PIN","READY","ERROR","ERR"
+ if % = -1 goto tryagain
+ if % = 0 goto simready
+ if % = 1 goto simready
+ if % = 2 goto simready
+ if % = 3 goto tryagain
+ if % = 4 goto tryagain
+
+:tryagain
+ if c > 120 goto waittimeout
+ let c=c+2
+ print "."
+ goto waitready
+
+:waittimeout
+ print " Timeout
+"
+ exit 1
+
+:simready
+ print " OK
+"
+ exit 0