From 412c781600fa41c0133de2e0fb4af9e9ef3f08b5 Mon Sep 17 00:00:00 2001 From: Roman Yeryomin Date: Wed, 10 Oct 2012 19:07:43 +0300 Subject: Fix query3g so it could detect more 3g dongles which don't have AT+CPIN command Signed-off-by: Roman Yeryomin --- package/query3g/files/query3g.gcom | 76 +++++++++++++++++++++++++++++++++----- 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 -- cgit v1.2.3