Re: Wireless silently disconnects?



* Robert Love <rml novell com> [2006-03-01 20:19]:
> 
> wpa_supplicant drivers and kernel drivers are two different things.
> 
> the get_driver() function returns the kernel driver.
> 
> you are passing that in where we request the wpa_supplicant driver.  it
> won't work for most drivers.
> 
> wpa_supplicant defines a generic "wext" driver that handles the wireless
> extension API.  it also defines a handful of custom drivers, because the
> kernel wireless drivers are such pieces of cat poop.  madwifi and
> ndiswrapper are two of them.  but, say, airo (a valid kernel driver) is
> not.
> 
> 	Robert Love

Ah, I see.  Ok, so something like this might be more appropriate?   Basically
back to the original posters concept.  More elses could be added as
appropriate.

Additionally I moved the set_freq outside the if() which still works for me.
The set_mode really seems to be the thing causing the problem.  Having that
outside the if caused that same hang.  In that case it's not even clear that
the 2nd part of the patch is needed although it certainly seems like the right
thing to do.

-Brian

Index: src/nm-device-802-11-wireless.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/src/nm-device-802-11-wireless.c,v
retrieving revision 1.55
diff -u -r1.55 nm-device-802-11-wireless.c
--- src/nm-device-802-11-wireless.c	28 Feb 2006 20:25:04 -0000	1.55
+++ src/nm-device-802-11-wireless.c	2 Mar 2006 01:35:16 -0000
@@ -1826,7 +1826,9 @@
 			/* 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 :( 
 			 */
-			nm_device_802_11_wireless_set_mode (self, IW_MODE_INFRA);
+			if (nm_device_802_11_wireless_get_mode (self) == IW_MODE_ADHOC) {
+				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;
@@ -2401,13 +2403,21 @@
 	const char *		iface = nm_device_get_iface (NM_DEVICE (self));
 	gboolean			success = FALSE;
 	int				tries = 0;
+	char driver[12];
 
 	if (!(ctrl = wpa_ctrl_open (WPA_SUPPLICANT_GLOBAL_SOCKET, NM_RUN_DIR)))
 		goto exit;
 
+	if(!strcmp(nm_device_get_driver (NM_DEVICE (self)), "ndiswrapper"))
+		strcpy(driver, "ndiswrapper");
+	else if(!strcmp(nm_device_get_driver (NM_DEVICE (self)), "madwifi"))
+		strcpy(driver, "madwifi");
+	else
+		strcpy(driver, "wext");
+
 	/* wpa_cli -g/var/run/wpa_supplicant-global interface_add eth1 "" wext /var/run/wpa_supplicant */
 	if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL,
-			"INTERFACE_ADD %s\t\twext\t" WPA_SUPPLICANT_CONTROL_SOCKET "\t", iface))
+			"INTERFACE_ADD %s\t\t%s\t" WPA_SUPPLICANT_CONTROL_SOCKET "\t", iface, driver))
 		goto exit;
 	wpa_ctrl_close (ctrl);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]