mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 23:07:49 +00:00
Synchronize on_ring_buffer_data_callback and writeRingbufferFiles am: 25b3a6f0a4
Change-Id: Icb5730c2d13ba014bc63b5e69659a617c54b0004
This commit is contained in:
committed by
Automerger Merge Worker
commit
7a67f397d9
@@ -1314,13 +1314,18 @@ WifiStatus WifiChip::registerDebugRingBufferCallback() {
|
|||||||
LOG(ERROR) << "Error converting ring buffer status";
|
LOG(ERROR) << "Error converting ring buffer status";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto& target = shared_ptr_this->ringbuffer_map_.find(name);
|
{
|
||||||
if (target != shared_ptr_this->ringbuffer_map_.end()) {
|
std::unique_lock<std::mutex> lk(shared_ptr_this->lock_t);
|
||||||
Ringbuffer& cur_buffer = target->second;
|
const auto& target =
|
||||||
cur_buffer.append(data);
|
shared_ptr_this->ringbuffer_map_.find(name);
|
||||||
} else {
|
if (target != shared_ptr_this->ringbuffer_map_.end()) {
|
||||||
LOG(ERROR) << "Ringname " << name << " not found";
|
Ringbuffer& cur_buffer = target->second;
|
||||||
return;
|
cur_buffer.append(data);
|
||||||
|
} else {
|
||||||
|
LOG(ERROR) << "Ringname " << name << " not found";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// unlock
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
legacy_hal::wifi_error legacy_status =
|
legacy_hal::wifi_error legacy_status =
|
||||||
@@ -1595,25 +1600,29 @@ bool WifiChip::writeRingbufferFilesInternal() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// write ringbuffers to file
|
// write ringbuffers to file
|
||||||
for (const auto& item : ringbuffer_map_) {
|
{
|
||||||
const Ringbuffer& cur_buffer = item.second;
|
std::unique_lock<std::mutex> lk(lock_t);
|
||||||
if (cur_buffer.getData().empty()) {
|
for (const auto& item : ringbuffer_map_) {
|
||||||
continue;
|
const Ringbuffer& cur_buffer = item.second;
|
||||||
}
|
if (cur_buffer.getData().empty()) {
|
||||||
const std::string file_path_raw =
|
continue;
|
||||||
kTombstoneFolderPath + item.first + "XXXXXXXXXX";
|
}
|
||||||
const int dump_fd = mkstemp(makeCharVec(file_path_raw).data());
|
const std::string file_path_raw =
|
||||||
if (dump_fd == -1) {
|
kTombstoneFolderPath + item.first + "XXXXXXXXXX";
|
||||||
PLOG(ERROR) << "create file failed";
|
const int dump_fd = mkstemp(makeCharVec(file_path_raw).data());
|
||||||
return false;
|
if (dump_fd == -1) {
|
||||||
}
|
PLOG(ERROR) << "create file failed";
|
||||||
unique_fd file_auto_closer(dump_fd);
|
return false;
|
||||||
for (const auto& cur_block : cur_buffer.getData()) {
|
}
|
||||||
if (write(dump_fd, cur_block.data(),
|
unique_fd file_auto_closer(dump_fd);
|
||||||
sizeof(cur_block[0]) * cur_block.size()) == -1) {
|
for (const auto& cur_block : cur_buffer.getData()) {
|
||||||
PLOG(ERROR) << "Error writing to file";
|
if (write(dump_fd, cur_block.data(),
|
||||||
|
sizeof(cur_block[0]) * cur_block.size()) == -1) {
|
||||||
|
PLOG(ERROR) << "Error writing to file";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// unlock
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#include <android-base/macros.h>
|
#include <android-base/macros.h>
|
||||||
#include <android/hardware/wifi/1.4/IWifiChip.h>
|
#include <android/hardware/wifi/1.4/IWifiChip.h>
|
||||||
@@ -272,6 +273,7 @@ class WifiChip : public V1_4::IWifiChip {
|
|||||||
bool is_valid_;
|
bool is_valid_;
|
||||||
// Members pertaining to chip configuration.
|
// Members pertaining to chip configuration.
|
||||||
uint32_t current_mode_id_;
|
uint32_t current_mode_id_;
|
||||||
|
std::mutex lock_t;
|
||||||
std::vector<IWifiChip::ChipMode> modes_;
|
std::vector<IWifiChip::ChipMode> modes_;
|
||||||
// The legacy ring buffer callback API has only a global callback
|
// The legacy ring buffer callback API has only a global callback
|
||||||
// registration mechanism. Use this to check if we have already
|
// registration mechanism. Use this to check if we have already
|
||||||
|
|||||||
Reference in New Issue
Block a user