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: I9d36e6fcb25ee9f12b4fd2962207b1f4b592c2b3 Signed-off-by: Jack Wu <wjack@google.com>
This commit is contained in:
parent
deeb36e5e9
commit
0c88c7620a
1 changed files with 53 additions and 1 deletions
|
@ -329,7 +329,7 @@ void dumpBatteryHealth() {
|
|||
}
|
||||
|
||||
void dumpBatteryDefend() {
|
||||
const char* defendConfig [][4] {
|
||||
const char* defendConfig [][3] {
|
||||
{"TRICKLE-DEFEND Config",
|
||||
"/sys/devices/platform/google,battery/power_supply/battery/", "bd_"},
|
||||
{"DWELL-DEFEND Config", "/sys/devices/platform/google,charger/", "charge_s"},
|
||||
|
@ -374,6 +374,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) {
|
||||
std::vector<std::string> files;
|
||||
auto info = directory;
|
||||
|
@ -935,6 +986,7 @@ int main() {
|
|||
dumpWc68();
|
||||
dumpBatteryHealth();
|
||||
dumpBatteryDefend();
|
||||
dumpBatteryCaretaker();
|
||||
dumpChg();
|
||||
dumpChgUserDebug();
|
||||
dumpBatteryEeprom();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue