[PATCH] libertas: fix 'keep previous scan' behavior
[pandora-kernel.git] / drivers / net / wireless / libertas / wext.c
index 1bc2fbf..518371a 100644 (file)
@@ -189,6 +189,8 @@ static int setcurrentchannel(wlan_private * priv, int channel)
 static int changeadhocchannel(wlan_private * priv, int channel)
 {
        int ret = 0;
+       struct WLAN_802_11_SSID curadhocssid;
+       struct bss_descriptor * join_bss = NULL;
        wlan_adapter *adapter = priv->adapter;
 
        adapter->adhocchannel = channel;
@@ -214,43 +216,38 @@ static int changeadhocchannel(wlan_private * priv, int channel)
                goto out;
        }
 
-       if (adapter->connect_status == libertas_connected) {
-               int i;
-               struct WLAN_802_11_SSID curadhocssid;
-
-               lbs_deb_wext("channel changed while in IBSS\n");
+       if (adapter->connect_status != libertas_connected)
+               goto out;
 
-               /* Copy the current ssid */
-               memcpy(&curadhocssid, &adapter->curbssparams.ssid,
-                      sizeof(struct WLAN_802_11_SSID));
+       lbs_deb_wext("channel changed while in IBSS\n");
 
-               /* Exit Adhoc mode */
-               lbs_deb_wext("in changeadhocchannel(): sending Adhoc stop\n");
-               ret = libertas_stop_adhoc_network(priv);
+       /* Copy the current ssid */
+       memcpy(&curadhocssid, &adapter->curbssparams.ssid,
+              sizeof(struct WLAN_802_11_SSID));
 
-               if (ret)
-                       goto out;
+       /* Exit Adhoc mode */
+       lbs_deb_wext("in changeadhocchannel(): sending Adhoc stop\n");
+       ret = libertas_stop_adhoc_network(priv);
+       if (ret)
+               goto out;
 
-               /* Scan for the network, do not save previous results.  Stale
-                *   scan data will cause us to join a non-existant adhoc network
-                */
-               libertas_send_specific_SSID_scan(priv, &curadhocssid, 0);
+       /* Scan for the network, do not save previous results.  Stale
+        *   scan data will cause us to join a non-existant adhoc network
+        */
+       libertas_send_specific_SSID_scan(priv, &curadhocssid, 1);
 
-               // find out the BSSID that matches the current SSID
-               i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
-                                  IW_MODE_ADHOC);
+       /* find out the BSSID that matches the current SSID */
+       join_bss = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
+                          IW_MODE_ADHOC);
 
-               if (i >= 0) {
-                       lbs_deb_wext("SSID found at %d in list,"
-                              "so join\n", i);
-                       libertas_join_adhoc_network(priv, &adapter->scantable[i]);
-               } else {
-                       // else send START command
-                       lbs_deb_wext("SSID not found in list, "
-                              "creating AdHoc with SSID '%s'\n",
-                              curadhocssid.ssid);
-                       libertas_start_adhoc_network(priv, &curadhocssid);
-               }               // end of else (START command)
+       if (join_bss) {
+               lbs_deb_wext("SSID found in list, so join\n");
+               libertas_join_adhoc_network(priv, join_bss);
+       } else {
+               lbs_deb_wext("SSID not found in list, "
+                      "creating AdHoc with SSID '%s'\n",
+                      curadhocssid.ssid);
+               libertas_start_adhoc_network(priv, &curadhocssid);
        }
 
 out:
@@ -1066,6 +1063,16 @@ static const struct iw_priv_args wlan_private_args[] = {
         IW_PRIV_TYPE_CHAR | 128,
         IW_PRIV_TYPE_CHAR | 128,
         "bt_list"},
+       {
+        WLAN_SUBCMD_BT_SET_INVERT,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        IW_PRIV_TYPE_NONE,
+        "bt_set_invert"},
+       {
+        WLAN_SUBCMD_BT_GET_INVERT,
+        IW_PRIV_TYPE_NONE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+        "bt_get_invert"},
        /* FWT Management */
        {
         WLAN_SUBCMD_FWT_ADD,