--- NetworkManager-0.6.5/src/nm-device-802-11-wireless.c.fix-hidden	2007-06-07 13:22:21.000000000 -0200
+++ NetworkManager-0.6.5/src/nm-device-802-11-wireless.c	2007-08-07 00:14:29.000000000 -0200
@@ -2838,13 +2838,19 @@
 				|| (caps & NM_802_11_CAP_PROTO_WPA2);
 
 	/* Use "AP_SCAN 2" if:
-	 * - The wireless network is non-broadcast or Ad-Hoc
+	 * - The wireless network is Ad-Hoc
 	 * - The wireless driver does not support WPA (stupid drivers...)
 	 */
 	is_adhoc = (nm_ap_get_mode(ap) == IW_MODE_ADHOC);
-	if (!nm_ap_get_broadcast (ap) || is_adhoc || !supports_wpa)
+	if (is_adhoc || !supports_wpa)
 		ap_scan = "AP_SCAN 2";
 
+	/* Use "AP_SCAN 1" if:
+	 * - The wireless network is non-broadcast
+	 */
+	if (!nm_ap_get_broadcast (ap))
+		ap_scan = "AP_SCAN 1";
+
 	/* Tell wpa_supplicant that we'll do the scanning */
 	if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, ap_scan))
 		goto out;
@@ -2877,6 +2883,14 @@
 	 */
 	if (!nm_ap_get_broadcast (ap) && !is_adhoc)
 	{
+		/* 
+		 * since using "AP_SCAN 1" for hidden networks, wpa_supplicant
+		 * does not seem to bring the essid to the device anymore...
+		 * perhaps this is a wpa_supplicant/wext/driver issue or perhaps this
+		 * is simply how it is. We set the ESSID here for now. 
+		 */
+		nm_device_802_11_wireless_set_essid(self, essid);
+
 		if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL,
 				"SET_NETWORK %i scan_ssid 1", nwid))
 			goto out;
