Closed Bug 952386 Opened 6 years ago Closed 6 years ago

[wasabi][CDMA] UIM card can only be detected after flashing build and once reboot device, UIM can't be detected.

Categories

(Firefox OS Graveyard :: RIL, defect)

x86_64
Gonk (Firefox OS)
defect
Not set

Tracking

(blocking-b2g:1.3+, firefox27 wontfix, firefox28 fixed, firefox29 fixed, b2g-v1.3 fixed, b2g-v1.4 fixed)

VERIFIED FIXED
1.3 C3/1.4 S3(31jan)
blocking-b2g 1.3+
Tracking Status
firefox27 --- wontfix
firefox28 --- fixed
firefox29 --- fixed
b2g-v1.3 --- fixed
b2g-v1.4 --- fixed

People

(Reporter: echu, Assigned: edgar)

References

Details

(Keywords: regression, Whiteboard: [FT:RIL])

Attachments

(2 files)

Attached file wasabi-nosim.txt
After flash build, UIM card can be detected. But once reboot device, it will always fail to detect the UIM.

* Build Number     
Wasabi -           
Gaia      a9b942c98a09eed626104e6509a4ba4f50842231
Gecko     bdc10edc8a2d48bba8a2ff011974309a4158bba4
BuildID   20131220100118
Version   29.0a1

* Reproduce Steps
1. Flash build.
2. Reboot device.

* Expected Result
UIM can still be detected.

* Actual Result
UIM cannot be detected.

* Occurrence rate
100%
Blocks: 913326
Wasabi v1.2 has no such bug. It is found from v1.3.

Gaia      5772ee76645417b96b0b168f2f0845716be4bff2
Gecko     ba8ed3a7473b95eb988c8c0565b193131901e6b7
BuildID   20131220131837
Version   28.0a2

Nominate as 1.3 blocker first.
blocking-b2g: --- → 1.3?
blocking-b2g: 1.3? → 1.3+
Keywords: regression
I found that the device could detect the UIM card after enabling and the disabling the airplane mode.
(In reply to Enpei from comment #0)
> Created attachment 8350459 [details]
> wasabi-nosim.txt

Hmm, from the log, radio becomes to 'off', that is why device can not detect UIM card.

01-24 09:59:35.870 I/Gecko   (  200): RIL Worker[0]: Handling parcel as UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED
01-24 09:59:35.870 I/Gecko   (  200): RIL Worker[0]: Radio state changed from 'ready' to 'off'
01-24 09:59:35.870 I/Gecko   (  200): -*- RadioInterface[0]: Received message from worker: {"rilMessageType":"radiostatechange","radioState":"off"}
01-24 09:59:35.870 I/Gecko   (  200): -*- RILContentHelper: Received message 'RIL:RadioStateChanged': {"clientId":0,"data":"disabled"}
(In reply to Edgar Chen [:edgar][:echen] from comment #3)
> (In reply to Enpei from comment #0)
> > Created attachment 8350459 [details]
> > wasabi-nosim.txt

I think we have a racing issue between handling radio state and processing radio enable/disable request.

1). After receiving system-message-listener-ready, RadioInterface will enable radio by default. [1]
------------
01-24 09:59:28.803 I/Gecko   (  200): RIL Worker[0]: Received chrome message {"enabled":true,"rilMessageToken":6,"rilMessageType":"setRadioEnabled"}
01-24 09:59:28.803 I/Gecko   (  200): RIL Worker[0]: New outgoing parcel of type 23
01-24 09:59:28.803 I/Gecko   (  200): RIL Worker[0]: Outgoing parcel: 0,0,0,16,23,0,0,0,3,0,0,0,1,0,0,0,1,0,0,0


2). Received UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED, ril_woker will disable radio if the |_isInitialRadioState| is true [2].
------------
01-24 09:59:30.665 I/Gecko   (  200): RIL Worker[0]: Handling parcel as UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED
01-24 09:59:30.665 I/Gecko   (  200): RIL Worker[0]: New outgoing parcel of type 23
01-24 09:59:30.665 I/Gecko   (  200): RIL Worker[0]: Outgoing parcel: 0,0,0,16,23,0,0,0,5,0,0,0,1,0,0,0,0,0,0,0
01-24 09:59:30.665 I/Gecko   (  200): RIL Worker[0]: Radio state changed from 'null' to 'off'


3). Received UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED with 'ready' state (I guess it is from 1)).
----------
01-24 09:59:30.975 I/Gecko   (  200): RIL Worker[0]: Handling parcel as UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED
01-24 09:59:30.975 I/Gecko   (  200): -*- RadioInterface[0]: Ignore orphan token: 6
01-24 09:59:30.975 I/Gecko   (  200): RIL Worker[0]: New outgoing parcel of type 23
01-24 09:59:30.985 I/Gecko   (  200): RIL Worker[0]: Outgoing parcel: 0,0,0,16,23,0,0,0,6,0,0,0,1,0,0,0,0,0,0,0
01-24 09:59:30.985 I/Gecko   (  200): RIL Worker[0]: Radio state changed from 'off' to 'ready'

4). Received enable request from content, but this request will not be performed due to the |detailedRadioState| is 'enabled' at that time. [3]
--------
01-24 09:59:31.045 I/Gecko   (  200): -*- RadioInterfaceLayer: Received 'RIL:SetRadioEnabled' message from content process
01-24 09:59:31.045 I/Gecko   (  200): -*- RadioInterfaceLayer: setRadioEnabled: receiveMessage: {"target":{},"name":"RIL:SetRadioEnabled","sync":false,"json":{"clientId":0,"data":{"requestId":"id{767362ed-d8de-44b2-af72-a3705c5b3bd9}","enabled":true}},"data":{"clientId":0,"data":{"requestId":"id{767362ed-d8de-44b2-af72-a3705c5b3bd9}","enabled":true}},"objects":{}}
01-24 09:59:31.045 I/Gecko   (  200): -*- RadioInterfaceLayer: setRadioEnabled: handleMessage: {"target":{},"name":"RIL:SetRadioEnabled","sync":false,"json":{"clientId":0,"data":{"requestId":"id{767362ed-d8de-44b2-af72-a3705c5b3bd9}","enabled":true}},"data":{"clientId":0,"data":{"requestId":"id{767362ed-d8de-44b2-af72-a3705c5b3bd9}","enabled":true}},"objects":{}}

So that finally radio is disabled.

[1] http://goo.gl/DgqqKX
[2] http://goo.gl/Ncx8Yt
[3] http://goo.gl/ujEEhz
(In reply to Edgar Chen [:edgar][:echen] from comment #4)
> 
> 2). Received UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED, ril_woker will
> disable radio if the |_isInitialRadioState| is true [2].
|_isInitialRadioState| was introduced in bug 775375 to reset radio after B2G restart.
Currently most of logic to control/maintain radio state is in RadioInterfaceLayer/gRadioEnabledController, maybe we should consider to integrate |_isInitialRadioState| things into RadioInterfaceLayer/gRadioEnabledController as well.

* Note: We need to be careful about the timing between initialization and sending request. (Please see bug 849758 comment #14)

> 
> 4). Received enable request from content, but this request will not be
> performed due to the |detailedRadioState| is 'enabled' at that time. [3]
>
It seems if we drop the request in above situation, we may have synchronization issue.
To me, there are two possible solution for this:
1). Process all request instead.
2). Keep the last enabled/disabled request, and make sure the radio status will match with the last request. something like |_ensureRadioState()|[1] that we had before.

[1] http://hg.mozilla.org/mozilla-central/annotate/657afaa2c756/dom/system/gonk/RadioInterfaceLayer.js#l1497
Assignee: nobody → echen
Whiteboard: [FT:RIL]
PM assessment: Need to block for 1.3.
After did more analysis, I found the key of the issue was caused by the initialization process of ril_worker and gRadioEnabledController.
1). ril_worker will try to disable radio power if |_isInitialRadioState| is true.
2). gRadioEnabledController will try to enable radio power by default.

Above two actions cause some timing problems (please see comment #4) and seems only happened in wasabi.
(I have tested with other device, but I did not encounter this issue)

Here is the solution I proposed:
1). Remove the initialization process of radio power in ril_worker.
2). Disable radio power by default in gRadioEnabledController.

With above solution, we can remove some redundant radio control to avoid timing issue caused by two different module and also can reset radio after b2g restart same as we have now.
(In reply to Edgar Chen [:edgar][:echen] from comment #7)
> After did more analysis, I found the key of the issue was caused by the
> initialization process of ril_worker and gRadioEnabledController.
> 1). ril_worker will try to disable radio power if |_isInitialRadioState| is
> true.
> 2). gRadioEnabledController will try to enable radio power by default.
> 
> Above two actions cause some timing problems (please see comment #4) and
> seems only happened in wasabi.
> (I have tested with other device, but I did not encounter this issue)
> 
> Here is the solution I proposed:
> 1). Remove the initialization process of radio power in ril_worker.
> 2). Disable radio power by default in gRadioEnabledController.
After offline discuss with Hsinyi, it seems better to handle radio power initialization right after received UNSOLICITED_RIL_CONNECTED rather than handle it in gRadioEnabledController.
I will try this first.
Thank you.

> 
> With above solution, we can remove some redundant radio control to avoid
> timing issue caused by two different module and also can reset radio after
> b2g restart same as we have now.
Attached patch Patch, v1Splinter Review
See Also: → 961918
Comment on attachment 8362841 [details] [diff] [review]
Patch, v1

I tested this patch with unagi, wasabi and fugu. All of them work well. Thank you.
Attachment #8362841 - Flags: review?(htsai)
Comment on attachment 8362841 [details] [diff] [review]
Patch, v1

Review of attachment 8362841 [details] [diff] [review]:
-----------------------------------------------------------------

Good to see we remove more redundant code! Thank you.

I also test with Buri and it works well. :)
Attachment #8362841 - Flags: review?(htsai) → review+
Attachment #8362841 - Attachment description: WIP, patch v1 → Patch, v1
Target Milestone: --- → 1.3 C3/1.4 S3(31jan)
https://hg.mozilla.org/mozilla-central/rev/9e318ecba7e7
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Duplicate of this bug: 961918
See Also: → 963054
The original bug is fixed, yet there is another bug that after reboot device, there is about 10 seconds, device will still show no UIM card before detect it and camp on network. This is not found on v1.2 before, I will file another bug for it.

Verified on Wasabi:
Gaia      6fbeac2415f07f10de181f0877ddf67ee299b885
Gecko     086e69971516130ad297c7f950dfb42a995217e9
BuildID   20140123182629
Version   28.0a2
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.