From 384f74dea0ad3b792428f39305b19c42c92c4039 Mon Sep 17 00:00:00 2001 From: Ningyuan Wang Date: Thu, 9 Feb 2017 18:08:40 -0800 Subject: [PATCH] Better logging for GetWiphyInfo() NL80211_ATTR_WIPHY_BANDS contains a list of anonymous attributes. Each anonymous attribute represents a band. NL80211_BAND_ATTR_FREQ is expected to be included in every anonymous attribute to specifying supported channels for this band. However, sometimes one of the anonymous attribute provided by kernel is empty, where NL80211_BAND_ATTR_FREQ is not included. This always happens on some type of devices. We should not log an error for this. Bug: 35220903 Test: compile, unit tests, manual test Change-Id: I0ef953266744713af627a17e7d10f04b937e0648 --- client_interface_impl.cpp | 6 ++++-- net/netlink_utils.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client_interface_impl.cpp b/client_interface_impl.cpp index 9545e6d..d66ea59 100644 --- a/client_interface_impl.cpp +++ b/client_interface_impl.cpp @@ -92,10 +92,12 @@ ClientInterfaceImpl::ClientInterfaceImpl( netlink_utils_->SubscribeMlmeEvent( interface_index_, mlme_event_handler_.get()); - netlink_utils_->GetWiphyInfo(wiphy_index_, + if (!netlink_utils_->GetWiphyInfo(wiphy_index_, &band_info_, &scan_capabilities_, - &wiphy_features_); + &wiphy_features_)) { + LOG(ERROR) << "Failed to get wiphy info from kernel"; + } scanner_ = new ScannerImpl(interface_index_, band_info_, scan_capabilities_, diff --git a/net/netlink_utils.cpp b/net/netlink_utils.cpp index 559650b..bcd369a 100644 --- a/net/netlink_utils.cpp +++ b/net/netlink_utils.cpp @@ -260,7 +260,7 @@ bool NetlinkUtils::ParseBandInfo(const NL80211Packet* const packet, for (unsigned int band_index = 0; band_index < bands.size(); band_index++) { NL80211NestedAttr freqs_attr(0); if (!bands[band_index].GetAttribute(NL80211_BAND_ATTR_FREQS, &freqs_attr)) { - LOG(ERROR) << "Failed to get NL80211_BAND_ATTR_FREQS"; + LOG(DEBUG) << "Failed to get NL80211_BAND_ATTR_FREQS"; continue; } vector freqs; -- 2.11.0