summaryrefslogtreecommitdiffstats
path: root/package/query3g/files/usr/share/query3g.gcom
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2013-07-19 09:51:19 +0300
committerRoman Yeryomin <roman@advem.lv>2013-07-19 09:51:19 +0300
commitfde05611c4f3ecf7a5d45032d8fd53cfc0420d5f (patch)
tree240f82039d9b60aed2432bfbe2d1c9101ee8a84c /package/query3g/files/usr/share/query3g.gcom
parentcc536db22b447ccd6f158066909989f43ce83e32 (diff)
parent5bfe1cdae38c39a4fe7ca891aac31233165e3531 (diff)
Merge branch 'realtek-unstable' of git://git.tet.rtu.lv/openwrt-realtek into realtek-unstable
Diffstat (limited to 'package/query3g/files/usr/share/query3g.gcom')
-rw-r--r--package/query3g/files/usr/share/query3g.gcom206
1 files changed, 206 insertions, 0 deletions
diff --git a/package/query3g/files/usr/share/query3g.gcom b/package/query3g/files/usr/share/query3g.gcom
new file mode 100644
index 000000000..9b3ecc6cb
--- /dev/null
+++ b/package/query3g/files/usr/share/query3g.gcom
@@ -0,0 +1,206 @@
+opengt
+ set com 115200n81
+ set comecho off
+ set senddelay 0.02
+ waitquiet 0.2 0.2
+
+ send "AT\^CURC=0^m"
+ waitfor 5 "OK","ERROR"
+
+ let $c="AT+CGMI^m"
+ gosub readatcmdnr
+ let $v=$s
+
+ if $toupper($mid($v,0,3)) = "ZTE" goto zte
+ if $toupper($mid($v,0,3)) = "OPT" goto option
+ if $toupper($mid($v,0,3)) = "SIE" goto sierra
+ if $toupper($mid($v,0,3)) = "NOV" goto novatel
+ if $toupper($mid($v,0,3)) = "HUA" goto huawei
+ if $toupper($mid($v,0,3)) = "VOD" goto vodafone
+ if $toupper($mid($v,0,3)) = "NOK" goto vodafone
+ if $toupper($mid($v,0,4)) = "HSPA" goto ccrap
+ goto generic
+
+
+:signal-generic
+ let $c="AT+CSQ^m"
+ let $r="+CSQ"
+ gosub readatcmd
+ return
+
+
+:cpin-generic
+ let $c="AT+CPIN?^m"
+ let $r="+CPIN"
+ gosub readatcmd
+ return
+
+
+:cpin-qualcomm
+ let $c="AT$QCPINSTAT?^m"
+ let $r="$QCPINSTAT"
+ gosub readatcmd
+ return
+
+
+:ccrap
+ gosub cpin-qualcomm
+
+ goto generic
+
+
+:vodafone
+ gosub cpin-generic
+ gosub signal-generic
+
+ let $c="AT%NWSTATE=1^m"
+ let $r="%NWSTATE"
+ gosub readatcmd
+
+ goto next
+
+
+:novatel
+ gosub cpin-generic
+ gosub signal-generic
+
+ let $c="AT$CNTI=0^m"
+ let $r="$CNTI"
+ gosub readatcmd
+
+ goto next
+
+
+:sierra
+ gosub cpin-generic
+ gosub signal-generic
+
+ let $c="AT*CNTI=0^m"
+ let $r="*CNTI"
+ gosub readatcmd
+
+ goto next
+
+
+:option
+ gosub cpin-generic
+ gosub signal-generic
+
+ let $c="AT_OCTI?^m"
+ let $r="_OCTI"
+ gosub readatcmd
+
+ let $c="AT_OWCTI?^m"
+ let $r="_OWCTI"
+ gosub readatcmd
+
+ goto next
+
+
+:zte
+ gosub cpin-generic
+ gosub signal-generic
+
+ let $c="AT+COPS?^m"
+ let $r="+COPS"
+ gosub readatcmd
+
+ let $c="AT+ZPAS?^m"
+ let $r="+ZPAS"
+ gosub readatcmd
+
+ goto next1
+
+
+:huawei
+ gosub cpin-generic
+ gosub signal-generic
+
+ let $c="AT\^SYSINFOEX^m"
+ let $r="\^SYSINFOEX"
+ gosub readatcmd
+
+ goto next
+
+
+:generic
+ gosub cpin-generic
+ gosub signal-generic
+
+ let $c="AT\^SYSINFO^m"
+ let $r="\^SYSINFO"
+ gosub readatcmd
+
+
+:next
+ let $c="AT+COPS=3,2; +COPS?^m"
+ let $r="+COPS"
+ gosub readatcmd
+
+
+:next1
+ let $c="AT+CREG=2; +CREG?^m"
+ let $r="+CREG"
+ gosub readatcmd
+
+ let $c="AT+CGREG=2; +CGREG?^m"
+ let $r="+CGREG"
+ gosub readatcmd
+
+ let $c="AT+CGEQNEG=1^m"
+ let $r="+CGEQNEG"
+ gosub readatcmd
+
+ let $c="ATE1; +CGMM^m"
+ gosub readatcmdnr
+ print "\nDEVICE:",$v," ",$s,"\n"
+
+ exit 0
+
+
+:readatcmd
+ let i=5
+ send $c
+:loop
+ get 1 "^m" $s
+ let l=len($r)
+ if len($s) < l goto loop1
+ if $mid($s,1,l) <> $r goto loop1
+ print $s
+ return
+
+:loop1
+ if len($s) < 2 goto loop2
+ if $mid($s,1,2) = "ER" return
+ if $mid($s,1,2) = "CO" return
+:loop2
+ if i = 0 return
+ let i=i-1
+ sleep 0.25
+ goto loop
+
+:readatcmdnr
+ let i=10
+ send $c
+:loop3
+ get 1 "^m" $s
+ if len($s) < 2 goto loop5
+ if $mid($s,1,2) = "ER" goto loop4
+ if $mid($s,1,2) = "OK" goto loop5
+ if $mid($s,1,2) = "AT" goto loop5
+ if $mid($s,1,2) = "TE" goto loop5
+ if $mid($s,1,1) = "+" goto loop5
+ if $mid($s,1,1) = "\^" goto loop5
+ let l=len($s)
+ let $s=$mid($s,1,l)
+ return
+
+:loop4
+ let $s=""
+ return
+
+:loop5
+ if i = 0 return
+ let i=i-1
+ sleep 0.25
+ goto loop3