BEWARE: This document is targeted for Android, all information and code is Android related and may not work if you use a “normal” linux distribution (ubuntu, …) .

What is PPP?

All important files usually are in the /system/etc/ppp/ directory, but you have a default link at /etc/ppp/. Mainly,

/etc/ppp/options

/etc/ppp/chap-secrets

/etc/ppp/pap-secrets

/etc/ppp/ip-up-ppp0

/etc/ppp/ip-down-ppp0

/etc/ppp/chatscripts/dialer

/etc/ppp/init.gprs-pppd

You also have the 2 binaries I’ll use later: /system/bin/chat, a program used to handle communication with a dial modem, and /system/bin/pppd the PPP daemon.

For tests purposes later on, I’ll use all the pppd options parameters, and the chatscript option and related commands in one instruction. This is more handy than having to modify 2 files and save them. Be careful if you copy paste those lines: the options in the files i mentionned above will also be passed as arguments to the program and may be conflicting with the settings I tested.

Tests on Gingerbread

There are a couple of tests before you can test the above scripts in Android.

First we need, the chat program:

Go to ftp://ftp.samba.org/pub and download the 2.4.4 archive file. Copy the chat dir to ../froyo/external/ppp/ . We are gonna have to make a couple of changes to some files in order to actually build the files.

#!/system/bin/sh
#
# This script is run by the pppd _after_ the link is brought down.
# It uses run-parts to run scripts in /etc/ppp/ip-down.d, so to delete
# routes, unset IP addresses etc. you should create script(s) there.
#
# Be aware that other packages may include /etc/ppp/ip-down.d scripts (named
# after that package), so choose local script names with that in mind.
#
# This script is called with the following arguments:
# Arg Name Example
# $1 Interface name ppp0
# $2 The tty ttyS1
# $3 The link speed 38400
# $4 Local IP number 12.34.56.78
# $5 Peer IP number 12.34.56.99
# $6 Optional ``ipparam'' value foo
# The environment is cleared before executing this script
# so the path must be reset
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/system/bin
export PATH
# These variables are for the use of the scripts run by run-parts
PPP_IFACE="$1"
PPP_TTY="$2"
PPP_SPEED="$3"
PPP_LOCAL="$4"
PPP_REMOTE="$5"
PPP_IPPARAM="$6"
export PPP_IFACE PPP_TTY PPP_SPEED PPP_LOCAL PPP_REMOTE PPP_IPPARAM
# as an additional convenience, $PPP_TTYNAME is set to the tty name,
# stripped of /dev/ (if present) for easier matching.
PPP_TTYNAME=`/system/bin/basename "$2"`
export PPP_TTYNAME
# If /var/log/ppp-ipupdown.log exists use it for logging.
if [ -e /var/log/ppp-ipupdown.log ]; then
exec >> /var/log/ppp-ipupdown.log 2>&1
echo $0 $*
echo
fi
# This script can be used to override the .d files supplied by other packages.
if [ -x /etc/ppp/ip-down.local ]; then
exec /etc/ppp/ip-down.local "$*"
fi
/system/bin/run-parts /etc/ppp/ip-down.d \
--arg="$1" --arg="$2" --arg="$3" --arg="$4" --arg="$5" --arg="$6"

I am using uBlox GSM LEON G200 module and i used above steps but i did not get the internet working. Do i need to change the PTY_PATH in reference_ril.c and comment the “requestSetupDataCall” function?

I am using PPPD from init.rc. I will give you ppp.log very soon but what will be the linkname to provide? Is it ppp0 or ppp? Shall i give anything. In my /dev directory, i can see ppp as an entry so what to do?

I can follow the above steps but have a bit confusion on reference_ril.c role during system is running. Anyway, let me give you the log first.

Well you don’t even try to connect to the internet so it goes without saying that you won’t have an internet connection when the script ends.

You need to tell the modem to connect at some point, by setting the APN (depends on your phone plan provider) and then you usually have to use something like ATD99****1 I think. I didn’t provide this part because this is the part where it really depends in which country you are, what phone provider you subscribed to, which modem you use…

Here i would like to explain in detail about what i have done to integrate the gsm/gprs modem in to gingerbread.
I have LEON G200 (2G only) module from uBlox and support gsm, gprs both with in built MUX protocol and working on single serial port only for AT and DATA.

I followed your previous script for setting RIL and i was able to get the GSM working and can dial out any number. However, after RADIO_POWER (AT+CFUN=1), i am getting some issue in unsolicited response and RADIO treated as death for telephony but from the adb shell, i am writing below command to again start the OnRequest engine:

#echo -e “AT\r” > /dev/ttyO3

After doing this, i am getting gsm working and now can do call as well.

Once i done with GSM part ( with all modification that you said in init.rc and android layer) i started to read PPP post.

According to this, i have added chat script and looking for conncetScript to make it work. In your init.gprs-pppd script, i have change the physical port from /dev/ttyUSB0 to /dev/ttyO3.i have no idea on linkname.

