Bug 772801 - Deal with drivers that don't support active/passive scanning. r=mwu DONTBUILD
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 12 Jul 2012 15:09:18 -0700
changeset 101817 32c911bc25790a2b70a64b05972d3edfe3cc12a8
parent 101816 6489be1890c058de61c4cac031e40a1902e3e9d9
child 101819 40821ab51232f219bd9bd7dd33ea835a6bbf3281
child 101856 33843dd89abc07751a9b54318f73e8ea8434751d
push id1729
push userlsblakk@mozilla.com
push dateMon, 16 Jul 2012 20:02:43 +0000
treeherdermozilla-aurora@f4e75e148951 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu
bugs772801
milestone16.0a1
Bug 772801 - Deal with drivers that don't support active/passive scanning. r=mwu DONTBUILD
dom/wifi/WifiWorker.js
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -231,19 +231,24 @@ var WifiManager = (function() {
   var scanModeActive = false;
 
   function doSetScanModeCommand(setActive, callback) {
     doBooleanCommand(setActive ? "DRIVER SCAN-ACTIVE" : "DRIVER SCAN-PASSIVE", "OK", callback);
   }
 
   function scanCommand(forceActive, callback) {
     if (forceActive && !scanModeActive) {
-      doSetScanModeCommand(true, function(ok) {
-        ok && doBooleanCommand("SCAN", "OK", function(ok) {
-          ok && doSetScanModeCommand(false, callback);
+      // Note: we ignore errors from doSetScanMode.
+      doSetScanModeCommand(true, function(ignore) {
+        doBooleanCommand("SCAN", "OK", function(ok) {
+          doSetScanModeCommand(false, function(ignore) {
+            // The result of scanCommand is the result of the actual SCAN
+            // request.
+            callback(ok);
+          });
         });
       });
       return;
     }
     doBooleanCommand("SCAN", "OK", callback);
   }
 
   function setScanModeCommand(setActive, callback) {
@@ -598,17 +603,17 @@ var WifiManager = (function() {
     resetConnections(manager.ifname, function() {
       stopDhcp(manager.ifname, function() {
         callback();
       });
     });
   }
 
   manager.start = function() {
-    debug("detected SDK version " + sdkVersion);
+    debug("detected SDK version " + sdkVersion + " and device " + device);
 
     // If we reconnected to an already-running supplicant, then manager.state
     // will have already been updated to the supplicant's state. Otherwise, we
     // started the supplicant ourselves and need to connect.
     if (manager.state === "UNINITIALIZED")
       connectToSupplicant(connectCallback);
   }