OSDN Git Service

More logging for wificond scanner
authorNingyuan Wang <nywang@google.com>
Wed, 22 Feb 2017 17:54:41 +0000 (09:54 -0800)
committerNingyuan Wang <nywang@google.com>
Wed, 22 Feb 2017 23:34:14 +0000 (15:34 -0800)
Bug: 35664772
Change-Id: I6b3bb4fc01e3c06dea246e3cd55c23f27d3a2195
Test: compile, manual test

client_interface_impl.cpp
net/netlink_manager.cpp
scanning/scanner_impl.cpp

index d66ea59..e5d4b55 100644 (file)
@@ -98,6 +98,8 @@ ClientInterfaceImpl::ClientInterfaceImpl(
                                &wiphy_features_)) {
     LOG(ERROR) << "Failed to get wiphy info from kernel";
   }
+  LOG(INFO) << "create scanner for interface with index: "
+            << (int)interface_index_;
   scanner_ = new ScannerImpl(interface_index_,
                              band_info_,
                              scan_capabilities_,
index 11d2cab..c37ca54 100644 (file)
@@ -614,8 +614,8 @@ void NetlinkManager::OnScanResultsReady(unique_ptr<const NL80211Packet> packet)
 
   auto handler = on_scan_result_ready_handler_.find(if_index);
   if (handler == on_scan_result_ready_handler_.end()) {
-    LOG(DEBUG) << "No handler for scan result notification from interface"
-               << " with index: " << if_index;
+    LOG(WARNING) << "No handler for scan result notification from interface"
+                 << " with index: " << if_index;
     return;
   }
 
index 0be5335..fa8ea23 100644 (file)
@@ -54,6 +54,8 @@ ScannerImpl::ScannerImpl(uint32_t interface_index,
       scan_utils_(scan_utils),
       scan_event_handler_(nullptr) {
   // Subscribe one-shot scan result notification from kernel.
+  LOG(INFO) << "subscribe scan result for interface with index: "
+            << (int)interface_index_;
   scan_utils_->SubscribeScanResultNotification(
       interface_index_,
       std::bind(&ScannerImpl::OnScanResultsReady,
@@ -68,6 +70,8 @@ ScannerImpl::ScannerImpl(uint32_t interface_index,
 }
 
 ScannerImpl::~ScannerImpl() {
+  LOG(INFO) << "Unsubscribe scan result for interface with index: "
+            << (int)interface_index_;
   scan_utils_->UnsubscribeScanResultNotification(interface_index_);
   scan_utils_->UnsubscribeSchedScanResultNotification(interface_index_);
 }
@@ -266,14 +270,18 @@ void ScannerImpl::OnScanResultsReady(
     bool aborted,
     vector<vector<uint8_t>>& ssids,
     vector<uint32_t>& frequencies) {
+  LOG(INFO) << "Received scan result notification from kernel.";
   scan_started_ = false;
   if (scan_event_handler_ != nullptr) {
     // TODO: Pass other parameters back once we find framework needs them.
     if (aborted) {
+      LOG(WARNING) << "Scan aborted";
       scan_event_handler_->OnScanFailed();
     } else {
       scan_event_handler_->OnScanResultReady();
     }
+  } else {
+    LOG(WARNING) << "No scan event handler found.";
   }
 }