also sprach Marco d'Itri <[email protected]> [2014-10-05 07:50 +0200]: > > 3. Enable the AT+CPIN line, but ignore errors from it, or make > > it conditional on the output of AT+CPIN? if possible. > I expect that some modems would break if sent an unexpected PIN, > and ignoring errors would not be acceptable. I do not have a modem > around, but I would accept a patch to only send the PIN if the > answer to "AT+CPIN?" says that it is needed.
Here you go:
# +CPIN provides the SIM card PIN
OK AT+CPIN? '+CPIN: READY-AT+CPIN="$SIMPIN"-OK'
AT+CGDCONT=1,"IP","\T","",0,0
Note that the AT+CGDCONT=1 line needs the initial OK removed. Also,
this needs to happen after AT+CFUN=1, which turns on the card, at
least for my Ericsson.
Here's a demo:
First try:
*EMRDY: 1
OK
ATH
OK
ATE1
OK
AT+CFUN=1
OK
AT+CPIN?
+CPIN: SIM PIN
OK
AT+CPIN="1234"
OK
AT+CGDCONT=1,"IP","apn","",0,0
[…]
Second try:
*EMRDY: 1
OK
ATH
OK
ATE1
OK
AT+CFUN=1
OK
AT+CPIN?
+CPIN: READY
OK
AT+CGDCONT=1,"IP","apn","",0,0
--
.''`. martin f. krafft <[email protected]> @martinkrafft
: :' : proud Debian developer
`. `'` http://people.debian.org/~madduck
`- Debian - when you have better things to do than fixing systems
digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)

