wifi: add 'check_scan' parameter to wifi utils init

Normal WiFi devices want this (since we dont' support devices that
cannot scan) but OLPC Mesh devices don't.
This commit is contained in:
Dan Williams 2011-10-05 09:47:37 -05:00
parent fe4c8eb022
commit 2dc0f6a375
5 changed files with 8 additions and 7 deletions

View file

@ -322,7 +322,8 @@ constructor (GType type,
nm_device_get_ifindex (NM_DEVICE (self)));
priv->wifi_data = wifi_utils_init (nm_device_get_iface (NM_DEVICE (self)),
nm_device_get_ifindex (NM_DEVICE (self)));
nm_device_get_ifindex (NM_DEVICE (self)),
TRUE);
if (priv->wifi_data == NULL) {
nm_log_warn (LOGD_HW | LOGD_WIFI, "(%s): failed to initialize WiFi driver",
nm_device_get_iface (NM_DEVICE (self)));

View file

@ -531,7 +531,7 @@ wext_get_caps (WifiDataWext *wext, struct iw_range *range)
}
WifiData *
wifi_wext_init (const char *iface, int ifindex)
wifi_wext_init (const char *iface, int ifindex, gboolean check_scan)
{
WifiDataWext *wext;
struct iw_range range;
@ -581,7 +581,7 @@ wifi_wext_init (const char *iface, int ifindex)
wext->freqs[i] = iw_freq_to_uint32 (&range.freq[i]);
/* Check for scanning capability; cards that can't scan are not supported */
if (wext_can_scan (wext) == FALSE) {
if (check_scan && (wext_can_scan (wext) == FALSE)) {
nm_log_info (LOGD_HW | LOGD_WIFI,
"(%s): drivers that cannot scan are unsupported",
wext->parent.iface);

View file

@ -23,7 +23,7 @@
#include "wifi-utils.h"
WifiData *wifi_wext_init (const char *iface, int ifindex);
WifiData *wifi_wext_init (const char *iface, int ifindex, gboolean check_scan);
gboolean wifi_wext_is_wifi (const char *iface);

View file

@ -49,14 +49,14 @@ wifi_data_free (WifiData *data)
/***************************************************************/
WifiData *
wifi_utils_init (const char *iface, int ifindex)
wifi_utils_init (const char *iface, int ifindex, gboolean check_scan)
{
g_return_val_if_fail (iface != NULL, NULL);
g_return_val_if_fail (ifindex > 0, NULL);
/* Determine WEXT vs. nl80211 here */
return wifi_wext_init (iface, ifindex);
return wifi_wext_init (iface, ifindex, check_scan);
}
NMDeviceWifiCapabilities

View file

@ -31,7 +31,7 @@ typedef struct WifiData WifiData;
gboolean wifi_utils_is_wifi (const char *iface);
WifiData *wifi_utils_init (const char *iface, int ifindex);
WifiData *wifi_utils_init (const char *iface, int ifindex, gboolean check_scan);
void wifi_utils_deinit (WifiData *data);