[9610][7872][7885] wlbt : Fixing prevent issues
[GitHub/LineageOS/android_hardware_samsung_slsi_scsc_wifibt_wifi_hal.git] / gscan.cpp
index 2f4dd3b168e64b5b68cec8f0f80ce8c1cad816c4..90989f96eefb28e623dc874dd535d3ae4b059336 100755 (executable)
--- a/gscan.cpp
+++ b/gscan.cpp
@@ -92,11 +92,17 @@ typedef enum {
 } GSCAN_ATTRIBUTE;
 
 typedef enum {
-    EPNO_ATTRIBUTE_SSID_LIST,
+    EPNO_ATTRIBUTE_MINIMUM_5G_RSSI,
+    EPNO_ATTRIBUTE_MINIMUM_2G_RSSI,
+    EPNO_ATTRIBUTE_INITIAL_SCORE_MAX,
+    EPNO_ATTRIBUTE_CUR_CONN_BONUS,
+    EPNO_ATTRIBUTE_SAME_NETWORK_BONUS,
+    EPNO_ATTRIBUTE_SECURE_BONUS,
+    EPNO_ATTRIBUTE_5G_BONUS,
     EPNO_ATTRIBUTE_SSID_NUM,
+    EPNO_ATTRIBUTE_SSID_LIST,
     EPNO_ATTRIBUTE_SSID,
     EPNO_ATTRIBUTE_SSID_LEN,
-    EPNO_ATTRIBUTE_RSSI,
     EPNO_ATTRIBUTE_FLAGS,
     EPNO_ATTRIBUTE_AUTH,
     EPNO_ATTRIBUTE_MAX
@@ -124,11 +130,9 @@ public:
     }
 
     virtual int create() {
-        ALOGD("Creating message to get scan capablities; iface = %d", mIfaceInfo->id);
-
         int ret = mMsg.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_GET_CAPABILITIES);
         if (ret < 0) {
-            ALOGD("NL message creation failed");
+            ALOGE("NL message creation failed");
             return ret;
         }
 
