Ok, I think I figured out the root cause.  At a high level, I think
this is a bug in the interaction between wpa_supplicant, connman, and
the nl80211 driver.

Let's say you took your device somewhere and connected to SSID Alice.
connman saves a settings file in /var/lib/connman for this successful
connection.  Let's say you then moved your device and connected to
SSID Bob.  connman also saves another settings file for this
connection.

Now, when connman starts up, it asks wpa_supplicant to scan SSIDs
Alice and Bob and the frequencies on which the device last connected.
Since Alice doesn't exist, the nl80211 driver reports:

nl80211: Scan trigger failed: ret=-22 (Invalid argument)

wpa_supplicant never returns a successful scan, so connman gets stuck
waiting for the scan to complete.  If you call 'iwlist wlan0
scanning', this causes the nl80211 driver to do a full scan WITHOUT
the SSIDs.  wpa_supplicant returns back the results,connman resumes,
and everything works.

There are several problems I see here:

1) connman should timeout from the failed scan and retry
2) connman should only ask to scan SSIDs if they are present, or not
scan explicit SSIDs at all
3) The nl80211 driver should arguably not return an illegal argument
error if an SSID does not exist
4) If an error occurs, wpa_supplicant should return either empty scan
results or some error message on dbus

A quick fix is to erase all cached profiles in /var/lib/connman/wifi*
so that connman won't attempt to scan non-existing SSIDs, but I think
there should be something in the code to handle cases #1 and #2.

On Thu, Jan 3, 2013 at 11:31 PM, Raseel Bhagat
<raseel.bha...@kpitcummins.com> wrote:
> Hi
>
> -----Original Message-----
> From: connman-boun...@connman.net [mailto:connman-boun...@connman.net] On 
> Behalf Of Stan Hu
> Sent: Friday, January 04, 2013 12:09 PM
> To: connman@connman.net
> Subject: connman wlan0 scan gets stuck?
>
>>I'm running connman v1.4 and wpa-supplicant v0.73 (old, I know), but
>>
>>Essentially connmand starts up in a state where no WiFi services are
>>listed unless I either:
>>
>>1) run 'iwlist scan'
>>2) clean out the /var/lib/connman/wifi* directory for the AP and restart 
>>connman
>
> I have been using connman v1.3.
> However, instead of calling "iwlist scan" , I do the following after running 
> connmand -n :
> test-connman enable  wifi
> test-connman scan wifi
> test-connman services
>
> Also, the periodic autoscan by wpa_supplicant seems to be working fine with 
> my setup.
>
> Can you try the above and see if you are still facing the issue ?
>
> Thanks,
> Raseel Bhagat
>
>
> _______________________________________________
> connman mailing list
> connman@connman.net
> http://lists.connman.net/listinfo/connman
_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to