diff options
author | Roman Yeryomin <roman@advem.lv> | 2012-10-10 19:07:43 +0300 |
---|---|---|
committer | Roman Yeryomin <roman@advem.lv> | 2012-12-03 00:13:25 +0200 |
commit | c1f8d33d3b3563ef77bcaaae3d16921540079ef2 (patch) | |
tree | 4d7a8fadaa6b022551f022da1e6ff1b0f02a1d82 | |
parent | 44edd760c668907a304ffc022e4c50fa8eb5d81a (diff) |
Fix query3g so it could detect more 3g dongles which don't have AT+CPIN command
Signed-off-by: Roman Yeryomin <roman@advem.lv>
-rw-r--r-- | package/query3g/files/query3g.gcom | 76 | ||||
-rw-r--r-- | package/query3g/files/query3g.sh | 4 |
2 files changed, 69 insertions, 11 deletions
diff --git a/package/query3g/files/query3g.gcom b/package/query3g/files/query3g.gcom index f63207805..9b3ecc6cb 100644 --- a/package/query3g/files/query3g.gcom +++ b/package/query3g/files/query3g.gcom @@ -7,15 +7,7 @@ opengt send "AT\^CURC=0^m" waitfor 5 "OK","ERROR" - let $c="AT+CPIN?^m" - let $r="+CPIN" - gosub readatcmd - - let $c="AT+CSQ^m" - let $r="+CSQ" - gosub readatcmd - - let $c="ATE1; +CGMI^m" + let $c="AT+CGMI^m" gosub readatcmdnr let $v=$s @@ -26,27 +18,74 @@ opengt 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 @@ -54,9 +93,14 @@ opengt 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 @@ -64,23 +108,36 @@ opengt 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" @@ -100,6 +157,7 @@ opengt exit 0 + :readatcmd let i=5 send $c diff --git a/package/query3g/files/query3g.sh b/package/query3g/files/query3g.sh index b591d61a3..33cfe2379 100644 --- a/package/query3g/files/query3g.sh +++ b/package/query3g/files/query3g.sh @@ -22,9 +22,9 @@ for port in 0 1 2 3 4 5 6 7 8 9; do local vid="$(cat "$tty/../../idVendor")" local pid="$(cat "$tty/../../idProduct")" - if [ "$last_reset" != "$vid:$pid" ]; then + if [ "$last_reset" != "$vid:$pid" ] && [ "$vid:$pid" != "0685:7000" ]; then last_reset="$vid:$pid" - $reset "$vid:$pid" >/dev/null +# $reset "$vid:$pid" >/dev/null local try=0 while [ $((try++)) -lt 5 ] && [ ! -e "$dev" ]; do sleep 1; done |