OSDN Git Service

Wi-Fi HAL: fix supplicant start failed issue
authorjiaguo <jiaguo@marvell.com>
Thu, 13 Mar 2014 10:49:14 +0000 (18:49 +0800)
committerjiaguo <jiaguo@marvell.com>
Thu, 13 Mar 2014 10:49:14 +0000 (18:49 +0800)
commit4431a1c34d1a9c36b7251217a2783d09ee1a7ac3
treed9698b8e14910cc14555b682e9410327050bd33e
parentc32be36fd0981685cc9c33d32ae9babc466e6ae2
Wi-Fi HAL: fix supplicant start failed issue

init.svc.*(hostapd, p2p_supplicant) properties are set when starting
STA or uAP via Wi-Fi HAL, after sending ctrl.start command to
property_service, thread called wifi_start_supplicant will yield cpu
for android init process to get scheduled, then init.svc.* status
is read to check if supplicant status is running

there is a chance that after scheld_yield returned, init is not
scheduled, serial value is not updated, __system_property_read got
the "stopped" status, then init is scheduled to update service status
after that back to this loop in Wi-Fi HAL, serial is updated, but
status is not reread, still used "stopped", then Wi-Fi HAL will
report supplicant start failed

as the following schedule sequence:

process A(WifiStateMachine)           process B(init)
1. ctl.start
2. scheld_yield
3. __system_proerty_read
   /*serial1, value1*/
                                      4. __system_property_update
                                         /*serial2, value2*/
5. serial1 != serial2
6. value1 == "stopped"

So after sched_yield, first check if serial is updated, then read
service status

Change-Id: I5181e0d4504c525832c033b9a35bd58ec63e1de8
Signed-off-by: jiaguo <jiaguo@marvell.com>
wifi/wifi.c