Closed Bug 1055380 Opened 11 years ago Closed 11 years ago

[Tarako]Sometimes UI doesn't get updated correctly after switching between two APs several times

Categories

(Firefox OS Graveyard :: Wifi, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zhenqing.liu, Assigned: chucklee)

Details

(Whiteboard: [sprd343462])

Attachments

(4 files, 6 obsolete files)

57.69 KB, application/x-bzip
Details
5.07 KB, patch
Details | Diff | Splinter Review
4.76 KB, patch
Details | Diff | Splinter Review
4.82 KB, patch
Details | Diff | Splinter Review
STR: 1. Connect to one AP. 2. Connect to another AP in the list. 3. Reconnect to the first AP and then the second one. 4. Repeat Step 3 and sometimes UI will not show the right connection state.
When this bug appears, the wpa_supplicant has connected to AP but UI doesn't get updated correctly. I have checked with our supplicant engineer. Root cause is gecko only use |AP_SCAN 1| to control supplicant. So supplicant will try to connect to other available APs according to its own policy. And when someone taps the same AP which supplicant is trying to connect to, this bug will probably come out.
Whiteboard: [sprd343462]
Can't reproduce on flame 2.1, I think set AP_SCAN to 1 have nothing to do with such issue. The cause described in comment 1 also doesn't match the STR, wpa_supplicant shouldn't trigger auto connection while it's already connecting to an AP.
According to our supplicant engineer, only setting AP_SCAN to 2 after connection can stop supplicant from trying to connect to another AP. If we only set AP_SCAN to 1 and tap the same AP supplicant trying to connect to, |CTRL-EVENT-STATE-CHANGE id=-1 state=0| related to the tapping will not be notified. So gecko state machine will not get updated and UI will not get updated accordingly. I comment out these lines in WifiWorker.js if (manager.state === "COMPLETED" && fields.state !== "DISCONNECTED" && fields.state !== "INTERFACE_DISABLED" && fields.state !== "INACTIVE" && fields.state !== "SCANNING") { return false; } and give the patch to our custom, the bug never appears.
Attached file logs
Bug appeared at the last connection.
I don't think its related to value of AP_SCAN. It seems to be the reassociate mechanism is triggered, by ENABLE_NETWORK or RECONNECT or both, makes wpa_supplicant tend to connect to network with higher priority(Phone-WIFI is 8 while cisco2.4G is 10). WifiWorker seems to prevent this behavior by giving highest priority to the network assigned to connect by API, but the log shows different. I think the root cause is priority management, and will check how to fix it. On the other hand, the reassociate behavior is not taken into consideration in current state machine. We need to support such state transition, instead of comment out the state transition check.
I was just trying to make a workaround. The perfect solution still relies on you.
|network.priority| should be integer type but is read as string type in |getNetworkConfiguration()|, and leads to wrong highest priority value because the comparison in |_reloadConfiguredNetworks()|[1] will be compared based on string type instead of integer. Now we provide type information for each network config field, and cast them into correct type upon read. So we can get correct highest priority value and resolve value issue described in comment 5. [1] http://hg.mozilla.org/mozilla-central/file/cd2acc7ab2f8/dom/wifi/WifiWorker.js#l2521
Attachment #8477255 - Flags: review?(hchang)
(In reply to Chuck Lee [:chucklee] from comment #7) > Created attachment 8477255 [details] [diff] [review] > Cast network configs into correct data type. > > |network.priority| should be integer type but is read as string type in > |getNetworkConfiguration()|, and leads to wrong highest priority value > because the comparison in |_reloadConfiguredNetworks()|[1] will be compared > based on string type instead of integer. > Now we provide type information for each network config field, and cast them > into correct type upon read. So we can get correct highest priority value > and resolve value issue described in comment 5. > > [1] > http://hg.mozilla.org/mozilla-central/file/cd2acc7ab2f8/dom/wifi/WifiWorker. > js#l2521 I am positive to tagging type info to the parsing table. Just want to know if it would be easier to parse to integer before comparison? Not sure if there's anything I am not aware of. If you choose to parse to integer before comparison, we'd better of using |network.hasOwnProperty('priority')| rather than if (network.priority && ...) at [1] since the falsy |network.priority| 0 may still be meaningful. Thanks! [1] http://hg.mozilla.org/mozilla-central/file/cd2acc7ab2f8/dom/wifi/WifiWorker.js#l2521
Flags: needinfo?(chulee)
(In reply to Henry Chang [:henry] from comment #8) > (In reply to Chuck Lee [:chucklee] from comment #7) > > Created attachment 8477255 [details] [diff] [review] > > Cast network configs into correct data type. > > > > |network.priority| should be integer type but is read as string type in > > |getNetworkConfiguration()|, and leads to wrong highest priority value > > because the comparison in |_reloadConfiguredNetworks()|[1] will be compared > > based on string type instead of integer. > > Now we provide type information for each network config field, and cast them > > into correct type upon read. So we can get correct highest priority value > > and resolve value issue described in comment 5. > > > > [1] > > http://hg.mozilla.org/mozilla-central/file/cd2acc7ab2f8/dom/wifi/WifiWorker. > > js#l2521 > > I am positive to tagging type info to the parsing table. > Just want to know if it would be easier to parse to integer before > comparison? Not sure if there's anything I am not aware of. I think it's more programmer-friendly to provide data in expected type for later use, and prevent cause bug like this one if programmer forget to do the cast. > If you choose to parse to integer before comparison, we'd better > of using |network.hasOwnProperty('priority')| rather than > if (network.priority && ...) at [1] since the falsy |network.priority| 0 > may still be meaningful. > > Thanks! Thank you for pointing this out!
Flags: needinfo?(chulee)
Address comment 8 and fix a priority re-prioritize bug found while testing.
Attachment #8477255 - Attachment is obsolete: true
Attachment #8477255 - Flags: review?(hchang)
Attachment #8478941 - Flags: review?(hchang)
Comment on attachment 8478941 [details] [diff] [review] Cast network configs into correct data type. V2 Review of attachment 8478941 [details] [diff] [review]: ----------------------------------------------------------------- This looks good and have no other concerns. Thanks!
Attachment #8478941 - Flags: review?(hchang) → review+
Hi Chuck, I have tried this patch on v1.3t and Wifi can't connect to AP. This line will be printed from |adb logcat|. 08-28 05:54:36.110 E/GeckoConsole( 86): [JavaScript Error: "configured is undefined" {file: "jar:file:///system/b2g/omni.ja!/components/WifiWorker.js" line: 2789}] Could you help give a patch on v1.3t?
Flags: needinfo?(chulee)
Patching to v1.4 will have the same result as v1.3t .
Fix error reported in comment 12.
Attachment #8478941 - Attachment is obsolete: true
Flags: needinfo?(chulee)
Fix type of configuration "disabled"
Attachment #8480446 - Attachment is obsolete: true
Hi Chuck, Glad to see WIFI can connect to AP normally with the new patch. But there is still a problem. Touch |search again| button after connecting to an AP and we will get the following error from |adb logcat|: 08-29 01:56:17.260 E/GeckoConsole( 86): [JavaScript Error: "priority is not defined" {file: "jar:file:///system/b2g/omni.ja!/components/WifiWorker.js" line: 2289}] Related source line: if (network.hasOwnProperty(priority) && Scan command will not be dispatched to supplicant. So UI keep saying"Seatching". Same problem on v1.3t and v1.4.
Flags: needinfo?(chulee)
Assignee: nobody → chulee
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: