在 logcat -b radio 日志中,出现这样的错误信息:
// 停止pppd
I/RIL ( 2595): [wait_for_property]:init.svc.pppd_gprs return 0!
I/RIL ( 2595): [wait_for_property]:init.svc.pppd_gprs return 0!
I/RIL ( 2595): [kill_PPP]: stop the pppd_gprs OK at 5
D/RIL ( 1545): killall pppd finished
// Deactivated PDP
I/AT ( 1545): AT+CGACT=0,1 timeoutMsec:15000
D/AT ( 1545): [AT send -->> MT] AT+CGACT=0,1
D/AT ( 1545): [AT Receive <<-- TE] OK
// Disconnect Existing Connection
I/AT ( 1545): ATH timeoutMsec:3000
D/AT ( 1545): [AT send -->> MT] ATH
D/AT ( 1545): [AT Receive <<-- TE] OK
// Define PDP Context
I/AT ( 1545): AT+CGDCONT=1,"IP","3gnet" timeoutMsec:3000
D/AT ( 1545): [AT send -->> MT] AT+CGDCONT=1,"IP","3gnet"
D/AT ( 1545): [AT Receive <<-- TE] OK
// 以下错误信息
D/RILJ ( 2060): [0115]> SIGNAL_STRENGTH
I/RIL ( 1545): [wait_for_property]:net.ppp0.local-ip return -1!
E/RIL ( 1545): [requestSetupDataCall]: wait for IP from ppp link at 5
D/RILJ ( 2060): [0116]> SIGNAL_STRENGTH
I/RIL ( 1545): [wait_for_property]:net.ppp0.local-ip return -1!
E/RIL ( 1545): [requestSetupDataCall]: wait for IP from ppp link at 4
I/RIL ( 1545): [wait_for_property]:net.ppp0.local-ip return -1!
E/RIL ( 1545): [requestSetupDataCall]: wait for IP from ppp link at 3
I/RIL ( 1545): [wait_for_property]:net.ppp0.local-ip return -1!
E/RIL ( 1545): [requestSetupDataCall]: wait for IP from ppp link at 2
I/RIL ( 1545): [wait_for_property]:net.ppp0.local-ip return -1!
E/RIL ( 1545): [requestSetupDataCall]: wait for IP from ppp link at 1
E/RIL ( 1545): [requestSetupDataCall]: fail to get IP
分析 android/hardware/ril/reference-ril/reference-ril.c
/* start the gprs pppd */
property_set(PPPD_EXIT_CODE, "");
property_set("net.ppp0.local-ip", "");
property_set("ctl.start", "pppd_gprs");
sleep(3); // sleep to wati pppd finish
// retry 5 time to wait the ip from ppp link
// it will be failed to get the ip or the pppd exit
while(iRetry > 0)
{
property_get(PPPD_EXIT_CODE, exit_code, "");
if(strcmp(exit_code, "") != 0) {
LOGE("PPPd exit with code %s", exit_code);
iRetry = 0;
break;
}
if (wait_for_property("net.ppp0.local-ip", NULL, 10) < 0) {
LOGE("[%s]: wait for IP from ppp link at %d\n", __func__, iRetry);
}
else
{
LOGI("[%s]: got IP from ppp link\r\n", __func__);
break;
}
iRetry--;
}
if(iRetry <= 0)
{
LOGE("[%s]: fail to get IP\r\n", __func__);
goto error;
}
问题应该出在 pppd_gprs 没有启动,用ps 查看没发现该服务。