dump_power: add battery caretaker dump into bugreport
logging for AACR(+H), AAFV, AACT, AACC and AACP Version Bug: 384737509 Test: adb bugreport Flag: EXEMPT bugfix Change-Id: I4e1feff739abeb22bbffe03bf8d903962eade26f Signed-off-by: Jack Wu <wjack@google.com>
This commit is contained in:
parent
8294ed3f57
commit
bd99c7ad2f
1 changed files with 53 additions and 1 deletions
|
@ -356,7 +356,7 @@ void dumpBatteryHealth() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpBatteryDefend() {
|
void dumpBatteryDefend() {
|
||||||
const char* defendConfig [][4] {
|
const char* defendConfig [][3] {
|
||||||
{"TRICKLE-DEFEND Config",
|
{"TRICKLE-DEFEND Config",
|
||||||
"/sys/devices/platform/google,battery/power_supply/battery/", "bd_"},
|
"/sys/devices/platform/google,battery/power_supply/battery/", "bd_"},
|
||||||
{"DWELL-DEFEND Config", "/sys/devices/platform/google,charger/", "charge_s"},
|
{"DWELL-DEFEND Config", "/sys/devices/platform/google,charger/", "charge_s"},
|
||||||
|
@ -401,6 +401,57 @@ void dumpBatteryDefend() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dumpBatteryCaretaker() {
|
||||||
|
const char* aacpConfig [][3] {
|
||||||
|
{"AACP Version",
|
||||||
|
"/sys/devices/platform/google,battery/power_supply/battery/", "aacp_"},
|
||||||
|
{"AACR Config",
|
||||||
|
"/sys/devices/platform/google,battery/power_supply/battery/", "aacr_"},
|
||||||
|
{"AAFV Config",
|
||||||
|
"/sys/devices/platform/google,battery/power_supply/battery/", "aafv_"},
|
||||||
|
{"AACT Config",
|
||||||
|
"/sys/devices/platform/google,battery/power_supply/battery/", "aact_"},
|
||||||
|
{"AACC",
|
||||||
|
"/sys/devices/platform/google,battery/power_supply/battery/", "aacc"},
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<std::string> files;
|
||||||
|
struct dirent *entry;
|
||||||
|
std::string content;
|
||||||
|
std::string fileLocation;
|
||||||
|
|
||||||
|
for (auto &config : aacpConfig) {
|
||||||
|
DIR *dir = opendir(config[1]);
|
||||||
|
if (dir == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
printTitle(config[0]);
|
||||||
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
|
if (std::string(entry->d_name).find(config[2]) != std::string::npos &&
|
||||||
|
strncmp(config[2], entry->d_name, strlen(config[2])) == 0) {
|
||||||
|
files.push_back(entry->d_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
|
||||||
|
sort(files.begin(), files.end());
|
||||||
|
|
||||||
|
for (auto &file : files) {
|
||||||
|
fileLocation = std::string(config[1]) + std::string(file);
|
||||||
|
if (!android::base::ReadFileToString(fileLocation, &content) || content.empty()) {
|
||||||
|
content = "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s: %s", file.c_str(), content.c_str());
|
||||||
|
|
||||||
|
if (content.back() != '\n')
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
files.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void printValuesOfDirectory(const char *directory, std::string debugfs, const char *strMatch) {
|
void printValuesOfDirectory(const char *directory, std::string debugfs, const char *strMatch) {
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
auto info = directory;
|
auto info = directory;
|
||||||
|
@ -1072,6 +1123,7 @@ int main() {
|
||||||
dumpPdEngine();
|
dumpPdEngine();
|
||||||
dumpBatteryHealth();
|
dumpBatteryHealth();
|
||||||
dumpBatteryDefend();
|
dumpBatteryDefend();
|
||||||
|
dumpBatteryCaretaker();
|
||||||
dumpChg();
|
dumpChg();
|
||||||
dumpChgUserDebug();
|
dumpChgUserDebug();
|
||||||
dumpScratchpad();
|
dumpScratchpad();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue