Below patch was developed after discussion with Daniel Drake who mentioned to me that wireless tools expect an EAGAIN return from getscan so that they can wait for the scan to finish before printing out the results.
Signed-off-by: Johannes Berg <[EMAIL PROTECTED]> diff --git a/net/ieee80211/softmac/ieee80211softmac_priv.h b/net/ieee80211/softmac/ieee80211softmac_priv.h index 65d9816..03932de 100644 --- a/net/ieee80211/softmac/ieee80211softmac_priv.h +++ b/net/ieee80211/softmac/ieee80211softmac_priv.h @@ -83,6 +83,10 @@ void ieee80211softmac_scan(void *sm); int ieee80211softmac_start_scan(struct ieee80211softmac_device *mac); void ieee80211softmac_stop_scan(struct ieee80211softmac_device *mac); void ieee80211softmac_wait_for_scan(struct ieee80211softmac_device *mac); +int ieee80211softmac_get_scan(struct ieee80211softmac_device *sm, + struct iw_request_info *info, + union iwreq_data *data, + char *extra); /* for use by _module.c to assign to the callbacks */ int ieee80211softmac_start_scan_implementation(struct net_device *dev); diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c index bb9ab8b..7c700a0 100644 --- a/net/ieee80211/softmac/ieee80211softmac_scan.c +++ b/net/ieee80211/softmac/ieee80211softmac_scan.c @@ -56,6 +56,25 @@ ieee80211softmac_start_scan(struct ieee8 return ret; } +/* if we're still scanning, return -EAGAIN so that userspace tools + * can get the complete scan results, otherwise return 0. */ +int +ieee80211softmac_get_scan(struct ieee80211softmac_device *sm, + struct iw_request_info *info, + union iwreq_data *data, + char *extra) +{ + unsigned long flags; + + spin_lock_irqsave(&sm->lock, flags); + if (sm->scanning) { + spin_unlock_irqrestore(&sm->lock, flags); + return -EAGAIN; + } + spin_unlock_irqrestore(&sm->lock, flags); + return ieee80211_wx_get_scan(sm->ieee, info, data, extra); +} + void ieee80211softmac_stop_scan(struct ieee80211softmac_device *sm) { diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c b/net/ieee80211/softmac/ieee80211softmac_wx.c index b559aa9..8f1ed45 100644 --- a/net/ieee80211/softmac/ieee80211softmac_wx.c +++ b/net/ieee80211/softmac/ieee80211softmac_wx.c @@ -48,7 +48,7 @@ ieee80211softmac_wx_get_scan_results(str char *extra) { struct ieee80211softmac_device *sm = ieee80211_priv(net_dev); - return ieee80211_wx_get_scan(sm->ieee, info, data, extra); + return ieee80211softmac_get_scan(sm, info, data, extra); } EXPORT_SYMBOL_GPL(ieee80211softmac_wx_get_scan_results); - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html