> if (nm_device_802_11_wireless_get_mode (self) == mode) > return TRUE; This is true, but if nm_device_802_11_wireless_get_mode (self) is IW_MODE_AUTO and mode is IW_MODE_INFRA, condition is false because device mode is changed. This patch work fine for me and "all changes are needed" --- NetworkManager-0.5.2/src/nm-device-802-11-wireless.c 2006-02-21 11:39:33.000000000 +0100 +++ /root/Desktop/nm-device-802-11-wireless.c 2006-03-03 13:55:08.000000000 +0100 @@ -1808,7 +1808,10 @@ /* 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; @@ -2282,13 +2285,27 @@ const char * iface = nm_device_get_iface (NM_DEVICE (self)); gboolean success = FALSE; int tries = 0; + char * driver; if (!(ctrl = wpa_ctrl_open (WPA_SUPPLICANT_GLOBAL_SOCKET, NM_RUN_DIR))) goto exit; + if (!strcmp (nm_device_get_driver (NM_DEVICE (self)), "ndiswrapper")) { + driver= g_malloc(sizeof(char)*(strlen("ndiswrapper")+1)); + driver= strcpy(driver, "ndiswrapper"); + } + else if (!strcmp (nm_device_get_driver (NM_DEVICE (self)), "ath_pci")) { + driver= g_malloc(sizeof(char)*(strlen("madwifi")+1)); + driver= strcpy(driver, "madwifi"); + } + else { + driver= g_malloc(sizeof(char)*(strlen("wext")+1)); + driver= 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); @@ -2308,6 +2325,7 @@ success = TRUE; exit: + g_free (driver); return success; } >On Thu, 2006-03-02 at 10:15 -0500, Dan Williams wrote: >> On Thu, 2006-03-02 at 10:03 -0500, Robert Love wrote: >> > On Thu, 2006-03-02 at 09:49 -0500, Dan Williams wrote: >> > >> > > So which hunk of this patch seems to fix the problem? The first part >> > > for the set_mode, or the second part passing the ndiswrapper driver to >> > > wpa_supplicant? >> > >> > The first hunk. I just checked a variant into CVS. >> >> The reason this hunk exists is really for just adhoc. Same for the >> frequency set to 0, I think. If you want to move both of them into >> if (orig_mode == IW_MODE_ADHOC) >> >> block just above, that would be fine. I initially observed with prism54 >> cards that adhoc mode pretty much didn't work at all unless the mode was >> infrastructure and the bitrate was unlocked. Unfortunately, the bitrate >> had to be locked during normal adhoc operation, otherwise you never got >> any traffic. Now that our custom adhoc setup code is gone, I think we >> can remove that bitrate unlock line. >> >> Note that NM only supports two modes right now, INFRA and ADHOC. The >> other mode is MASTER, and of course we don't do that yet. >On second look, your commit is fine. I forgot that if wpa_supplicant >sets up the stuff, we need to switch it back anyway. >However, there's another problem... The code for set_mode already >checks to see what the mode was, and if you request to set the mode that >the card is in already, it just returns without doing anything: > if (nm_device_802_11_wireless_get_mode (self) == mode) > return TRUE; >So I'm not sure what your commit fixes? It's more likely that the >driver here dislikes the frequency set, and that we should only unlock >the frequency when the card is in ad-hoc mode. >Candidate patch attached, does this fix the issue? >Dan
Attachment:
nm-ndiswrapper2.patch
Description: application/data