up to this point, i have not done anything in reference_ril.c meas for PTY_PATH. It is as below:
#define PPP_TTY_PATH “/dev/omap_csmi_tty1”

Now when i loaded everything in to board, i restarted the board and went in to APN menu and gave the required value. and restart the board but net is not working.

So below are question which i can not figure out by studying so many forum.

1. If i want to run GPRS then do i need to disable rild from init.rc?

2. Can i use both, obvious not simultaneously but by switching from GSM-> GPRS and GPRS-> GSM?

3. in my board, i have /dev/ppp entry what to do with that?

4. i have read couple of thread and saying that use /dev/ppp for ril and physical port for pppd. i don’t know what is the exact path and how to set that

5. There are so many forum available but none are clear so here i would like to solve the issue if someone have serial modem and would like to work GSM/GPRS then what are the best steps to get both working. Your “ril” post is awesome for GSM.

3. I think the ppp node is the ppp driver layer. you should see a new entry “ppp0” when you connect using pppd. This is the linkname part (it defualts to ppp0 if i remember correctly)

4. see 4.

5. This part I didn’t do as I bought an Android compatible modem (Cinterion PH8 is shipped with the android ril). To have both working you are on the good track as you already support MUX and this is definetly the way to go. In the end you will have a command port and a data port.

Once again my advice is that you should drop the ril part for now, get a working internet connection and then move back to the ril and integrate what you did. This would defintely save you time as you won’t have to check whether a bug comes from the ril or the ppp part.

Now I am working on RIL (ph8) driver,i’m little bit confusion with starting pppd service, bcoz i am opening data (ttyUSB0)and command port(ttyACM0) but plssss suggest me how to start pppd service and which device name i need to give (i.e ttyACM0 or other).

i have been working on gprs/gsm cinterion(tc63i) modem,here also i got one physical serial port. based on some support i have integrated GSM to android frame work and it’s been working fine. through command line i have been establish the gprs connection and this is also working fine. please can you suggest me how to access from Android UI.
my module vendor also provided me MUX driver.

I’ve been following your discussion on the rowboat forum. My first question is: have you followed my tutorial? The second question is: what is it you are not able to do if you succeed in integrating your modem? And please don’t copy paste your post 🙂

I am also facing the same issues like what Tejas faced. I followed all your conversations and confident to solve the issue. But Tejas simply escaped once he got fixed his issue with the help of your guidance. Such people only looking at their own benefit and never consider about the knowledge transfer from a technical geek like adrienferre.

so.
one more thing is for the time being i don’t wnat GSM and i want only GPRS
for that what i did is?

i have written small android application it’s like two buttons one for connect and second one for disconnect,so in jni part if i press connect button i am trying to open my modem file and i am trying to run pppd call gprs from jni layer using like system call like (system(“pppd call gprs”); and also i tried like execl(“/system/bi/pppd”,”pppd”,”call”,”gprs”);
but these thing not working for me.

Actually modem (ph8) connects to ttyUSB0[data port] & ttyUSB1[command port]. But problem is that i want to make 3g connection. For that instead of dialling from RIL, I’m using the pppd chat scripts. in chat script i’m using ttyACM0 for data connection.The problem is that APN i need to hardcode and build the image and flash on my android device.It works only for that particular n/w carrier but if I use Other SIM and try to connect to 3g then connection is not establishing. Though i use “Settings->wireless&n/w->Mobile n/w->Access Point Names” to set the APN.

I faced this particular problem and IIRC I solved it by configuring the ppp.dns1 and ppp.dns2 (or net.dns1 and net.dns2, but I guess if you already tested those out, they can’t be the ones). You should take a look at those properties.

Hi, I’m not sure my previous post went through, so asking again…
I’m porting a GB tablet firmware to JB (https://groups.google.com/forum/#!forum/renesas-emev-osp) and I’m now stuck at the 3G modem integration. I missed what has been customized in GB (though I can access code), so I have to redo the work myself.
Hence I found your tutorial very useful to this aim, though I still have some doubts I’d like you to clarify.

1) what needs to be done, in order to make the connection being triggered by the “appearance” of the ttyUSB* devices, when powering up the modem for example?
2) the chat script invoked by pppd is apparently operator-specific. What should be done to make connection generic and APN-independent?
3) If rild makes the “trick”, what are the parts that are typically customized and what type of info needs to be collected about the specific modem being used (btw, mine is a ZTE MF-212).

1) if you want to trigger it when you connect/power the modem, you should look at udev and add a script which would call the ril init. I don’t really know if you need this.

2) There are several options which should be grouped (modem serial speed, tty name, …), and others which shouldn’t be (authentication, dns adresses, …). PPP offers this kind of hierarchical property definition (see ppp/options) You should take a look at the ppp documentation.

3) The customised parts should all be in the lower level RIL ( written in c, accessible in hardware/ril/rild IIRC), and those are typically AT command modification or response translation for the upper layers of the RIL. You could have some bug fixes to put in the java layer as well.