s5neolte: ramdisk: save/restore the batt_capacity_max value on boot to
authorDanny Wood <danwood76@gmail.com>
Fri, 14 Dec 2018 08:02:03 +0000 (08:02 +0000)
committerJan Altensen <info@stricted.net>
Mon, 12 Aug 2019 14:26:10 +0000 (16:26 +0200)
 preserve battery health

Change-Id: I95978baffd8134512b4c362993e2f174bb7fcd43

ramdisk/etc/init.target.rc

index 080053c14337a5ba681f90f46faa3d1bbe1eac03..a02266170131cbe3ad222d7f54a9ba858860b65c 100644 (file)
@@ -56,7 +56,16 @@ on fs
     # Permissions for LCD
        chown system radio /sys/class/lcd/panel/mcd_mode
        chown system media_rw /sys/class/backlight/panel/weakness_hbm_comp
-       
+
+    # Restore the previous batt_capacity_max (if it exists)
+    copy /efs/Battery/prev_batt_capacity_max /sys/class/power_supply/battery/batt_capacity_max
+
 on property:sys.boot_completed=1
     write /proc/sys/vm/dirty_bytes 31457280
     write /proc/sys/vm/dirty_background_bytes 15728640
+
+on shutdown
+    # Fix permissions then store the current batt_capacity_max value in the EFS partition
+    chmod 600 /sys/class/power_supply/battery/batt_capacity_max
+    copy /sys/class/power_supply/battery/batt_capacity_max /efs/Battery/prev_batt_capacity_max
+