dumpstate: move the dump registers from regmap to each driver

dumpstate availible to dump data with below 2 permission:
-r--r--r-- 1 root root
-r--r----- 1 system system
but /d/regmap permission is -r-------- 1 root root
1. we cannot change root to system with chown if the file node is root
2. we cannot change to read with chmod if the file node is root
3. try change permission in vendor_init causes sepolicy build fail with
   message rule neverallow

Base on above results, we added new file node in kernel with available
permission to dump needed data and dump it.

Bug: 194941806
Test: adb bugreport
Change-Id: Ieeb1adfb0351ceb33bf817cbef3663d41cdb8645
Signed-off-by: Ted Lin <tedlin@google.com>
This commit is contained in:
Ted Lin 2021-08-05 13:41:13 +08:00 committed by TreeHugger Robot
parent f739cf68c0
commit 2b86da4352

View file

@ -378,10 +378,8 @@ void DumpstateDevice::dumpPowerSection(int fd) {
" for f in `ls bd_*` ; do echo \"$f: `cat $f`\" ; done"});
if (!PropertiesHelper::IsUserBuild()) {
RunCommandToFd(fd, "DC_registers dump", {"/vendor/bin/sh", "-c",
"for f in /d/regmap/*-0057-pca9468-mains ; do "
"regs=`cat $f/registers`; echo $f: ;"
"echo \"$regs\"; done"});
DumpFileToFd(fd, "DC_registers dump", "/sys/class/power_supply/pca9468-mains/device/registers_dump");
RunCommandToFd(fd, "fg_model", {"/vendor/bin/sh", "-c",
"for f in /d/maxfg* ; do "
@ -401,7 +399,7 @@ void DumpstateDevice::dumpPowerSection(int fd) {
/* FG Registers */
RunCommandToFd(fd, "fg registers", {"/vendor/bin/sh", "-c",
"for f in /d/regmap/*-0036 ; do "
"for f in /d/maxfg* ; do "
"regs=`cat $f/registers`; echo $f: ;"
"echo \"$regs\"; done"});
}