Hi Mike!

Yes, it is local-ip that needs to be passed back. What is in the other elements 
of response[]?

Output from logcat -b radio would be useful here - it tells something about 
what Android thinks is its connection.

Also, if you have an ip and can ping stuff from the shell, your apn is correct 
and the issue is Android only. Maybe test this?

- Henrik

--- Oprindelig besked ---
Fra: "M&M stich" <mstic...@gmail.com>
Emne: Re: Data connection via cell modem (GPRS)
Dato: 19. maj 2010
Klokkeslæt: 20:1635



Hi Henrik,
Thanks much for your help.  Got the data call up and running, seems stable. 
Seems like you just can't put the response[2] pointer into the property_get 
call for some reason. Thought I had it initialized large enough also.  Oh well.

Now the web browser seems to hang, log msgs indicate it gets no response when 
searching for a web site.  Looking into apn settings, and if we have the ip 
address correct.  You did say the local-ip should be passed back in the 
response to setup_data_call, correct?  Not the remote-ip?  Actually neither 
seems to work at this point.

Mike

On Tue, May 18, 2010 at 2:19 AM, Uhrenfeldt Henrik 
<henrik.uhrenfe...@ixonos.com<mailto:henrik.uhrenfe...@ixonos.com>> wrote:
Hi Mike,

I suspect I have had the same problems. I can see that I use a two-step 
solution to ensure that the string containing the IP is sufficiently big and 
does not get overwritten when the function exits (as would normally be the case 
with variables local to a function).

static char address_ip[PROPERTY_VALUE_MAX];

err = property_get("net.gprs.local-ip", address_ip ,"");
response[2] = address_ip;

I suppose that property_get writes more into the response[2] char* than 
initially allocated, OR response[2]'s area on the stack is used for something 
else immediately after the function exits...

- Henrik

-----Original Message-----
From: M&M stich [mailto:mstic...@gmail.com<mailto:mstic...@gmail.com>]
Sent: 17. maj 2010 22:50
To: Uhrenfeldt Henrik; android-porting
Subject: Re: Data connection via cell modem (GPRS)

Hi Henrik,
Removing all variables from the LOGD calls did not change anything.

After multiple experiments with the placement of LOGD's, I believe it is 
crashing whenever property_get is executed.  Can never get by that:

       len = property_get("net.gprs.local-ip",response[2], NULL);

I printed out response[0], [1], and [2], before this call and they look 
correct..
Mike


On Mon, May 17, 2010 at 8:06 AM, Uhrenfeldt Henrik 
<henrik.uhrenfe...@ixonos.com<mailto:henrik.uhrenfe...@ixonos.com>> wrote:


       Hi Mike,

       I still think the RIL crashes if you get the two lines:


              E/RILJ    (  929): Hit EOS reading message length
              I/RILJ    (  929): Disconnected from 'rild' socket


       The log message is confusing because the java process somehow finishes 
its ongoing function call through JNI when the lowlevel RIL crashes. If 
changing the invalid index did not do the trick, then we have to look for 
something else. Try modifying your debug line not to reference any variables at 
all - we need to make sure that RIL does not crash..

       Regarding the setting of local-ip in ip-down, I thought about the very 
same thing, but you end up in trouble waiting for local-ip being set if fx. ppp 
fails to initialize (this happens in my setup from time to time). In that case 
you need to wait for both ppp exit code AND local-ip. Thus I ended up making 
one single property which was being set from both ppp-init script (after PPP 
exit) as well as ip-up and ip-down.


       - Henrik

       -----Original Message-----
       From: M&M stich [mailto:mstic...@gmail.com<mailto:mstic...@gmail.com>]

       Sent: 17. maj 2010 14:57
       To: Uhrenfeldt Henrik; android-porting
       Subject: Re: Data connection via cell modem (GPRS)

       Yes, I noticed that shortly after I sent the message.  Fixing it did not 
change anything.

       It appears that readRilMessage in RIL.java is executing before the 
response is sent.  I don't understand why this should happen.

       I was going to clear the net.gprs.local-ip property in the ip-down 
script so that it would work multiple times.  Then it could be reset in the 
ip-up script like it currently is.  Would that not work similarly to another 
property?

       Thanks much for the help.
       Mike


       On Mon, May 17, 2010 at 2:27 AM, Uhrenfeldt Henrik 
<henrik.uhrenfe...@ixonos.com<mailto:henrik.uhrenfe...@ixonos.com>> wrote:


              Hi Stich,

              Please keep the list on copy - then everybody will learn from 
