bcl: support thismeal binary parsing
Test: ./dump_power and adb bugreport Bug: 293899466 Change-Id: I4ba2ee96a02573993cd4de132db9095f73253041 Signed-off-by: samou <samou@google.com>
This commit is contained in:
parent
ce8c8e9bb8
commit
505f0b8308
2 changed files with 21 additions and 0 deletions
|
@ -21,7 +21,9 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
#include <android-base/file.h>
|
||||
|
@ -603,6 +605,22 @@ void dumpMitigation() {
|
|||
{"Thismeal" , "/data/vendor/mitigation/thismeal.txt"},
|
||||
};
|
||||
|
||||
/* parsing thismeal.bin */
|
||||
int status;
|
||||
int pid = fork();
|
||||
if (pid < 0) {
|
||||
printf("Fork failed for parsing thismeal.bin.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
} else if (pid == 0) {
|
||||
execl("/vendor/bin/hw/battery_mitigation", "battery_mitigation", "-d", nullptr);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
waitpid(pid, &status, 0);
|
||||
|
||||
if (WIFSIGNALED(status)) {
|
||||
printf("Failed to parse thismeal.bin.(killed by: %d)\n", WTERMSIG(status));
|
||||
}
|
||||
|
||||
for (auto &row : mitigationList) {
|
||||
if (!isValidFile(row[1]))
|
||||
printTitle(row[0]);
|
||||
|
|
|
@ -77,6 +77,9 @@ on init
|
|||
chown system system /sys/devices/platform/google,charger/dd_state
|
||||
chown system system /sys/devices/platform/google,charger/dd_settings
|
||||
|
||||
# for parsing thismeal.bin
|
||||
chown system system /vendor/bin/hw/battery_mitigation
|
||||
|
||||
on early-boot
|
||||
# Wait for insmod_sh to finish all common modules
|
||||
wait_for_prop vendor.common.modules.ready 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue