Please consider the following changes to this file:
1. instead of ATD#99*, please use ATD\U and then add "-U #99*" to
the /etc/ppp/peers/gprs file. Reason: some providers don't use
this standard dialing sequence.
2. instead of requiring the PIN to be specified in this file,
I suggest to say AT+CPIN="$SIMPIN" or so, then to invoke chat
like this: env SIMPIN=1234 chat -E …. Reason: the PIN is
a parameter that should at least not appear on the command
line.
3. Enable the AT+CPIN line, but ignore errors from it, or make it
conditional on the output of AT+CPIN? if possible.
These changes should allow the complete reuse of
/etc/chatscripts/gprs for all purposes.
This would require fixing #3 first. 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. This has never been a goal...
also sprach Marco d'Itri <md@Linux.IT> [2014-10-05 07:50 +0200]:
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
There probably is a reason if AT+CFUN=1 is commented by default, so it looks like you will still have to modify the file for your hardware.