Bug 859486 - Add system property to enable the unloading of Wi-Fi drivers r=mrbkap
authorMichael Vines <mvines@codeaurora.org>
Wed, 10 Apr 2013 20:52:48 -0700
changeset 128492 dbf9ab7dec313fbe76fafcc8fcaaa7b146bbecf0
parent 128491 4add88d3db6959db49c8f1c47b0d8537539fa969
child 128493 71bf6bcba445c81d14d12f49ce567b406790a0eb
push id26339
push userfdesre@mozilla.com
push dateThu, 11 Apr 2013 19:10:25 +0000
treeherdermozilla-inbound@dbf9ab7dec31 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs859486
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 859486 - Add system property to enable the unloading of Wi-Fi drivers r=mrbkap
dom/wifi/WifiWorker.js
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -39,21 +39,22 @@ XPCOMUtils.defineLazyServiceGetter(this,
 // convention (note: command functions do get boolean results since the
 // command always succeeds and we do a string/boolean check for the
 // expected results).
 var WifiManager = (function() {
   function getStartupPrefs() {
     Cu.import("resource://gre/modules/systemlibs.js");
     return {
       sdkVersion: parseInt(libcutils.property_get("ro.build.version.sdk"), 10),
+      unloadDriverEnabled: libcutils.property_get("ro.moz.wifi.unloaddriver") === "1",
       schedScanRecovery: libcutils.property_get("ro.moz.wifi.sched_scan_recover") === "false" ? false : true
     };
   }
 
-  let {sdkVersion, schedScanRecovery} = getStartupPrefs();
+  let {sdkVersion, unloadDriverEnabled, schedScanRecovery} = getStartupPrefs();
 
   var controlWorker = new ChromeWorker(WIFIWORKER_WORKER);
   var eventWorker = new ChromeWorker(WIFIWORKER_WORKER);
 
   var manager = {};
   manager.schedScanRecovery = schedScanRecovery;
 
   // Callbacks to invoke when a reply arrives from the controlWorker.
@@ -127,22 +128,24 @@ var WifiManager = (function() {
 
     voidControlMessage("load_driver", function(status) {
       driverLoaded = (status >= 0);
       callback(status)
     });
   }
 
   function unloadDriver(callback) {
-    // Unloading drivers is generally unnecessary and
-    // can trigger bugs in some drivers.
-    // On properly written drivers, bringing the interface
-    // down powers down the interface.
-    callback(0);
-    return;
+    if (!unloadDriverEnabled) {
+      // Unloading drivers is generally unnecessary and
+      // can trigger bugs in some drivers.
+      // On properly written drivers, bringing the interface
+      // down powers down the interface.
+      callback(0);
+      return;
+    }
 
     voidControlMessage("unload_driver", function(status) {
       driverLoaded = (status < 0);
       callback(status);
     });
   }
 
   function startSupplicant(callback) {