Closed Bug 775028 Opened 12 years ago Closed 12 years ago

B2G-3G: RIL Data Call errors returned as positive values instead negative ones

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: frsela, Unassigned)

References

Details

RIL returns error codes for Data Call as positive values.

For example, the PDP_FAIL_DATA_REGISTRATION_FAIL (DATACALL_FAIL_DATA_REGISTRATION_FAIL on ril_consts.js) on Android's standard shall be -2, but the error returned on SETUP_DATA_CALL Parcel is 2 (positive) instead -2 (negative)

The returned parcel is:

07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: Received 16 bytes.
07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: Already read 0
07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: New incoming parcel of size 12
07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: Parcel (size 12): 0,0,0,0,61,0,0,0,2,0,0,0
07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: We have at least one complete parcel.
07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: Solicited response for request type 27, token 61, error 2
07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: Handling parcel as REQUEST_SETUP_DATA_CALL
07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: Next parcel size unknown, going to sleep.
(In reply to Fernando R. Sela from comment #0)
> 07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: Solicited response for
> request type 27, token 61, error 2

Isn't the 2 here means ERROR_GENERIC_FAILURE?

from ril.h

 * Valid errors:
 *  SUCCESS should be returned on both success and *failure* of setup with
 *  the RIL_Data_Call_Response_v6.status containing the actual status.

I think that might be something wrong in your code to call REQUEST_SETUP_DATA_CALL, ,otherwise at least I think the error in the log would be 0 here.
Then you still need to read the response in REQUEST_SETUP_DATA_CALL and parse
RIL_Data_Call_Response_v6.status to check the registration really succeeds or not 

How do you think about this?

Thanks
(In reply to Yoshi Huang[:yoshi][:allstars.chh] from comment #1)
> (In reply to Fernando R. Sela from comment #0)
> > 07-18 07:50:45.150 I/Gecko   ( 1835): RIL Worker: Solicited response for
> > request type 27, token 61, error 2
> 
> Isn't the 2 here means ERROR_GENERIC_FAILURE?
> 
> from ril.h
> 
>  * Valid errors:
>  *  SUCCESS should be returned on both success and *failure* of setup with
>  *  the RIL_Data_Call_Response_v6.status containing the actual status.
> 
> I think that might be something wrong in your code to call
> REQUEST_SETUP_DATA_CALL, ,otherwise at least I think the error in the log
> would be 0 here.
> Then you still need to read the response in REQUEST_SETUP_DATA_CALL and parse
> RIL_Data_Call_Response_v6.status to check the registration really succeeds
> or not 
> 
> How do you think about this?
> 
> Thanks

I'm not a RIL expert, but AFAIK, the error should be -2 since I'm forcing try to connect to an incorrect APN. The error returned on this parcel should be defined in RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE where the value 2 is not defined there

Also on ril.h:

RIL_Data_Call_Response_v6.status saild: A RIL_DataCallFailCause where is not defined any value as 2 (see line 366 to 406 of ril.h
blocking-basecamp: --- → ?
(In reply to Fernando R. Sela from comment #2)
> I'm not a RIL expert, but AFAIK, the error should be -2 since I'm forcing
> try to connect to an incorrect APN. 
Yes, I agree this.
but the question how do you plan to get -2, the error cause?

There are two sets of error code in ril.h

One is for general RIL, see RIL_Error, it's returned in *every* RIL request.

The other one is for specified error code, TS 24.008,
it's defined in RIL_DataCallFailCause

> The error returned on this parcel should
> be defined in RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE where the value 2 is not
> defined there
> 
No
The request you made is 
 request type 27, token 61, error 2
which is REQUEST_SETUP_DATA_CALL

If you want to get error cause, you should call RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE(56), (which is deprecated now), 
or you should try to parse what I said in comment 1.
(might be a little problem here since your request already got GENERIC_ERROR(2) now.)

Also you could see in ril_worker.js
the log you paste comes from Buf.processParcel,
and the 'error' you see, is from the prototype 'RIL_onRequestComplete' in ril.h, 
as you can see, the 2nd parameter is RIL_Errono.
(Also you can see in comment, if "e" != SUCCESS, then response can be null/is ignored
)
blocking-basecamp: ? → ---
I think Yoshi's reply is pretty clear for me. I'll mark this issue as INVALID.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
To be more detailed, in Android code, the error code value transition for SETUP_DATA_CALL is:

Exmpale 1: (RADIO_NOT_AVAILABLE)
RILConstants(1) -> CommandException.Error(1) -> DataConnection.FailCause(0x10001)
Example 2: (GENERIC_FAILURE)
RILConstants(2) -> CommandException.Error(2) -> DataConnection.FailCause.fromInt(response.status)

The `rilRequestError` and `DataConnection.FailCause` won't necessary have the same value. In Fernando's case, the real fail cause value depends on the value of `response.status`, not `rilRequestError`.

See frameworks/base/telephony/java/com/android/internal/telephony/{DataConnection,CommandException,RILConstants}.java
Thanks Vicamo. Now I'm trying to get this response correctly. Thanks for your time and sorry for the generated confusion ;)
You need to log in before you can comment on or make changes to this bug.