summaryrefslogtreecommitdiffstats
path: root/package/comgt/files/setpin.gcom
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-11-04 00:21:54 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-11-04 00:21:54 +0000
commit78c205401ed5d3a55f0b5a92c098af8bf7145540 (patch)
tree198d7cd0a2f80977b36d86b96c6aa1f645221297 /package/comgt/files/setpin.gcom
parent4c219a52f7399d5cd43ea4e1f9a92ecefedf76d0 (diff)
move comgt to trunk and add network scripts for umts compatible with the wrt54g3g
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5433 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/comgt/files/setpin.gcom')
-rw-r--r--package/comgt/files/setpin.gcom55
1 files changed, 55 insertions, 0 deletions
diff --git a/package/comgt/files/setpin.gcom b/package/comgt/files/setpin.gcom
new file mode 100644
index 000000000..66350fe20
--- /dev/null
+++ b/package/comgt/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