Android platform development-3G Function porting-3G function Transplantation

Source: Internet
Author: User

1. pppd-Related Files

Android RIL-related code and scripts mainly include:
Android/hardware/RIL/reference_ril/(reference_ril.c)
Android/hardware/RIL/rild
Android/extern/PPP/pppd
Android/extern/PPP/chat
Android/data/etc/apn-conf-sdk.xml
Android/system/CORE/rootdir/etc/PPP/init. GPRS-pppd
Android/system/CORE/rootdir/etc/PPP/peers/cmnet
Android/system/CORE/rootdir/etc/PPP/chat/CMTC-ISP
Android/vendor/XXXXX/xxxx/system. Prop

1. reference_ril.c: Some AT commands of RIL are operated through some onrequest interfaces. For different hardware

Some modifications and adjustments.

2, apn-conf-sdk.xml: Below is an example, some do not support the APN, you need to add it, otherwise the log will appear in the class: No APN found for carrier: 46xxx, the error. Generally, the moving td usim is 46007, and some are 46000.
<Apns version = "6">
<APN carrier = "android"
MCC = "310"
MNC = "995"
APN = "Internet"
User = "*"
Server = "*"
Password = "*"
Mmsc = "null"
/>
<APN carrier = "telkila"
MCC = "310"
MNC = "260"
APN = "Internet"
User = "*"
Server = "*"
Password = "*"
Mmsc = "null"
/>
<APN carrier = "CMCC"
MCC = "460"
MNC = "00"
APN = "cmnet"
User = "*"
Server = "*"
Password = "*"
Mmsc = "null"
/>
<APN carrier = "China Mobile"
MCC = "460"
MNC = "07"
APN = "cmnet"
User = "*"
Server = "*"
Password = "*"
Mmsc = "null"
/>
</Apns>

3. init. GPRS-pppd: Call the initialization script of pppd GPRS dialing.
Pppd_pid =
/System/bin/setprop "net. GPRS. PPP-Exit """
/System/bin/log-T pppd "Starting pppd"

/System/xbin/pppd call cmnet $ * // call the script/system/etc/peers/cmnet
Or
/System/xbin/pppd connect 'chat-V "at" "atdt #777 connect" 'user/card password card/dev/ttyusb2 115200 nodetach crtscts/debug usepeerdns defaultroute
// Directly use the parameter, where/dev/usb2 is the control port.
Pppd_exit = $?
Pppd_pid = $!
/System/bin/log-T pppd "pppd exited with $ pppd_exit"
/System/bin/setprop "net. GPRS. PPP-Exit" "$ pppd_exit" 4. cmnet: pppd dialing option script:
/Dev/ttyusb3
921600
Nocrtscts
Nocdtrcts
Local
Usepeerdns
Defaultroute
Noipdefault
Ipcp-Accept-Local
Ipcp-Accept-remote
User cmnet
Password cmnet
Lock
Nodetach
Connect "/system/xbin/chat-v-T 50-F/system/etc/PPP/chat/CMTC-ISP" 5. CMTC-ISP:
Abort 'busy'
Abort 'no carrier'
Abort 'error'
Abort '+ CME error: 100'
""
OK at + cgdcont = 1, "ip", "cmnet"
OK at + cgeqreq = 128,384, "0e0", "0e0 ",
OK
OK
OK ats0 = 0
OK
OK
OK atdt * 98*1 #
Connect if you want to connect to China Unicom's WCDMA, use
OK at + cgdcont = 1, "ip", "3 GNET"
OK atdt * 99 # // dialing command

6. system. Prop:
Rild. libpath =/system/lib/libreference-ril.so
Rild. libargs =-D/dev/ttys0
Wifi. Interface = eth1 2. RIL configuration supports RIL implemented through pppd in Android. To start pppd, add the following in init. RC:
Service pppd_gprs/system/etc/init. GPRS-pppd
User Root
Group radio cache Inet Misc
Disabled
Oneshot
Service RIL-daemon/system/bin/rild-L/system/lib/libreference-ril.so ---D/dev/ttyusb3-U/dev/ttyusb0
Socket rild stream 660 root radio
Socket rild-Debug stream 660 Radio System
User Root
Group radio cache Inet MISC audio

The modem is inserted into the USB port to simulate the serial port. The driver detects two serial ports. One is controlled and the other is data.
Here/dev/ttyusb3 indicates the control port. 3. RIL process analysis after pppd is started on the server, if the modem is detected (determined by the/dev/ttyusb * device), pppd_gprs daemon calls the init. GPRS-pppd connection,
After normal communication, a 3G network connection flag is displayed.
Then set the APN. After saving the settings, restart the system and the system will automatically connect to the Internet. 4. Manually test the 3G modem

1. Load the driver
If the driver is loaded successfully, the/dev/ttyusb * device will appear.

2. Go to the/etc/PPP/peers directory and run
Pppd call cmnet &

Here, cmnet is a file containing dialing commands. 3. Set DNS
Copy/etc/PPP/resolv. conf automatically generated by pppd to/etc/resolv. conf.

4. If all of the preceding operations are successful, ping the network.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.