diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 1b3fabe8..e7e0bb67 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -255,13 +255,16 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { DumpFileToFd(fd, "PD Engine", "/d/pd_engine/usbpd0"); DumpFileToFd(fd, "smblib-usb logs", "/d/ipc_logging/smblib/log"); DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports"); - DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc"); DumpTouch(fd); RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"}); RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "cat /d/tzdbg/qsee_log"}); - DumpFileToFd(fd, "Battery type", "/sys/class/power_supply/bms/battery_type"); + RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in /sys/class/power_supply/*/uevent ; do echo \"\n------ $f\" ; cat $f ; done"}); RunCommandToFd(fd, "Battery cycle count", {"/vendor/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8 ; do echo $f > /sys/class/power_supply/bms/cycle_count_id; count=`cat /sys/class/power_supply/bms/cycle_count`; echo \"$f: $count\"; done"}); + RunCommandToFd(fd, "QCOM FG SRAM", {"/vendor/bin/sh", "-c", "echo 0 > /d/fg/sram/address ; echo 500 > /d/fg/sram/count ; cat /d/fg/sram/data"}); + + DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc"); + return Void(); }; diff --git a/init.hardware.rc b/init.hardware.rc index 4b5be71f..f344807b 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -466,10 +466,6 @@ on boot # Wifi firmware reload path chown wifi wifi /sys/module/wlan/parameters/fwpath - # Allow system to write to cycle_count_id to iterate and get stats - chown system system /sys/class/power_supply/bms/cycle_count_id - chmod 0666 /sys/class/power_supply/bms/cycle_count_id - # default country code setprop ro.boot.wificountrycode 00 @@ -590,7 +586,7 @@ on property:sys.boot_completed=1 # UFS health chmod 755 /sys/kernel/debug/ufshcd0 - chown 644 /sys/kernel/debug/ufshcd0/err_state + chmod 644 /sys/kernel/debug/ufshcd0/err_state chmod 644 /sys/kernel/debug/ufshcd0/power_mode chmod 644 /sys/kernel/debug/ufshcd0/host_regs chmod 644 /sys/kernel/debug/ufshcd0/show_hba @@ -601,6 +597,14 @@ on property:sys.boot_completed=1 chmod 644 /sys/kernel/debug/ufshcd0/stats/query_stats chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats + # QCOM FG SRAM dump for dumpstate + chown system system /d/fg/sram/data + chown system system /d/fg/sram/count + chown system system /d/fg/sram/address + + # com.google.android.hardwareinfo needs to be able to read cycle counts + chmod 0666 /sys/class/power_supply/bms/cycle_count_id + trigger sys-boot-completed-set # We want one opportunity per boot to enable zram, so we diff --git a/sepolicy/vendor/dumpstate.te b/sepolicy/vendor/dumpstate.te index e2bdda42..6892e27f 100644 --- a/sepolicy/vendor/dumpstate.te +++ b/sepolicy/vendor/dumpstate.te @@ -10,9 +10,6 @@ userdebug_or_eng(` binder_call(dumpstate, per_mgr) ') -allow hal_dumpstate sysfs_batteryinfo:dir search; -allow hal_dumpstate sysfs_batteryinfo:file rw_file_perms; - # For collecting bugreports. allow dumpstate sysfs_scsi_devices_0000:file r_file_perms; allow dumpstate sysfs_scsi_devices_other:file r_file_perms; diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index cc99f23f..467eb297 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -31,6 +31,7 @@ type debugfs_wlan, debugfs_type, fs_type; type debugfs_mdp, debugfs_type, fs_type; type debugfs_icnss, debugfs_type, fs_type; type debugfs_ufs, debugfs_type, fs_type; +type debugfs_fg_sram, debugfs_type, fs_type; type debugfs_dma_bufinfo, debugfs_type, fs_type; type debugfs_tzdbg, debugfs_type, fs_type; diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts index fa561efb..fda77c2f 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -96,6 +96,6 @@ genfscon debugfs /mdp u:object_r:debugfs_mdp:s0 genfscon debugfs /rmt_storage u:object_r:debugfs_rmt_storage:s0 genfscon debugfs /icnss u:object_r:debugfs_icnss:s0 genfscon debugfs /ufshcd0 u:object_r:debugfs_ufs:s0 - +genfscon debugfs /fg/sram u:object_r:debugfs_fg_sram:s0 genfscon debugfs /dma_buf/bufinfo u:object_r:debugfs_dma_bufinfo:s0 genfscon debugfs /tzdbg u:object_r:debugfs_tzdbg:s0 diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index 8a60bfa5..95155077 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -72,3 +72,11 @@ allow hal_dumpstate_impl sysfs_scsi_devices_0000:file r_file_perms; allow hal_dumpstate_impl shell_data_file:file getattr; userdebug_or_eng(`allow hal_dumpstate_impl debugfs_dma_bufinfo:file r_file_perms;') dontaudit hal_dumpstate_impl debugfs_dma_bufinfo:file r_file_perms; + +# Query and dump power supply nodes +allow hal_dumpstate_impl sysfs_batteryinfo:dir search; +allow hal_dumpstate_impl sysfs_batteryinfo:file rw_file_perms; + +# Dump QCOM FG content +allow hal_dumpstate_impl debugfs_fg_sram:dir search; +allow hal_dumpstate_impl debugfs_fg_sram:file rw_file_perms;