diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 1b469b6a..a073f9f0 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -231,6 +231,7 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { RunCommandToFd(fd, "FP LOGS", {"qsee_logger", "-d"}); } + 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"}); return Void(); }; diff --git a/init.hardware.rc b/init.hardware.rc index 753de16a..35cc45e6 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -452,6 +452,10 @@ 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 0660 /sys/class/power_supply/bms/cycle_count_id + # default country code setprop ro.boot.wificountrycode 00 diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te index cc82bede..0cdaa309 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -23,6 +23,7 @@ userdebug_or_eng(` allow hal_dumpstate_impl debugfs_ipc:file r_file_perms; allow hal_dumpstate_impl sysfs_usb_device:dir r_dir_perms; allow hal_dumpstate_impl sysfs_usb_device:file r_file_perms; + allow hal_dumpstate_impl sysfs_msm_subsys:file write; set_prop(hal_dumpstate_impl, modem_diag_prop) ')