From 90819aa3204cd9e93aa05f48cbe3a8b37c8d3802 Mon Sep 17 00:00:00 2001 From: Robert Love Date: Thu, 2 Mar 2006 15:06:27 +0000 Subject: [PATCH] 2006-03-02 Robert Love Patch by Brian Magnuson : * src/nm-device-802-11-wireless.c: During scanning, only set the wireless mode to infrastructure if it is not currently in infrastructure mode. For some driver, setting the mode is a costly operation, apparently. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1536 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 7 +++++++ src/nm-device-802-11-wireless.c | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67d5cf62ba..c0b9c799ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-03-02 Robert Love + + Patch by Brian Magnuson : + * src/nm-device-802-11-wireless.c: During scanning, only set the wireless + mode to infrastructure if it is not currently in infrastructure mode. + For some driver, setting the mode is a costly operation, apparently. + 2006-03-01 Rodrigo Moya * Makefile.am: use the correct dir for autostart mechanism. diff --git a/src/nm-device-802-11-wireless.c b/src/nm-device-802-11-wireless.c index 75929e96a6..b63460cf9b 100644 --- a/src/nm-device-802-11-wireless.c +++ b/src/nm-device-802-11-wireless.c @@ -1811,7 +1811,7 @@ nm_device_802_11_wireless_scan (gpointer user_data) iface = nm_device_get_iface (NM_DEVICE (self)); if ((sk = nm_dev_sock_open (NM_DEVICE (self), DEV_WIRELESS, __FUNCTION__, NULL))) { - int orig_mode = IW_MODE_INFRA; + int orig_mode; double orig_freq = 0; int orig_rate = 0; struct iwreq wrq; @@ -1825,8 +1825,12 @@ nm_device_802_11_wireless_scan (gpointer user_data) /* Must be in infrastructure mode during scan, otherwise we don't get a full * list of scan results. Scanning doesn't work well in Ad-Hoc mode :( + * + * We only set the mode if it needs setting, in case it is a costly operation + * for the driver. */ - nm_device_802_11_wireless_set_mode (self, IW_MODE_INFRA); + if (orig_mode != IW_MODE_INFRA) + nm_device_802_11_wireless_set_mode (self, IW_MODE_INFRA); nm_device_802_11_wireless_set_frequency (self, 0); wrq.u.data.pointer = NULL;