Proper startup in order to get best list of aps with scan_results

Jouni Malinen jkmaline at cc.hut.fi
Sun Sep 10 19:21:23 EDT 2006


On Wed, Sep 06, 2006 at 04:51:39PM -0700, George S. Lockwood wrote:

> How to get the best scan_results at cli startup?  Should I ap_scan=1
> and then enable a "dummy" network? then scan_results?  I don't wish to
> connect at startup, just get a list of aps.  Connecting to a network
> happens a bit later.

You do not need to add a network for this to work. Just start
wpa_supplicant with an empty configuration file in either ap_scan=1 or
ap_scan=2 mode and issue SCAN command. Then wait seven seconds (timeout
for scan results to be read and if I remember correctly, the interval
after which NDIS drivers are required to have scan results ready) and
issue SCAN_RESULTS to read the results.

> the other question I have about scanning is in that other thread, but
> is: do I request a scan, and then wait for some precribed amount of
> time (to wait for the NIC to finish scanning), and then request a
> scan_result? or can I call scan_result immediately after a scan
> request (because control won't return to me until the scan has
> completed)?

You will need to wait for this since SCAN commands is not blocking. You
can use SCAN_RESULTS without a wait, but there is no guarantee that the
results are up-to-date or event available at that point unless you wait
long enough (seven seconds in case of NDIS drivers).

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the HostAP mailing list