Workaround for report_events functionality
Vinit Deshapnde [Mon, 5 May 2014 18:29:53 +0000 (11:29 -0700)]
This change sets mscan value to 1 if any of the buckets has report_events
set to some value other than zero. This is a workaround till per bucket
functionality is implemented.

Also includes some logging improvements.

Change-Id: I7f10970f777f3498b3d69ef59dce6409b4830e2e

bcmdhd/wifi_hal/cpp_bindings.cpp
bcmdhd/wifi_hal/gscan.cpp

index 6f70259..1932202 100644 (file)
@@ -680,7 +680,7 @@ int WifiCommand::response_handler(struct nl_msg *msg, void *arg) {
         ALOGE("Failed to parse reply message = %d", res);
         return NL_SKIP;
     } else {
-        reply.log();
+        // reply.log();
         return cmd->handleResponse(reply);
     }
 }
index 39cbce4..0e0e3db 100644 (file)
@@ -312,7 +312,15 @@ public:
             return result;
         }
 
-        result = request.put_u32(GSCAN_ATTRIBUTE_NUM_SCANS_TO_CACHE, 3);
+        int num_scans = 10;
+        for (int i = 0; i < mParams->num_buckets; i++) {
+            if (mParams->buckets[i].report_events != 0) {
+                num_scans = 1;
+                break;
+            }
+        }
+
+        result = request.put_u32(GSCAN_ATTRIBUTE_NUM_SCANS_TO_CACHE, num_scans);
         if (result < 0) {
             return result;
         }
@@ -404,7 +412,7 @@ public:
     virtual int handleEvent(WifiEvent& event) {
         ALOGI("Got a scan results event");
 
-        event.log();
+        // event.log();
 
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
         int len = event.get_vendor_data_len();
@@ -570,9 +578,10 @@ public:
                         wifi_scan_result *results = (wifi_scan_result *)it2.get_data();
                         for (int i = 0; i < num; i++) {
                             wifi_scan_result *result = results + i;
-                            ALOGI("%02d  %-32s  %02x:%02x:%02x:%02x:%02x:%02x", i,
+                            ALOGI("%02d  %-32s  %02x:%02x:%02x:%02x:%02x:%02x  %04d", i,
                                 result->ssid, result->bssid[0], result->bssid[1], result->bssid[2],
-                                result->bssid[3], result->bssid[4], result->bssid[5]);
+                                result->bssid[3], result->bssid[4], result->bssid[5],
+                                result->rssi);
                         }
                         mRetrieved += num;
                     } else {
@@ -731,7 +740,7 @@ public:
     virtual int handleEvent(WifiEvent& event) {
         ALOGI("Got a hotlist ap found event");
 
-        event.log();
+        // event.log();
 
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
         int len = event.get_vendor_data_len();
@@ -871,9 +880,6 @@ public:
             return result;
         }
 
-        WifiEvent e(request.getMessage());
-        e.log();
-
         result = requestResponse(request);
         if (result < 0) {
             ALOGI("failed to set significant wifi change config %d", result);