@@ -138,10 +142,8 @@ public:
 protected:
     virtual int handleResponse(WifiEvent& reply) {
 
-        ALOGD("In GetCapabilities::handleResponse");
-
         if (reply.get_cmd() != NL80211_CMD_VENDOR) {
-            ALOGD("Ignoring reply with cmd = %d", reply.get_cmd());
+            ALOGE("Ignoring reply with cmd = %d", reply.get_cmd());
             return NL_SKIP;
         }
 
@@ -151,9 +153,6 @@ protected:
         void *data = reply.get_vendor_data();
         int len = reply.get_vendor_data_len();
 
-        ALOGD("Id = %0x, subcmd = %d, len = %d, expected len = %d", id, subcmd, len,
-                    sizeof(*mCapabilities));
-
         memcpy(mCapabilities, data, min(len, (int) sizeof(*mCapabilities)));
 
         return NL_OK;
@@ -183,8 +182,6 @@ public:
         memset(channels, 0, sizeof(wifi_channel) * max_channels);
     }
     virtual int create() {
-        ALOGD("Creating message to get channel list; iface = %d", mIfaceInfo->id);
-
         int ret = mMsg.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_GET_VALID_CHANNELS);
         if (ret < 0) {
             return ret;
@@ -204,10 +201,8 @@ public:
 protected:
     virtual int handleResponse(WifiEvent& reply) {
 
-        ALOGD("In GetChannelList::handleResponse");
-
         if (reply.get_cmd() != NL80211_CMD_VENDOR) {
-            ALOGD("Ignoring reply with cmd = %d", reply.get_cmd());
+            ALOGE("Ignoring reply with cmd = %d", reply.get_cmd());
             return NL_SKIP;
         }
 
@@ -218,7 +213,6 @@ protected:
         nlattr *vendor_data = reply.get_attribute(NL80211_ATTR_VENDOR_DATA);
         int len = reply.get_vendor_data_len();
 
-        ALOGD("Id = %0x, subcmd = %d, len = %d", id, subcmd, len);
         if (vendor_data == NULL || len == 0) {
             ALOGE("no vendor data in GetChannelList response; ignoring it");
             return NL_SKIP;
@@ -227,7 +221,7 @@ protected:
         for (nl_iterator it(vendor_data); it.has_next(); it.next()) {
             if (it.get_type() == GSCAN_ATTRIBUTE_NUM_CHANNELS) {
                 num_channels_to_copy = it.get_u32();
-                ALOGD("Got channel list with %d channels", num_channels_to_copy);
+                /*ALOGD("Got channel list with %d channels", num_channels_to_copy);*/
                 if(num_channels_to_copy > max_channels)
                     num_channels_to_copy = max_channels;
                 *num_channels = num_channels_to_copy;
@@ -262,7 +256,6 @@ static int parseScanResults(wifi_scan_result *results, int num, nlattr *attr)
     for (nl_iterator it(attr); it.has_next() && i < num; it.next(), i++) {
 
         int index = it.get_type();
-        ALOGD("retrieved scan result %d", index);
         nlattr *sc_data = (nlattr *) it.get_data();
         wifi_scan_result *result = results + i;
 
@@ -423,14 +416,13 @@ public:
     }
 
     int start() {
-        ALOGD(" sending scan req to driver");
+        ALOGD("starting Gscan");
         WifiRequest request(familyId(), ifaceId());
         int result = createSetupRequest(request);
         if (result != WIFI_SUCCESS) {
             ALOGE("failed to create setup request; result = %d", result);
             return result;
         }
-        ALOGD("Starting scan");
 
         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_SCAN_RESULTS_AVAILABLE);
         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_COMPLETE_SCAN);
@@ -454,12 +446,12 @@ public:
             return result;
         }
 
-      
+
         return result;
     }
 
     virtual int cancel() {
-        ALOGD("Stopping scan");
+        ALOGD("Stopping Gscan");
 
         WifiRequest request(familyId(), ifaceId());
         int result = createStopRequest(request);
@@ -485,28 +477,24 @@ public:
     }
 
     virtual int handleEvent(WifiEvent& event) {
-        ALOGD("Got a scan results event");
-
-        event.log();
+        //event.log();
 
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
         unsigned int len = event.get_vendor_data_len();
         int event_id = event.get_vendor_subcmd();
-        ALOGD("handleEvent, event_id = %d", event_id);
 
         if(event_id == GSCAN_EVENT_COMPLETE_SCAN) {
             if (vendor_data == NULL || len != 4) {
-                ALOGD("Scan complete type not mentioned!");
+                ALOGE("Scan complete type not mentioned!");
                 return NL_SKIP;
             }
             wifi_scan_event evt_type;
 
             evt_type = (wifi_scan_event) event.get_u32(NL80211_ATTR_VENDOR_DATA);
-            ALOGD("Scan complete: Received event type %d", evt_type);
             if(*mHandler.on_scan_event)
                 (*mHandler.on_scan_event)(evt_type, evt_type);
         } else if(event_id == GSCAN_EVENT_FULL_SCAN_RESULTS) {
-            uint32_t bucket_scanned;
+            uint32_t bucket_scanned = 0;
             wifi_scan_result *scan_result = NULL;
             for (nl_iterator it(vendor_data); it.has_next(); it.next()) {
                 if (it.get_type() == GSCAN_ATTRIBUTE_SCAN_BUCKET_BIT) {
@@ -519,7 +507,7 @@ public:
             if (scan_result) {
                 if(*mHandler.on_full_scan_result)
                     (*mHandler.on_full_scan_result)(id(), scan_result, bucket_scanned);
-
+/*
                     ALOGD("%-32s\t", scan_result->ssid);
                     ALOGD("%02x:%02x:%02x:%02x:%02x:%02x ", scan_result->bssid[0], scan_result->bssid[1],
                             scan_result->bssid[2], scan_result->bssid[3], scan_result->bssid[4], scan_result->bssid[5]);
@@ -528,6 +516,7 @@ public:
                     ALOGD("%lld\t", scan_result->ts);
                     ALOGD("%lld\t", scan_result->rtt);
                     ALOGD("%lld\n", scan_result->rtt_sd);
+*/
             }
         }
         return NL_SKIP;
@@ -544,8 +533,6 @@ wifi_error wifi_start_gscan(
 {
     wifi_handle handle = getWifiHandle(iface);
 
-    ALOGD("Starting GScan, halHandle = %p", handle);
-
     ScanCommand *cmd = new ScanCommand(iface, id, &params, handler);
     wifi_register_cmd(handle, id, cmd);
     return (wifi_error)cmd->start();
@@ -553,7 +540,6 @@ wifi_error wifi_start_gscan(
 
 wifi_error wifi_stop_gscan(wifi_request_id id, wifi_interface_handle iface)
 {
-    ALOGD("Stopping GScan");
     wifi_handle handle = getWifiHandle(iface);
 
     if(id == -1) {
@@ -594,7 +580,10 @@ public:
             wifi_cached_scan_results *results, int max, int *num)
         : WifiCommand(iface, -1), mScans(results), mMax(max), mNum(num),
                 mRetrieved(0), mFlush(flush), mCompleted(0)
-    { }
+    {
+        memset(mScanResults,0,sizeof(mScanResults));
+        mNextScanResult = 0;
+    }
 
     int createRequest(WifiRequest& request, int num, byte flush) {
         int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_GET_SCAN_RESULTS);
@@ -614,7 +603,6 @@ public:
 
     int execute() {
         WifiRequest request(familyId(), ifaceId());
-        ALOGD("retrieving %d scan results", mMax);
 
         for (int i = 0; i < 10 && mRetrieved < mMax; i++) {
             int result = createRequest(request, (mMax - mRetrieved), mFlush);
@@ -646,18 +634,15 @@ public:
     }
 
     virtual int handleResponse(WifiEvent& reply) {
-        ALOGD("In GetScanResultsCommand::handleResponse");
 
         if (reply.get_cmd() != NL80211_CMD_VENDOR) {
-            ALOGD("Ignoring reply with cmd = %d", reply.get_cmd());
+            ALOGE("Ignoring reply with cmd = %d", reply.get_cmd());
             return NL_SKIP;
         }
 
         int id = reply.get_vendor_id();
         int subcmd = reply.get_vendor_subcmd();
 
-        ALOGD("Id = %0x, subcmd = %d", id, subcmd);
-
         nlattr *vendor_data = reply.get_attribute(NL80211_ATTR_VENDOR_DATA);
         int len = reply.get_vendor_data_len();
 
@@ -669,19 +654,19 @@ public:
         for (nl_iterator it(vendor_data); it.has_next(); it.next()) {
             if (it.get_type() == GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE) {
                 mCompleted = it.get_u8();
-                ALOGD("retrieved mCompleted flag : %d", mCompleted);
+                //ALOGD("retrieved mCompleted flag : %d", mCompleted);
             } else if (it.get_type() == GSCAN_ATTRIBUTE_SCAN_RESULTS || it.get_type() == 0) {
                 int scan_id = 0, flags = 0, num = 0;
                 for (nl_iterator it2(it.get()); it2.has_next(); it2.next()) {
                     if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_ID) {
                         scan_id = it2.get_u32();
-                        ALOGD("retrieved scan_id : 0x%0x", scan_id);
+                        //ALOGD("retrieved scan_id : 0x%0x", scan_id);
                     } else if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_FLAGS) {
                         flags = it2.get_u8();
-                        ALOGD("retrieved scan_flags : 0x%0x", flags);
+                        //ALOGD("retrieved scan_flags : 0x%0x", flags);
                     } else if (it2.get_type() == GSCAN_ATTRIBUTE_NUM_OF_RESULTS) {
                         num = it2.get_u32();
-                        ALOGD("retrieved num_results: %d", num);
+                        //ALOGD("retrieved num_results: %d", num);
                     } else if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_RESULTS) {
                         if (mRetrieved >= mMax) {
                             ALOGW("Stored %d scans, ignoring excess results", mRetrieved);
@@ -692,19 +677,19 @@ public:
                         num = min((int)MAX_AP_CACHE_PER_SCAN, num);
                         memcpy(mScanResults + mNextScanResult, it2.get_data(),
                                 sizeof(wifi_scan_result) * num);
-                        ALOGD("Retrieved %d scan results", num);
                         wifi_scan_result *results = (wifi_scan_result *)it2.get_data();
+                        /*
                         for (int i = 0; i < num; i++) {
                             wifi_scan_result *result = results + i;
                             ALOGD("%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->rssi);
-                        }
+                        }*/
                         mScans[mRetrieved].scan_id = scan_id;
                         mScans[mRetrieved].flags = flags;
                         mScans[mRetrieved].num_results = num;
-                        ALOGD("Setting result of scan_id : 0x%0x", mScans[mRetrieved].scan_id);
+                        //ALOGD("Setting result of scan_id : 0x%0x", mScans[mRetrieved].scan_id);
                         memcpy(mScans[mRetrieved].results,
                                 &(mScanResults[mNextScanResult]), num * sizeof(wifi_scan_result));
                         mNextScanResult += num;
@@ -726,8 +711,6 @@ public:
 
 wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, byte flush,
         int max, wifi_cached_scan_results *results, int *num) {
-    ALOGD("Getting cached scan results, iface handle = %p, num = %d", iface, *num);
-
     GetScanResultsCommand *cmd = new GetScanResultsCommand(iface, flush, results, max, num);
     return (wifi_error)cmd->execute();
 }
@@ -745,7 +728,9 @@ public:
     BssidHotlistCommand(wifi_interface_handle handle, int id,
             wifi_bssid_hotlist_params params, wifi_hotlist_ap_found_handler handler)
         : WifiCommand(handle, id), mParams(params), mHandler(handler)
-    { }
+    {
+            memset(mResults, 0, sizeof(mResults));
+    }
 
     int createSetupRequest(WifiRequest& request) {
         int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_BSSID_HOTLIST);
@@ -796,7 +781,6 @@ public:
     }
 
     int start() {
-        ALOGD("Executing hotlist setup request, num = %d", mParams.num_bssid);
         WifiRequest request(familyId(), ifaceId());
         int result = createSetupRequest(request);
         if (result < 0) {
@@ -805,14 +789,12 @@ public:
 
         result = requestResponse(request);
         if (result < 0) {
-            ALOGD("Failed to execute hotlist setup request, result = %d", result);
+            ALOGE("Failed to execute hotlist setup request, result = %d", result);
             unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_FOUND);
             unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_LOST);
             return result;
         }
 
-        ALOGD("Successfully set %d APs in the hotlist", mParams.num_bssid);
-
         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_FOUND);
         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_LOST);
 
@@ -835,7 +817,6 @@ public:
             return result;
         }
 
-        ALOGD("Successfully reset APs in current hotlist");
         return result;
     }
 
@@ -845,19 +826,17 @@ public:
     }
 
     virtual int handleEvent(WifiEvent& event) {
-        ALOGD("Hotlist AP event");
         int event_id = event.get_vendor_subcmd();
-        event.log();
+        //event.log();
 
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
         int len = event.get_vendor_data_len();
 
         if (vendor_data == NULL || len == 0) {
-            ALOGD("No scan results found");
+            ALOGE("No scan results found");
             return NL_SKIP;
         }
 
-        memset(mResults, 0, sizeof(wifi_scan_result) * MAX_RESULTS);
 
         int num = len / sizeof(wifi_scan_result);
         num = min(MAX_RESULTS, num);
@@ -922,7 +901,10 @@ public:
     SignificantWifiChangeCommand(wifi_interface_handle handle, int id,
             wifi_significant_change_params params, wifi_significant_change_handler handler)
         : WifiCommand(handle, id), mParams(params), mHandler(handler)
-    { }
+    {
+        memset(mResultsBuffer,0,sizeof(mResultsBuffer));
+        memset(mResults,0,sizeof(mResults));
+    }
 
     int createSetupRequest(WifiRequest& request) {
         int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_SIGNIFICANT_CHANGE);
@@ -984,7 +966,6 @@ public:
     }
 
     int start() {
-        ALOGD("Set significant wifi change");
         WifiRequest request(familyId(), ifaceId());
 
         int result = createSetupRequest(request);
@@ -994,7 +975,7 @@ public:
 
         result = requestResponse(request);
         if (result < 0) {
-            ALOGD("failed to set significant wifi change %d", result);
+            ALOGE("failed to set significant wifi change %d", result);
             return result;
         }
         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS);
@@ -1019,7 +1000,6 @@ public:
             return result;
         }
 
-        ALOGD("successfully reset significant wifi change");
         return result;
     }
 
@@ -1029,13 +1009,11 @@ public:
     }
 
     virtual int handleEvent(WifiEvent& event) {
-        ALOGD("Got a significant wifi change event");
-
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
         int len = event.get_vendor_data_len();
 
         if (vendor_data == NULL || len == 0) {
-            ALOGD("No scan results found");
+            ALOGE("No scan results found");
             return NL_SKIP;
         }
 
@@ -1065,8 +1043,6 @@ public:
             mResults[i] = reinterpret_cast<wifi_significant_change_result *>(&(mResultsBuffer[i]));
         }
 
-        ALOGD("Retrieved %d scan results", num);
-
         if (num != 0) {
             (*mHandler.on_significant_change)(id(), num, mResults);
         } else {
@@ -1101,21 +1077,20 @@ wifi_error wifi_reset_significant_change_handler(wifi_request_id id, wifi_interf
 
     return WIFI_ERROR_INVALID_ARGS;
 }
-#ifdef ANDROID_N_EPNO
+
 class ePNOCommand : public WifiCommand
 {
 private:
-    wifi_epno_network *ssid_list;
-    int               num_ssid;
+    wifi_epno_params  *epno_params;
     wifi_epno_handler mHandler;
     wifi_scan_result  mResults;
 public:
     ePNOCommand(wifi_interface_handle handle, int id,
-            int num_networks, wifi_epno_network *networks, wifi_epno_handler handler)
+            wifi_epno_params *params, wifi_epno_handler handler)
         : WifiCommand(handle, id), mHandler(handler)
     {
-        ssid_list = networks;
-        num_ssid = num_networks;
+        epno_params = params;
+        memset(&mResults,0,sizeof(wifi_scan_result));
     }
 
     int createSetupRequest(WifiRequest& request) {
@@ -1125,39 +1100,76 @@ public:
         }
 
         nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA);
-
-        result = request.put_u8(EPNO_ATTRIBUTE_SSID_NUM, num_ssid);
+        if (epno_params == NULL) {
+            result = request.put_u8(EPNO_ATTRIBUTE_SSID_NUM, 0);
+            if (result < 0) {
+                return result;
+            }
+            request.attr_end(data);
+            return result;
+        }
+        result = request.put_u16(EPNO_ATTRIBUTE_MINIMUM_5G_RSSI, epno_params->min5GHz_rssi);
         if (result < 0) {
             return result;
         }
+        result = request.put_u16(EPNO_ATTRIBUTE_MINIMUM_2G_RSSI, epno_params->min24GHz_rssi);
+        if (result < 0) {
+            return result;
+        }
+        result = request.put_u16(EPNO_ATTRIBUTE_INITIAL_SCORE_MAX, epno_params->initial_score_max);
+        if (result < 0) {
+            return result;
+        }
+        result = request.put_u8(EPNO_ATTRIBUTE_CUR_CONN_BONUS, epno_params->current_connection_bonus);
+        if (result < 0) {
+            return result;
+        }
+        result = request.put_u8(EPNO_ATTRIBUTE_SAME_NETWORK_BONUS, epno_params->same_network_bonus);
+        if (result < 0) {
+            return result;
+        }
+        result = request.put_u8(EPNO_ATTRIBUTE_SECURE_BONUS, epno_params->secure_bonus);
+        if (result < 0) {
+            return result;
+        }
+        result = request.put_u8(EPNO_ATTRIBUTE_5G_BONUS, epno_params->band5GHz_bonus);
+        if (result < 0) {
+            return result;
+        }
+        result = request.put_u8(EPNO_ATTRIBUTE_SSID_NUM, epno_params->num_networks);
+        if (result < 0) {
+            return result;
+        }
+
+       ALOGI("ePNO [min5GHz_rssi:%d min24GHz_rssi:%d initial_score_max:%d current_connection_bonus:%d same_network_bonus:%d secure_bonus:%d band5GHz_bonus:%d num_networks:%d]",
+         epno_params->min5GHz_rssi,
+         epno_params->min24GHz_rssi,
+         epno_params->initial_score_max,
+         epno_params->current_connection_bonus,
+         epno_params->same_network_bonus,
+         epno_params->secure_bonus,
+         epno_params->band5GHz_bonus,
+         epno_params->num_networks);
 
         struct nlattr * attr = request.attr_start(EPNO_ATTRIBUTE_SSID_LIST);
-        for (int i = 0; i < num_ssid; i++) {
+        for (int i = 0; i < epno_params->num_networks; i++) {
             nlattr *attr2 = request.attr_start(i);
             if (attr2 == NULL) {
                 return WIFI_ERROR_OUT_OF_MEMORY;
             }
-            result = request.put(EPNO_ATTRIBUTE_SSID, ssid_list[i].ssid, 32);
-            ALOGI("ePNO [SSID:%s rssi_thresh:%d flags:%d auth:%d]", ssid_list[i].ssid,
-                (signed char)ssid_list[i].rssi_threshold, ssid_list[i].flags,
-                ssid_list[i].auth_bit_field);
+            result = request.put_u16(EPNO_ATTRIBUTE_FLAGS, epno_params->networks[i].flags);
             if (result < 0) {
                 return result;
             }
-            result = request.put_u8(EPNO_ATTRIBUTE_SSID_LEN, strlen(ssid_list[i].ssid));
+            result = request.put_u8(EPNO_ATTRIBUTE_AUTH, epno_params->networks[i].auth_bit_field);
             if (result < 0) {
                 return result;
             }
-
-            result = request.put_u8(EPNO_ATTRIBUTE_RSSI, ssid_list[i].rssi_threshold);
-            if (result < 0) {
-                return result;
-            }
-            result = request.put_u8(EPNO_ATTRIBUTE_FLAGS, ssid_list[i].flags);
+            result = request.put_u8(EPNO_ATTRIBUTE_SSID_LEN, strlen(epno_params->networks[i].ssid));
             if (result < 0) {
                 return result;
             }
-            result = request.put_u8(EPNO_ATTRIBUTE_AUTH, ssid_list[i].auth_bit_field);
+            result = request.put(EPNO_ATTRIBUTE_SSID, epno_params->networks[i].ssid, strlen(epno_params->networks[i].ssid));
             if (result < 0) {
                 return result;
             }
@@ -1170,7 +1182,7 @@ public:
     }
 
     int start() {
-        ALOGI("ePNO num_network=%d", num_ssid);
+        ALOGI("ePNO num_network=%d", epno_params ? epno_params->num_networks : 0);
         WifiRequest request(familyId(), ifaceId());
         int result = createSetupRequest(request);
         if (result < 0) {
@@ -1184,8 +1196,9 @@ public:
             return result;
         }
 
-        ALOGI("Successfully set %d SSIDs for ePNO", num_ssid);
-        registerVendorHandler(GOOGLE_OUI, WIFI_EPNO_EVENT);
+        if (epno_params) {
+            registerVendorHandler(GOOGLE_OUI, WIFI_EPNO_EVENT);
+        }
         return result;
     }
 
@@ -1201,7 +1214,6 @@ public:
     }
 
     virtual int handleEvent(WifiEvent& event) {
-        ALOGI("ePNO event");
         int event_id = event.get_vendor_subcmd();
         // event.log();
 
@@ -1213,6 +1225,7 @@ public:
             return NL_SKIP;
         }
 
+
         mResults = *(wifi_scan_result *) event.get_vendor_data();
         if (*mHandler.on_network_found)
             (*mHandler.on_network_found)(id(), 1, &mResults);
@@ -1222,19 +1235,32 @@ public:
 
 wifi_error wifi_set_epno_list(wifi_request_id id,
                               wifi_interface_handle iface,
-                              int num_networks,
-                              wifi_epno_network * networks,
+                              const wifi_epno_params *epno_params,
                               wifi_epno_handler handler)
 {
-     wifi_handle handle = getWifiHandle(iface);
-
-     ePNOCommand *cmd = new ePNOCommand(iface, id, num_networks, networks, handler);
-     wifi_register_cmd(handle, id, cmd);
-     wifi_error result = (wifi_error)cmd->start();
-     if (result != WIFI_SUCCESS) {
-         wifi_unregister_cmd(handle, id);
-     }
-     return result;
+    wifi_handle handle = getWifiHandle(iface);
+    ePNOCommand *cmd = new ePNOCommand(iface, id, (wifi_epno_params *)epno_params, handler);
+    wifi_register_cmd(handle, id, cmd);
+    wifi_error result = (wifi_error)cmd->start();
+    if (result != WIFI_SUCCESS) {
+        wifi_unregister_cmd(handle, id);
+    }
+    return result;
+}
+
+wifi_error wifi_reset_epno_list(wifi_request_id id, wifi_interface_handle iface)
+{
+    wifi_handle handle = getWifiHandle(iface);
+    wifi_epno_handler handler;
+
+    handler.on_network_found = NULL;
+    ePNOCommand *cmd = new ePNOCommand(iface, id, NULL, handler);
+    wifi_register_cmd(handle, id, cmd);
+    wifi_error result = (wifi_error)cmd->start();
+    if (result != WIFI_SUCCESS) {
+        wifi_unregister_cmd(handle, id);
+    }
+    return result;
 }
 
 class HsListCommand : public WifiCommand
@@ -1254,6 +1280,7 @@ public:
         int num)
         : WifiCommand(iface, id), num_hs(num), mNetworks(NULL)
     {
+        mHandler.on_passpoint_network_found = NULL;
     }
 
     int createRequest(WifiRequest& request, int val) {
@@ -1342,14 +1369,11 @@ public:
     }
 
     virtual int handleResponse(WifiEvent& reply) {
-         ALOGD("Request complete!");
         /* Nothing to do on response! */
         return NL_SKIP;
     }
 
     virtual int handleEvent(WifiEvent& event) {
-
-        ALOGI("hotspot matched event");
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
         unsigned int len = event.get_vendor_data_len();
         if (vendor_data == NULL || len < sizeof(wifi_scan_result)) {
@@ -1364,17 +1388,6 @@ public:
         int anqp_len = *(u16 *)anqp;
         anqp += sizeof(u16);
 
-        ALOGI("%-32s\t", result->ssid);
-
-        ALOGI("%02x:%02x:%02x:%02x:%02x:%02x ", result->bssid[0], result->bssid[1],
-                result->bssid[2], result->bssid[3], result->bssid[4], result->bssid[5]);
-
-        ALOGI("%d\t", result->rssi);
-        ALOGI("%d\t", result->channel);
-        ALOGI("%lld\t", result->ts);
-        ALOGI("%lld\t", result->rtt);
-        ALOGI("%lld\n", result->rtt_sd);
-
         if(*mHandler.on_passpoint_network_found)
             (*mHandler.on_passpoint_network_found)(id(), networkId, result, anqp_len, anqp);
 
@@ -1410,7 +1423,9 @@ wifi_error wifi_reset_passpoint_list(wifi_request_id id, wifi_interface_handle i
     wifi_unregister_cmd(handle, id);
     return result;
 }
-#endif
+
+#if 0 // TODO: (IP) removed to make it build
+
 class BssidBlacklistCommand : public WifiCommand
 {
 private:
@@ -1443,7 +1458,6 @@ public:
     }
 
     int start() {
-        ALOGD("Executing bssid blacklist request, num = %d", mParams->num_bssid);
         WifiRequest request(familyId(), ifaceId());
         int result = createRequest(request);
         if (result < 0) {
@@ -1456,7 +1470,6 @@ public:
             return result;
         }
 
-        ALOGI("Successfully added %d blacklist bssids", mParams->num_bssid);
         return result;
     }
 
@@ -1477,4 +1490,5 @@ wifi_error wifi_set_bssid_blacklist(wifi_request_id id, wifi_interface_handle if
     //release the reference of command as well
     cmd->releaseRef();
     return result;
-}
\ No newline at end of file
+}
+#endif