move wlan dump to relevant devices

Bug: 273380509
Test: adb bugreport
Change-Id: Id3e11e69a1a0c6502ab2e7883cec34659922f660
This commit is contained in:
Adam Shih 2023-03-30 13:53:05 +08:00
parent 22e4a142b5
commit 15d11de144
2 changed files with 0 additions and 36 deletions

View file

@ -68,29 +68,12 @@ void endSection(int fd, const std::string &sectionName, timepoint_t startTime) {
"\n", fd); "\n", fd);
} }
Dumpstate::Dumpstate()
: mTextSections{
{ "wlan", [this](int fd) { dumpWlanSection(fd); } },
} {}
// Dump data requested by an argument to the "dump" interface, or help info // Dump data requested by an argument to the "dump" interface, or help info
// if the specified section is not supported. // if the specified section is not supported.
void Dumpstate::dumpTextSection(int fd, const std::string &sectionName) { void Dumpstate::dumpTextSection(int fd, const std::string &sectionName) {
bool dumpAll = (sectionName == kAllSections); bool dumpAll = (sectionName == kAllSections);
std::string dumpFiles; std::string dumpFiles;
for (const auto &section : mTextSections) {
if (dumpAll || sectionName == section.first) {
auto startTime = startSection(fd, section.first);
section.second(fd);
endSection(fd, section.first, startTime);
if (!dumpAll) {
return;
}
}
}
// Execute all or designated programs under vendor/bin/dump/ // Execute all or designated programs under vendor/bin/dump/
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir("/vendor/bin/dump"), closedir); std::unique_ptr<DIR, decltype(&closedir)> dir(opendir("/vendor/bin/dump"), closedir);
if (!dir) { if (!dir) {
@ -124,22 +107,11 @@ void Dumpstate::dumpTextSection(int fd, const std::string &sectionName) {
// An unsupported section was requested on the command line // An unsupported section was requested on the command line
::android::base::WriteStringToFd("Unrecognized text section: " + sectionName + "\n", fd); ::android::base::WriteStringToFd("Unrecognized text section: " + sectionName + "\n", fd);
::android::base::WriteStringToFd("Try \"" + kAllSections + "\" or one of the following:", fd); ::android::base::WriteStringToFd("Try \"" + kAllSections + "\" or one of the following:", fd);
for (const auto &section : mTextSections) {
::android::base::WriteStringToFd(" " + section.first, fd);
}
::android::base::WriteStringToFd(dumpFiles, fd); ::android::base::WriteStringToFd(dumpFiles, fd);
::android::base::WriteStringToFd("\nNote: sections with attachments (e.g. modem) are" ::android::base::WriteStringToFd("\nNote: sections with attachments (e.g. modem) are"
"not avalable from the command line.\n", fd); "not avalable from the command line.\n", fd);
} }
// Dump items related to wlan
void Dumpstate::dumpWlanSection(int fd) {
// Dump firmware symbol table for firmware log decryption
DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc");
RunCommandToFd(fd, "WLAN TWT Dump", {"/vendor/bin/sh", "-c",
"cat /sys/wlan_ptracker/twt/*"});
}
void Dumpstate::dumpLogSection(int fd, int fd_bin) void Dumpstate::dumpLogSection(int fd, int fd_bin)
{ {
std::string logDir = MODEM_LOG_DIRECTORY; std::string logDir = MODEM_LOG_DIRECTORY;

View file

@ -27,8 +27,6 @@ namespace dumpstate {
class Dumpstate : public BnDumpstateDevice { class Dumpstate : public BnDumpstateDevice {
public: public:
Dumpstate();
::ndk::ScopedAStatus dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds, ::ndk::ScopedAStatus dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds,
IDumpstateDevice::DumpstateMode in_mode, IDumpstateDevice::DumpstateMode in_mode,
int64_t in_timeoutMillis) override; int64_t in_timeoutMillis) override;
@ -42,14 +40,8 @@ class Dumpstate : public BnDumpstateDevice {
private: private:
const std::string kAllSections = "all"; const std::string kAllSections = "all";
std::vector<std::pair<std::string, std::function<void(int)>>> mTextSections;
void dumpTextSection(int fd, std::string const& sectionName); void dumpTextSection(int fd, std::string const& sectionName);
// Text sections that can be dumped individually on the command line in
// addition to being included in full dumps
void dumpWlanSection(int fd);
void dumpLogSection(int fd, int fdModem); void dumpLogSection(int fd, int fdModem);
//bool getVerboseLoggingEnabledImpl(); //bool getVerboseLoggingEnabledImpl();