this :-)

              Anyway, I think your problem is in the line:


              LOGD(" --- PPPD started successfully; IP local : %s  Retry count 
: %d",response[3],retry);


              In fact response[] is only three elements big, and you refer to 
index 3 instead of 2. I bet the code successfully exits the loop and attempts 
to execute the debug print, hits a NULL pointer and the low-level part of RIL 
crashes. This is confirmed by the debug lines


              E/RILJ    (  929): Hit EOS reading message length
              I/RILJ    (  929): Disconnected from 'rild' socket


              I have crashed the low-level RIL many times, and every time I get 
this message :-)

              I bet that if you change response[3] to response[2] it will be 
working. That being said this will work only once, since next time you attempt 
connection, local-ip will be set already. I introduced yet another property 
which I set to a kind of state information (ie. down/initializing/up). Again 
this synchronization through properties really is the worst part of this setup, 
and I have been able to stabilize it 100%...

              - Henrik


              -----Original Message-----
              From: M&M stich 
[mailto:mstic...@gmail.com<mailto:mstic...@gmail.com>]
              Sent: 14. maj 2010 21:44
              To: Robert Greenwalt; Uhrenfeldt Henrik
              Subject: Data connection via cell modem (GPRS)

              Made some progress.  When SETUP_DATA_CALL is called, my ril 
starts the pppd via ctl.start, and that seems to work.  The deamon does seem to 
start and the associated properties seem to be set. (Doing a "start service" 
from the console works)   I've put log messages at each step, when it starts, 
when it waits for the local-ip property to be set (which is set in ip-up), when 
that completes, and when it does the RilRequestComplete call.

              It never gets  to the end.  RIL.java seems to think it has a 
response  before the request completes, then errors out because it reached 
"EOS"   Here is a snippet of the radio logcat.  Messages that have "---" are 
ones I put in the reference-ril in the SETUP_DATA_CALL.  There should be the 4 
mentioned above.  It never finishes the wait for the local-ip property.

              I can't figure out why RIL.java thinks it should go read a 
response before there has been a reply to the request.
              Thanks.
              Mike
              ------------------------------------------------------------------
              D/GSM     (  929): [GsmSimCard] Broadcasting intent 
SIM_STATE_CHANGED_ACTION LOADED reason null
              D/GSM     (  929): Get PreferredAPN
              D/GSM     (  929): [GsmDataConnectionTracker] ***trySetupData due 
to simLoaded
              D/GSM     (  929): [DSAC DEB] trySetupData with 
mIsPsRestricted=false
              D/GSM     (  929): [GsmDataConnectionTracker] Create from allApns 
: [ATT, 1, 310410, wap.cingular,  
wireless.cingular.com<http://wireless.cingular.com>, http://mmsc.cingular.com, 
null, null, 80, *]
              D/GSM     (  929): [GsmDataConnectionTracker] Setup watingApns : 
[ATT, 1, 310410, wap.cingular,  
wireless.cingular.com<http://wireless.cingular.com>, http://mmsc.cingular.com, 
null, null, 80, *]
              D/GSM     (  929): [PdpConnection] DataConnection.getState()
              D/GSM     (  929): [PdpConnection] Connecting to carrier: 'ATT' 
APN: 'wap.cingular' proxy: ' 
wireless.cingular.com<http://wireless.cingular.com>' port: '80
              D/RILJ    (  929): [0060]> SETUP_DATA_CALL wap.cingular
              D/RIL     (  811): onRequest: SETUP_DATA_CALL
              D/RIL     (  811): requesting data connection to APN 
'wap.cingular'
              D/RIL     (  811):  ---- Starting service pppd_gprs -----
              D/RIL     (  811):  ---- starting wait for property -----  prop 
set return code is 0
              D/GSM     (  929): [GsmDataConnectionTracker] setState: INITING
              E/RILJ    (  929): Hit EOS reading message length
              I/RILJ    (  929): Disconnected from 'rild' socket

              Here is the code:
                     err = property_set("ctl.start","pppd_gprs");    // Tell 
init to start the pppd_gprs service
                     LOGD(" ---- Starting service pppd_gprs ----- ");
                     if(err<0)
                     {
                         LOGD("####  error in starting service pppd_gprs;  err 
:  %d",err);
                         goto error;
                     }
                     retry = 100;
                     LOGD(" ---- starting wait for property -----  prop set 
return code is %d",err);
                     while((property_get("net.gprs.local-ip",response[2], "") 
<= 0) && --retry)
                     {
                         usleep(5*1000);        // sleep 5ms
                     }

                     LOGD(" --- PPPD started successfully; IP local : %s  Retry 
count : %d",response[3],retry);
                     ......
                 LOGD(" --- Returning from setup data call, response length is 
%d",sizeof(response));
                 RIL_onRequestComplete(t, RIL_E_SUCCESS, response, 
sizeof(response));












-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

Reply via email to