OSDN Git Service

Better logging for GetWiphyInfo()
authorNingyuan Wang <nywang@google.com>
Fri, 10 Feb 2017 02:08:40 +0000 (18:08 -0800)
committerNingyuan Wang <nywang@google.com>
Fri, 10 Feb 2017 17:44:42 +0000 (09:44 -0800)
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
net/netlink_utils.cpp

index 9545e6d..d66ea59 100644 (file)
@@ -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_,
index 559650b..bcd369a 100644 (file)
@@ -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<NL80211NestedAttr> freqs;