WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: (solved) I try to avoid vwdial and to use pppd directly: issue. HowTo?  (Read 6874 times)

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
Hello,

I achieved a connecting to internet with my usb modem: http://forum.tinycorelinux.net/index.php/topic,11509.msg61207.html#msg61207

Now, for an other project, I would like to use pppd as a command line (NO wvdial) on an embedded system.

I made

Code: [Select]
# file etc/ppp/pppscript
TIMEOUT 10
ABORT ERROR
ABORT BUSY
ABORT "NO CARRIER"
#ABORT "NO DIALTONE"
REPORT CONNECT
"" ATZ
OK "ATE1V1&D2&C1S0=0"
OK "ATE1"
OK 'AT+CPIN="4088"'
TIMEOUT 60
OK 'AT+CGDCONT=1,"IP","pinternet.interkom.de"'
OK "AT+CGATT=1"
SAY "Calling fonic GPRS"
TIMEOUT 60
"" "ATDT*99#"
CONNECT c

Code: [Select]
# file etc/ppp/option
lock
defaultroute
noipdefault
usepeerdns
modem
/dev/ttyUSB0
#460800
nocrtscts
ipxcp-accept-local
ipxcp-accept-remote
debug
passive
asyncmap 0
name "user"

Code: [Select]
# file etc/ppp/ip-up

PATH=/usr/bin:/usr/sbin:/usr/local/bin:/sbin:/bin
export PATH

if [ -s /var/log/messages ] && ( ps xc 2>/dev/null | grep -q syslogd 2>/dev/null ); then
S=`tail -n 30 /var/log/messages 2>/dev/null | grep "CARRIER[^)]" 2>/dev/null | tr -d "^M" 2>/dev/null | cut -d: -f4 2>/dev/null`
echo -n "$S" >/dev/tty0
echo " Local: $4 -> Remote: $5 $1" >/dev/tty0
else
echo " Local: $4 -> Remote: $5 $1" >/dev/tty0
fi

Code: [Select]
#               file etc/ppp/ip-down
#!/bin/sh
#
# This script is run by pppd after the PPP connection is ended.
#
# The companion file is /etc/ppp/ip-up, it's run when the PPP
# connection is started.
#
# This file is created when you run pppsetup: Mon Jan  5 22:49:55 UTC 2009
#
# The environment is cleared before executing this script
# so the path must be reset.
#
PATH=/usr/sbin:/sbin:/usr/bin:/usr/local/bin:/bin
export PATH

# Send "ath" = hangup etc. to modem when ppp connection ends.

ALL in the backup (inclusiv an additional /etc/ppp/resolv.conf, same as the resolv.conf of the link above).
With the command

sudo pppd -detach connect "chat -v -s -f /etc/ppp/pppscript" following error log appear
Code: [Select]
timeout set to 10 seconds
abort on (ERROR)
abort on (BUSY)
abort on (NO CARRIER)
report (CONNECT)
send (ATZ^M)
expect (OK)
ATZ^M^M
OK
 -- got it

send (ATE1V1&D2&C1S0=0^M)
expect (OK)
^M
ATE1V1&D2&C1S0=0^M^M
OK
 -- got it

send (ATE1^M)
expect (OK)
^M
ATE1^M^M
OK
 -- got it

send (AT+CPIN="4088"^M)
timeout set to 60 seconds
expect (OK)
^M
AT+CPIN="4088"^M^M
OK
 -- got it

send (AT+CGDCONT=1,"IP","pinternet.interkom.de"^M)
expect (OK)
^M
AT+CGDCONT=1,"IP","pinternet.interkom.de"^M^M
OK
 -- got it

send (AT+CGATT=1^M)
Calling fonic GPRS
timeout set to 60 seconds
send (ATDT*99#^M)
expect (CONNECT)
^M
AT+CGATT=1^M^M
NO CARRIER
 -- failed
Failed (NO CARRIER)
Connect script failed

Why? what happens? How to solve this? any idea is welcome.
« Last Edit: June 02, 2013, 10:26:48 AM by floppy »
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed

Offline floppy

  • Hero Member
  • *****
  • Posts: 577
Re: I try to avoid vwdial and to use pppd directly: issue. HowTo?
« Reply #1 on: June 02, 2013, 10:25:05 AM »
The solution for not using wvdial anymore is...

"sudo pppd call huaweiparam"

with following files..

Code: [Select]
# file etc/ppp/peers/huaweiparam
#lock
defaultroute
noipdefault
debug
usepeerdns
# idle 0
persist
modem
/dev/ttyUSB0
460800
noauth
usehostname
#ipcp-restart 20
#ipcp-accept-local
#ipcp-accept-remote
#maxfail 0
#dryrun
# or later dump
crtscts
user foo
#password nc10
#passive
#logfd 6
#chap-interval 10
#noccp
#novj
#connect-delay 20000
-detach
connect "/etc/ppp/peers/scriptfonic.sh"


Code: [Select]
#!/bin/sh
# file etc/ppp/peers/scriptfonic.sh
/usr/local/sbin/chat -V -f /etc/ppp/peers/chatfonicprep
sleep 30
/usr/local/sbin/chat -V -f /etc/ppp/peers/chatfonicconn
# endfile


Code: [Select]
# file etc/ppp/peers/chatfonicprep
SAY "\nInitiating the modem with the PIN..\n"
TIMEOUT 100
ABORT ERROR
# restore factory setups
"" "AT&F"
OK "ATZ"
#OK "AT+CPIN=4088"
OK "AT+CPIN=\0424088\042"
# enable echo = default ATE1
#OK "ATE1"
OK "ATE1V1&D2&C1S0=0"
#OK "ATE1V1&D2&C1S0=0+IFC=2,2"
SAY "\nWaiting 30s to switch between UMTS/GPRS..\n"


Code: [Select]
# file etc/ppp/peers/chatfonicconn
SAY "\nConnecting to the IPN\n"
TIMEOUT 100
ABORT ERROR
ABORT BUSY
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
REPORT CONNECT
#restore factory configuration
"" "AT&F"
OK "ATZ"
#OK "ATE1V1&D2&C1S0=0"
# enable echo of command = default
OK "ATE1"
#no pin OK AT+CPIN="4088"
#no pin OK "AT+CPIN=\0424088\042"
#which networks
"" "AT+COPS?"
# what strength
OK "AT+CSQ"
#OK AT+CGDCONT=1,"IP","pinternet.interkom.de"
OK AT+CGDCONT=1,\042IP\042,\042pinternet.interkom.de\042
#OK "AT+CGATT=1"
#"" "ATDT*99#"
OK "ATDT*99#"
#in other cases...OK "ATD*99***1#"
CONNECT \c


In order to give time to the modem to switch, I had to give a 30s (perhaps less?) time between the preparation (PIN defined) and connection.
AMD K6-IIIATZ 550MHz MB DFI K6xv3/+66
P4 HP DC7100 3GB 3GHz
Samsung NC10 boot from SD card port (via USB reader)
.. all TinyCore proofed