Hi! I think you're totally right - this is the last part you need to figure out.
We have the following code to start the service (and yes - it starts the
service in init.rc):
err = property_set("ctl.start", "pppd_gprs");
LOGD("starting service pppd_gprs...");
if (err < 0) {
LOGD("### error in starting service pppd_gprs: err %d", err);
goto error;
};
BUT for this to work, you have to hack system/core (see attached patch), or RIL
won't have permissions to start the service. Whether this is the right way to
go, I don't know; there may be better and more secure ways of getting the job
done, and it seems Google wants to tighten security in this area. And maybe you
don't even need the hack on Donut...
When you need to stop the service - just set the property "ctl.stop" - you get
the idea :-)
Regarding ip-up & ip-down: Yes - these are started by pppd and supplies the
various variables such as $IPLOCAL.
I cannot share all the code, since I am unsure of what our company policy says
about it. That being said I think you're almost there. Just make sure that you
send a properly formatted reply to the REQUEST_SETUP_DATA_CALL with the
obtained IP inside (hint: use property_get("net.gprs.local-ip", address_ip ,"")
to retrieve the ip set by ip-up).
If we need to go deeper here, please post output of 'logcat -b radio' :-)
Best,
Henrik Uhrenfeldt
Chief Software Engineer
Ixonos Denmark ApS
Niels Jernes Vej 10,
DK-9220 Aalborg Ø, Denmark
mobile +45 4030 2607
email: [email protected]
http://www.ixonos.com-----Original Message-----
From: M&M stich [mailto:[email protected]]
Sent: 11. maj 2010 16:40
To: Uhrenfeldt Henrik
Subject: Re: [android-porting] Re: Data connection via cell modem (GPRS)
Hello Henrik,
The settings did not make it work. I start the ppp session from the console
manually, and it connects properly as evidenced by ping working. My problem I
think is related to not understanding how to start the ppp session inside of
REQUEST_SETUP_DATA_CALL and then get Android Telephony to use it for data.
The property ctl.start is new to me, how is that set in RIL? Does that trigger
the service from init.rc somehow?
I'm also not sure how ip-up knows what the local and remote IP's are. Does the
call to pppd call ip-up automatically with $IPLOCAL?
If it is not too much to ask, could you send some example code? Things like
your REQUEST_SETUP_DATA_CALL and the associated close data call, any germane
ppp scripts (ip-up, ip-dn ?), the service pppd_gprs section of init.rc, and the
permission hack patch.
I think I have all the bits working, I'm just not sure how to hook them all
together. Thanks much for your help
Mike
On Tue, May 11, 2010 at 1:43 AM, Uhrenfeldt Henrik
<[email protected]> wrote:
Hello Mstich12,
I do think those settings should work with Donut (we were inspired by a
Donut setup), but as I said, maybe they're insufficient. I never figured out
from your reply if you tested these properties and if it brought you any
further?
What we did to setup PPP was to create a service "pppd_gprs" inside
init.rc. This service runs a script that:
1. Sets a custom property to let us know that PPP is starting
2. Runs pppd as:
/system/bin/pppd $* connect 'chat -v -s -f
/system/etc/chatscript' nodetach debug defaultroute ipcp-accept-remote
ipcp-accept-local usepeerdns
3. Sets another customer property in which we set the exit code of ppp
Then this service is started from inside the RIL during handling of
REQUEST_SETUP_DATA_CALL, by setting the property "ctl.start" to "pppd_gprs".
This is the point that needs a security hack (at least in Éclair release), or
the service does not start at all. Let me know if you need this hack, and I can
send a patch...
Once the service is started and PPP is running (this is in fact not
trivial to figure out), we read the "net.gprs.local-ip" set by the ip-up script
and passes this back in the reply to REQUEST_SETUP_DATA_CALL.
Since PPP connectivity is handled by a script in its own service, you
have the freedom to choose exactly which tty it should connect to (in the setup
above it takes it from the service parameter stated in init.rc). That being
said, you may have to tweak a little to make sure that the needed AT commands
to set up everything is sent on the right channel. For example we setup the PDP
context using one channel (the AT+CGDCONT=1,"ip","internet" stuff) and PPP
connection via another one (the ATDT*99***1# and PPP stuff). Requirements may
be different for your modem...
Try running a "logcat -b radio" - this will give some useful log
information from Android's radio & connectivity layer...
Best regards,
---
Henrik Uhrenfeldt
Chief Software Engineer
Ixonos Denmark ApS
Niels Jernes Vej 10,
DK-9220 Aalborg Ø, Denmark
mobile +45 4030 2607
email: [email protected]
http://www.ixonos.com
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of ms12
Sent: 10. maj 2010 18:44
To: android-porting
Subject: [android-porting] Re: Data connection via cell modem (GPRS)
Thanks much for the pointers, we are certainly missing some of the
setprop's. I will try those. However, we are using Donut (1.6) and I
wonder if they will work there.
More detail:
I've not been able to see my way clear to setting up the data call via
the RIL. I think I could spawn ppp (via system(pppd ...) ??) and
connect it to the second CMUX channel when REQUEST_SETUP_DATA_CALL
happened, but I would still need to tell Android to use that channel,
not the original command connection, and I can't see how to do that.
So what I did was run pppd (with scripts and chat to dial the "ISP"
and using the alternate mux channel on /dev/pts/0) outside of the RIL
from the console. This works, the connection is established, and I
do a setprop net.dns1 manually. (I believe the scripts are doing a
"defaultroute" when pppd starts, the equivalent of route add default
gw xx.xx.xx.xx dev ppp0 I do not need to run route explicitly). At
this point I can ping www.google.com, but any attempt to start the web
browser from Android touchscreen just hangs or gives an error.
Thanks again for the help.
Mike
On May 10, 3:58 am, Uhrenfeldt Henrik <[email protected]>
wrote:
> Hi ms12,
>
> We created a setup where a 3G mobile broadband dongle works as
telephony backend for Android Eclaire (without voice calls of course). It
sounds similar to what you guys are doing.
>
> I believe that implementing an ip-up script in /system/etc/ppp will
make things work:
>
> /system/etc/ppp/ip-up should contain something like this:
>
> /system/bin/setprop "net.interfaces.defaultroute" "gprs"
> /system/bin/setprop "net.gprs.dns1" "$DNS1"
> /system/bin/setprop "net.gprs.dns2" "$DNS2"
> /system/bin/setprop "net.gprs.local-ip" "$IPLOCAL"
> /system/bin/setprop "net.gprs.remote-ip" "$IPREMOTE"
> /system/bin/setprop "net.gprs.gw" "$IPREMOTE"
>
> This script will run every time PPP sets up a connection and provide
Android with the correct gateway, dns, etc. To check that it actually ran, I
added the following:
>
> /system/bin/log -t pppd "IP-UP TRACE for gprs"
> /system/bin/log -t pppd "DNS1 $DNS1"
> /system/bin/log -t pppd "DNS2 $DNS2"
> /system/bin/log -t pppd "local-ip $IPLOCAL"
> /system/bin/log -t pppd "remote-ip $IPREMOTE"
> /system/bin/log -t pppd "gw $IPREMOTE"
>
> ..which will throw useful information into logcat output.
>
> You can also make a /system/etc/ip-down script to change things back
the way they were (if you have multiple ways of connecting to the internet).
>
> But how do you initiate the PPP connection? Via Android RIL or just
via init? I am unsure of whether Android will understand that it has a GPRS
packet data connection without proper handling in the RIL (I don't know if
setting the above properties is sufficient)...
>
> You should be aware that in later Android releases you need some
security hacks to allow the RIL to spawn the PPP process (which must run as
root), and you need some tweaky plumbing to ensure proper interaction between
RIL & PPP during handling of RIL_REQUEST_SETUP_DATA_CALL...
>
> Let me know how you get along with this.
>
> - Henrik
>
> -----Original Message-----
> From: [email protected]
[mailto:[email protected]] On Behalf Of Daniel Baeyens
> Sent: 10. maj 2010 10:23
> To: [email protected]
>
> Cc: android-porting
> Subject: Re: [android-porting] Data connection via cell modem (GPRS)
>
> Hi,
>
> On Mon, May 10, 2010 at 4:53 AM, ms12 <[email protected]> wrote:
> > We are trying to implement a demo of a mobile industrial sensor via
> > android. One of the goals of the demonstration is to send data to a
> > web site. The cell modem is working for SMS messages via the
> > reference RIL just fine. We would like to use GPRS to allow
somewhat
> > more data. We currently have the gsm0710muxd working, with one
> > channel connected to the RIL, the other connected via chat/pppd such
> > that ping works from the Linux console. What we can't seem to
figure
> > out is how to get Android to use the default route that is set up
via
> > pppd. Can anybody give me some pointers on what needs to be done to
> > get Android to use the connection? Thanks much in advance.
>
> Which is the full command you are using for setting the route?
>
> Can you explain a little bit more your process?
>
> KR
> --
> Daniel Baeyens
> Warp Networks S.L. -http://www.warp.es
>
> --
> unsubscribe: [email protected]
<mailto:android-porting%[email protected]>
> website:http://groups.google.com/group/android-porting
>
> --
> unsubscribe: [email protected]
<mailto:android-porting%[email protected]>
> website:http://groups.google.com/group/android-porting
--
unsubscribe: [email protected]
<mailto:android-porting%[email protected]>
website: http://groups.google.com/group/android-porting
--
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
pppd-hack.patch
Description: pppd-hack.patch
