From 158b5cc3fb62a52c7cd3ffc1c0d96db368a9c403 Mon Sep 17 00:00:00 2001 From: gnhb Date: Sun, 28 Mar 2010 22:00:33 +0700 Subject: Fix mistakes (now using "call" instead of "goto") and add check to SIM PIN setting routine so we don't have to set the pin every time if it's already set. --- usr/local/sbin/mpd.script | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'usr/local/sbin') diff --git a/usr/local/sbin/mpd.script b/usr/local/sbin/mpd.script index deb03a9..aa2501e 100644 --- a/usr/local/sbin/mpd.script +++ b/usr/local/sbin/mpd.script @@ -83,8 +83,8 @@ DialPeer1: DialPeer2: log "Detected $ModemDescription." call $ModemSetupFunc - if $SimPin != "" goto DialPeerSetPin - if $APN != "" goto DialPeerSetAPN + if $SimPin != "" call DialPeerSetPin + if $APN != "" call DialPeerSetAPN log "Dialing server at $Telephone..." call ModemDial if $dialResult == "OK" goto DialPeerOK @@ -101,9 +101,15 @@ DialPeer3: success DialPeerSetPin: + set $modemCmd "+CPIN=?" + log $modemCmd + call ModemQuery + log $modemQuery + if $modemQuery match ".*READY.*" PinReady set $modemCmd "+CPIN=\"$SimPin\"" call ModemCmd2 - wait $ConnectTimeout + wait $PinWait +PinReady: return DialPeerSetAPN: @@ -1514,7 +1520,7 @@ GetOK: wait 3 log "The modem is not responding." failure -GotOK +GotOK: return ## -- cgit v1.1