Android 3G pppd debugging records.

Source: Internet
Author: User

Android 3G pppd debugging records.

1. Java Section
Android/development/data/etc/apns-conf_sdk.xml ---> system/etc/apns-conf.xml
Note the apns version,
<Apns version = "6">
<APN carrier = "China Unicom 3G network (China Unicom )"
APN = "3 GNET"
MCC = "460"
MNC = "01"
Proxy = ""
Port = ""
User = ""
Server = ""
Password = ""
Type = "default, supl"
/>
</Apns>

Android/packages/providers/telephonyprovider/src/COM/Android/providers/telephony/telephonyprovider. Java
File:
Public void oncreate (sqlitedatabase dB)
Created based on system/etc/apns-conf.xml
/Data/COM. Android. providers. telephony/databases/telephony. DB

Pppd depends on the APN provided by telephony when dialing.

2. drvier section.
My 3G module is Moto's htm1000, USB interface. The 3g driver is simply a USB-to-serial drive.
The module provides two tty devices, one for sending AT commands and the other for dialing pppd.

3. Part C.
CD Android/hardware/RIL/

3.1. Let's talk about rild/radiooptions. C first.
This is a test program,
Perror ("Usage: radiooptions [Option] [extra_socket_args]/n/
0-radio_reset,/n/
1-radio_off,/n/
2-unsol_network_state_change,/n/
3-qxdm_enable,/n/
4-qxdm_disable,/n/
5-radio_on,/n/
6 APN-setup_pdp APN,/n/
7-deactive_pdp,/n/
8 number-dial_call number,/n/
9-answer_call,/n/
10-end_call/N ");
}
It can be used to test the call.

Option 6 can be used to test pppd dialing.

3.2 rild/rild. c
If you have permission issues, you can directly modify init. RC to grant rild root permission.

The main function reads Android. RIL = from/proc/cmdline to determine the tty device name.
So you don't have to worry about it. Just write your own device name.
Arg_overrides [1] = "-d ";
Arg_overrides [2] = "/dev/ttymot1 ";

3.3 reference-RIL/reference-ril.c
For more information about the dialing process, see.
Asprintf (& cmd, "At + cgact = 0, % d", s_defultpdpcid );
Err = at_send_command (CMD, null );
Free (CMD );

Asprintf (& cmd, "At + cgdcont = % d,/" IP/",/" % S/", 0, 0", s_defultpdpcid, APN );
Err = at_send_command (CMD, null );
Free (CMD );
It is also equivalent to sending: 'At + cgdcont = 1 "ip", "3 GNET", 0, 0'
This is important,
The next step is to send "ATD * 99 *** 1 #", but my situation is weird,
You can use/dev/ttymot0 to succeed and pppd to succeed, but you cannot use/dev/ttymot1 to succeed ..
You have to make/dev/ttymot1 the interface used by rild.
/Dev/ttymot0 serves as the pppd interface, and "ATD * 99 *** 1 #" is sent by/dev/ttymot0, so you have to port another chat.
Next:
Property_set ("net. pp1_status", "0 ");
Asprintf (& cmd, "/system/bin/pppd connect '/system/bin/chat-esvf/system/etc/talk. chat 'user % s password % S/dev/ttymot0 115200 crtscts modem novj noipdefault nobsdcomp usepeerdns defaultroute noauth debug nodetach dump & ", (username = NULL )? "Any": username, (Password = NULL )? "Any": password );
Err = System (CMD );
Logd ("launch: % s and RET is: % d! ", CMD, err );
Free (CMD );

/* Wait for system update property */
For (iretry = 0; iretry <ppp_retry; iretry ++)
{
Sleep (2 );
Property_get ("net. pp1_status", pppstatus, null );
Logd ("net. pp1_status = % s/n", pppstatus );
If (atoi (pppstatus)> 0)
Break;
}

Since pppd does not return immediately, you have to modify pppd. If the connection is successful
Property_set ("net. pp1_status", "1 ");

# Cat/system/etc/talk. Chat
Abort 'busy'
Abort 'no ancer'
Abort 'error'
Timeout 20
'''Atz'
OK atdt * 99 *** 1 #
Connect ""

After successful pppd connection, the gateway and DNS will be set.

 

In addition, by default, the dial-up Internet access function is enabled for Android. However, some mobile phones have been switched.

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.