mozilla-b2g/rilproxy

Research how basic 3G data communication works in android

Closed this issue · 6 comments

Figure out what the basic requirements are for getting data flowing over the cell network

From some very quick web browsing, it looks like android makes a REQUEST_SETUP_DATA_CALL to the ril. Once this is done, it wires the connection into either ppp or network setup (Need to test this on a stock image with a SIM card with 3G capabilities), and exposes the interface the same as it would wifi/ethernet.

Hi, still not clear if b2g is trying to build itself on top of Android (they mention android compatibility layer in the charter) or if it is trying to just be compatible. If the kernel will be built around something other than Android's version of Linux, then might be worth a glance at some other projects as well: http://ofono.org/ looks promising. Also, dead, but available in source form: http://wiki.openmoko.org/wiki/Gsmd . Obvious goal is to get some sort of 3G/4G working. I am not clear that Google actually open sourced any of the 3G drivers, or whether it has just provided the binary modules to link into the open source build. Most of this IPR for actual Wireless Baseband processors is tied up with a few companies like Qualcomm. Would be nice if Nokia would lend a hand with their N9 (or even N900) devices : http://www.developer.nokia.com/Devices/MeeGo/ and offer up the RIL libraries needed for full telephony support. Is there a reference device in mind for this research?

So, right now, we're just building on android because it's got the tools we need to hit the phone hardware. We're stripping dalvik off of that and just using gecko for the interface, which is why we're building things like this; so we can easily hit the kernel from gecko. We're definitely watching what other projects are doing, but right now we're mainly interested in getting a proof of concept going. Once that's done, we may dig a little more into how to implement this stuff completely ourselves.

That side, yes, we're mostly building on top of binary blobs and blindly trusting those right now (you can check out our extraction scripts, mostly cribbed from Cyanogenmod, at http://www.github.com/andreasgal/B2G). Not a situation we're super happy with, but it's all for the effort of making sure the idea and basis is sound first. :)

BTW, if you've got more questions about the project, it's probably best to bring them up on our dev mailing list: https://lists.mozilla.org/listinfo/dev-b2g - This github isn't really seen by a ton of people, while the mailing list has the whole team on it.

I still need to dig deeper on this, but for what I've seen on a first attempt, as you said before the 3G data communication starts with a REQUEST_SETUP_DATA_CALL to the ril, followed by the APN data (probably taken from /system/etc/apns-conf.xml):

 SETUP_DATA_CALL 1 0 airtelwap.es user@wap pass 3 IP

This command seems to be handled by the propietary driver, setting up the rmnet0 interface:

$ netcfg
lo       UP    127.0.0.1       255.0.0.0       0x00000049
rmnet0   UP    10.239.74.xx    255.255.255.0   0x000010d1
ifb0     DOWN  0.0.0.0         0.0.0.0         0x00000082
ifb1     DOWN  0.0.0.0         0.0.0.0         0x00000082
usb0     DOWN  0.0.0.0         0.0.0.0         0x00001002
sit0     DOWN  0.0.0.0         0.0.0.0         0x00000080
ip6tnl0  DOWN  0.0.0.0         0.0.0.0         0x00000080
cat /proc/net/route
Iface   Destination Gateway     Flags   RefCnt  Use Metric  Mask        MTU Window  IRTT                                                       
rmnet0  015C2E0A    00000000    0005    0   0   0   FFFFFFFF    0   0   0 
rmnet0  005C2E0A    00000000    0001    0   0   0   00FFFFFF    0   0   0 
rmnet0  00000000    015C2E0A    0003    0   0   0   00000000    0   0   0       

It also seems to write some system properties providing Android with the correct gateway, dns, etc. Can't see exactly where is all this setup done, but I am guessing it is done within the proprietary driver. The reference-ril.c shows some network configuration at requestSetupDataCall() function, but as far as I know it is for the G1 phone and may be different for any other device:

/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

A SETUP_DATA_CALL solicited response is sent from the propietary driver followed by the interface data.

SETUP_DATA_CALL {1, rmnet0, 10.239.74.48}
D/GSM     (  185): [GsmDataConnection-1] DcActivatingState msg.what=EVENT_SETUP_DATA_CONNECTION_DONE
D/GSM     (  185): [GsmDataConnection-1] interface=rmnet0 ipAddress=10.239.74.xx gateway=10.239.74.xx DNS1=212.166.210.80 DNS2=212.73.32.67
D/GSM     (  185): [GsmDataConnection-1] DataConnection setup result='SUCCESS' on cid=1
D/GSM     (  185): [GsmDataConnection-1] DcInactiveState: setEnterNoticationParams cp,cause
D/GSM     (  185): [GsmDataConnection-1] DcActiveState: enter notifyConnectCompleted
D/GSM     (  185): [GsmDataConnection-1] notifyConnection at 1320939632050 cause=No Error
qdot commented

Closing, more discussion happening at https://bugzilla.mozilla.org/show_bug.cgi?id=710493

qdot commented

Closing, more discussion happening at https://bugzilla.mozilla.org/show_bug.cgi?id=710493