From d20effd2f91755cc239c04acfdf41dc657a693fd Mon Sep 17 00:00:00 2001 From: Jaya Prakash Sangaru Date: Fri, 15 Sep 2017 15:05:46 +0530 Subject: [PATCH] [9610][7872][7570][7885] wlbt: Reduce gscan logGing Reduce excessive gscan logGing in wifi-Hal SCSC-Bug-Id:SSB-32490 Change-Id: I5ac7cf331abc798570aceeb89af0c7a21d99880b Signed-off-by: Jaya Prakash Sangaru --- common.cpp | 28 ++++++++++++++++------------ cpp_bindings.h | 2 +- gscan.cpp | 31 ++++++++++++++++--------------- wifi_hal.cpp | 3 ++- 4 files changed, 35 insertions(+), 29 deletions(-) diff --git a/common.cpp b/common.cpp index 6a4ea1a..b28a815 100755 --- a/common.cpp +++ b/common.cpp @@ -65,8 +65,9 @@ wifi_error wifi_register_handler(wifi_handle handle, int cmd, nl_recvmsg_msg_cb_ info->event_cb[info->num_event_cb].vendor_subcmd = 0; info->event_cb[info->num_event_cb].cb_func = func; info->event_cb[info->num_event_cb].cb_arg = arg; + /* ALOGI("Successfully added event handler %p:%p for command %d at %d", - arg, func, cmd, info->num_event_cb); + arg, func, cmd, info->num_event_cb);*/ info->num_event_cb++; result = WIFI_SUCCESS; } @@ -83,19 +84,20 @@ wifi_error wifi_register_vendor_handler(wifi_handle handle, //ALOGD("GSCAN register handle wifi_register_vendor_handler %p", handle); /* TODO: check for multiple handlers? */ pthread_mutex_lock(&info->cb_lock); - ALOGI("Added event handler %p", info); + //ALOGI("Added event handler %p", info); wifi_error result = WIFI_ERROR_OUT_OF_MEMORY; - // ALOGD("register_vendor_handler: handle = %p", handle); + // ALOGD("register_vendor_handler: handle = %p", handle); if (info->num_event_cb < info->alloc_event_cb) { info->event_cb[info->num_event_cb].nl_cmd = NL80211_CMD_VENDOR; info->event_cb[info->num_event_cb].vendor_id = id; info->event_cb[info->num_event_cb].vendor_subcmd = subcmd; info->event_cb[info->num_event_cb].cb_func = func; info->event_cb[info->num_event_cb].cb_arg = arg; + /* ALOGI("Added event handler %p:%p for vendor 0x%0x and subcmd 0x%0x at %d", - arg, func, id, subcmd, info->num_event_cb); + arg, func, id, subcmd, info->num_event_cb);*/ info->num_event_cb++; result = WIFI_SUCCESS; } @@ -117,8 +119,9 @@ void wifi_unregister_handler(wifi_handle handle, int cmd) for (int i = 0; i < info->num_event_cb; i++) { if (info->event_cb[i].nl_cmd == cmd) { + /* ALOGI("Successfully removed event handler %p:%p for cmd = 0x%0x from %d", - info->event_cb[i].cb_arg, info->event_cb[i].cb_func, cmd, i); + info->event_cb[i].cb_arg, info->event_cb[i].cb_func, cmd, i);*/ memmove(&info->event_cb[i], &info->event_cb[i+1], (info->num_event_cb - i - 1) * sizeof(cb_info)); @@ -141,8 +144,9 @@ void wifi_unregister_vendor_handler(wifi_handle handle, uint32_t id, int subcmd) if (info->event_cb[i].nl_cmd == NL80211_CMD_VENDOR && info->event_cb[i].vendor_id == id && info->event_cb[i].vendor_subcmd == subcmd) { + /* ALOGI("Successfully removed event handler %p:%p for vendor 0x%0x, subcmd 0x%0x from %d", - info->event_cb[i].cb_arg, info->event_cb[i].cb_func, id, subcmd, i); + info->event_cb[i].cb_arg, info->event_cb[i].cb_func, id, subcmd, i);*/ memmove(&info->event_cb[i], &info->event_cb[i+1], (info->num_event_cb - i - 1) * sizeof(cb_info)); info->num_event_cb--; @@ -158,14 +162,14 @@ wifi_error wifi_register_cmd(wifi_handle handle, int id, WifiCommand *cmd) { hal_info *info = (hal_info *)handle; - ALOGD("registering command %d", id); + //ALOGD("registering command %d", id); wifi_error result = WIFI_ERROR_OUT_OF_MEMORY; if (info->num_cmd < info->alloc_cmd) { info->cmd[info->num_cmd].id = id; info->cmd[info->num_cmd].cmd = cmd; - ALOGI("Successfully added command %d: %p at %d", id, cmd, info->num_cmd); + //ALOGI("Successfully added command %d: %p at %d", id, cmd, info->num_cmd); info->num_cmd++; result = WIFI_SUCCESS; } @@ -177,7 +181,7 @@ WifiCommand *wifi_unregister_cmd(wifi_handle handle, int id) { hal_info *info = (hal_info *)handle; - ALOGD("un-registering command %d", id); + //ALOGD("un-registering command %d", id); WifiCommand *cmd = NULL; @@ -186,7 +190,7 @@ WifiCommand *wifi_unregister_cmd(wifi_handle handle, int id) cmd = info->cmd[i].cmd; memmove(&info->cmd[i], &info->cmd[i+1], (info->num_cmd - i) * sizeof(cmd_info)); info->num_cmd--; - ALOGI("Successfully removed command %d: %p from %d", id, cmd, i); + //ALOGI("Successfully removed command %d: %p from %d", id, cmd, i); break; } } @@ -219,7 +223,7 @@ void wifi_unregister_cmd(wifi_handle handle, WifiCommand *cmd) int id = info->cmd[i].id; memmove(&info->cmd[i], &info->cmd[i+1], (info->num_cmd - i) * sizeof(cmd_info)); info->num_cmd--; - ALOGI("Successfully removed command %d: %p from %d", id, cmd, i); + //ALOGI("Successfully removed command %d: %p from %d", id, cmd, i); break; } } @@ -230,7 +234,7 @@ wifi_error wifi_cancel_cmd(wifi_request_id id, wifi_interface_handle iface) wifi_handle handle = getWifiHandle(iface); WifiCommand *cmd = wifi_unregister_cmd(handle, id); - ALOGD("Cancel WifiCommand = %p", cmd); + //ALOGD("Cancel WifiCommand = %p", cmd); if (cmd) { cmd->cancel(); cmd->releaseRef(); diff --git a/cpp_bindings.h b/cpp_bindings.h index 0864d87..d1e1e5a 100755 --- a/cpp_bindings.h +++ b/cpp_bindings.h @@ -261,7 +261,7 @@ public: virtual int create() { /* by default there is no way to cancel */ - ALOGD("WifiCommand %p can't be created", this); + //ALOGD("WifiCommand %p can't be created", this); return WIFI_ERROR_NOT_SUPPORTED; } diff --git a/gscan.cpp b/gscan.cpp index 3c6d104..90989f9 100755 --- a/gscan.cpp +++ b/gscan.cpp @@ -143,7 +143,7 @@ protected: virtual int handleResponse(WifiEvent& reply) { 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; } @@ -202,7 +202,7 @@ protected: virtual int handleResponse(WifiEvent& reply) { 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; } @@ -477,7 +477,7 @@ public: } virtual int handleEvent(WifiEvent& event) { - event.log(); + //event.log(); nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA); unsigned int len = event.get_vendor_data_len(); @@ -507,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]); @@ -516,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; @@ -635,7 +636,7 @@ public: virtual int handleResponse(WifiEvent& reply) { 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; } @@ -653,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); @@ -676,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; @@ -788,7 +789,7 @@ 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; @@ -826,7 +827,7 @@ public: virtual int handleEvent(WifiEvent& 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(); @@ -974,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); diff --git a/wifi_hal.cpp b/wifi_hal.cpp index c6c7f02..937a6e0 100755 --- a/wifi_hal.cpp +++ b/wifi_hal.cpp @@ -405,8 +405,9 @@ static int internal_valid_message_handler(nl_msg *msg, void *arg) if (cmd == NL80211_CMD_VENDOR) { vendor_id = event.get_u32(NL80211_ATTR_VENDOR_ID); subcmd = event.get_u32(NL80211_ATTR_VENDOR_SUBCMD); + /* ALOGI("event received %s, vendor_id = 0x%0x, subcmd = 0x%0x", - event.get_cmdString(), vendor_id, subcmd); + event.get_cmdString(), vendor_id, subcmd);*/ } //ALOGI("event received %s, vendor_id = 0x%0x", event.get_cmdString(), vendor_id); -- 2.20.1