RE: connman wlan0 scan gets stuck?

2013-01-03 Thread Zheng, Jeff
Hi,

> I'm running connman v1.4 and wpa-supplicant v0.73 (old, I know), but before I
> try upgrading everything--which is not a trivial matter since the software 
> needs
> to be deployed on hundreds of devices--I want to understand the issue.
> 
> 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
> 

FYI. I saw a similar issue with an old netbook. It's 
https://bugs.meego.com/show_bug.cgi?id=25307


Bests
Jeff
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


RE: connman wlan0 scan gets stuck?

2013-01-03 Thread Raseel Bhagat
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


Re: connman wlan0 scan gets stuck?

2013-01-04 Thread Stan Hu
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
 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


Re: connman wlan0 scan gets stuck?

2013-01-04 Thread Felipe Ferreri Tonello

Hi Stan,

On 01/03/2013 10:38 PM, Stan Hu wrote:

I'm running connman v1.4 and wpa-supplicant v0.73 (old, I know), but
before I try upgrading everything--which is not a trivial matter since
the software needs to be deployed on hundreds of devices--I want to
understand the issue.


Can you scan for the first time?

Because I had this problem and I fixed updating wpa_supplicant to 1.0 or 
grater.


Regards,

Felipe Tonello

___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: connman wlan0 scan gets stuck?

2013-01-07 Thread Patrik Flykt

Hi,

On Fri, 2013-01-04 at 09:25 -0800, Stan Hu wrote:
> 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.

The SSIDs are scanned only if the WiFi networks were hidden, in other
cases a normal broadcast scan is done.

> Since Alice doesn't exist, the nl80211 driver reports:
> 
> nl80211: Scan trigger failed: ret=-22 (Invalid argument)

Which version of wpa_supplicant is in use?

> 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.

Can you check ConnMan is stuck by running either 'test/test-connman scan
wifi' or 'connmanctl scan wifi'? Both commands wait until the scan is
done, which is a few seconds. What about a subsequent scan? If they
never return there is a bug somewhere. 

Cheers,

Patrik


___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: connman wlan0 scan gets stuck?

2013-01-07 Thread Stan Hu
On Mon, Jan 7, 2013 at 12:30 AM, Patrik Flykt
wrote:

>
> Hi,
>
> On Fri, 2013-01-04 at 09:25 -0800, Stan Hu wrote:
> > 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.
>
> The SSIDs are scanned only if the WiFi networks were hidden, in other
> cases a normal broadcast scan is done.
>

connman v1.4 looks like it attempts to scan all the most recent networks
that were connected in get_latest_connections() (i.e. profiles that are
stored in /var/lib/connman/wifi_*)  I think this is true in the latest
version of connman as well.


>
> > Since Alice doesn't exist, the nl80211 driver reports:
> >
> > nl80211: Scan trigger failed: ret=-22 (Invalid argument)
>
> Which version of wpa_supplicant is in use?
>

I am using wpa_supplicant v0.73.

I think I now fully understand where the -22 invalid argument error is
coming from.  It appears that the nl80211 scan fails because connman
inserts more SSIDs than allowed by the the driver (max_scan_ssids).
 wpa_supplicant v1.0 added support for the MaxScanSSID parameter.  Since
v0.73 doesn't support this parameter, this parameter defaults to
WPAS_MAX_SCAN_SSIDS (4):

connmand[2478]: plugins/wifi.c:wifi_scan_fast() device 0x99048 0x91738
connmand[2478]: plugins/wifi.c:wifi_scan_fast() max ssids 4

The driver on my WiFi device supports only 1 SSID scan.  Since connman
attempts to feed 2 SSID devices, the failure causes connman to get stuck
waiting for a scan to complete.

This problem would be cured by upgrading to wpa_supplicant v1.0, but I do
think this issue raises a number of questions:

1) Should the WPAS_MAX_SCAN_SSIDS in the supplicant be set to 0 or 1 by
default instead of 4?
2) Why doesn't connman time out on the scan after failing to receive a
response from wpa_supplicant?
3) wpa_supplicant should send an error message back to connman, which
should abort the scan.

> 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.
>
> Can you check ConnMan is stuck by running either 'test/test-connman scan
> wifi' or 'connmanctl scan wifi'? Both commands wait until the scan is
> done, which is a few seconds. What about a subsequent scan? If they
> never return there is a bug somewhere.
>

I get a dbus error when I attempt to use  'test/test-connman scan wifi'.
 iwlist is the only thing that kicks it out of the state.


> Cheers,
>
> Patrik
>
>
> ___
> connman mailing list
> connman@connman.net
> http://lists.connman.net/listinfo/connman
>
___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman


Re: connman wlan0 scan gets stuck?

2013-01-08 Thread Patrik Flykt
On Mon, 2013-01-07 at 13:31 -0800, Stan Hu wrote:
> connmand[2478]: plugins/wifi.c:wifi_scan_fast() device 0x99048 0x91738
> connmand[2478]: plugins/wifi.c:wifi_scan_fast() max ssids 4
> 
> The driver on my WiFi device supports only 1 SSID scan.  Since connman
> attempts to feed 2 SSID devices, the failure causes connman to get
> stuck
> waiting for a scan to complete. 

Ok, now I get where this is coming from. wpa_supplicant is/was supposed
to handle 4 SSIDs and 16 in later versions, but seems not to cope with
that anyway. I'll do a patch and then we'll see if it helps.

Cheers,

Patrik


___
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman