From 439374a70d638218bb496f7214082c4e7e44948e Mon Sep 17 00:00:00 2001 From: Anirudh Ghayal Date: Wed, 5 Feb 2014 22:07:20 +0530 Subject: [PATCH] init script: start the vm_bms service for 8916 The vm_bms service is the voltage mode battery monitoring system (BMS). Start the service as root to set CAP_BLOCK_SUSPEND for wake lock capability. Later, the service will drop itself down as a system service but will retain CAP_BLOCK_SUSPEND capability. Change-Id: I7ee8eed0b075e2ee82b2b6c7e3a771d97b08a33a --- rootdir/etc/init.qcom.rc | 5 +++++ rootdir/etc/init.qcom.sh | 16 +++++++++++++++- rootdir/etc/ueventd.qcom.rc | 6 +++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index 380a907c..ffe9357c 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -757,3 +757,8 @@ on property:persist.sys.rootagent=1 start rootagent on property:persist.sys.rootagent=0 stop rootagent + +service vm_bms /system/bin/vm_bms + user root + group root + disabled diff --git a/rootdir/etc/init.qcom.sh b/rootdir/etc/init.qcom.sh index d3f8cc14..6403b42b 100644 --- a/rootdir/etc/init.qcom.sh +++ b/rootdir/etc/init.qcom.sh @@ -1,5 +1,5 @@ #!/system/bin/sh -# Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. +# Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -83,6 +83,17 @@ start_charger_monitor() fi } +start_vm_bms() +{ + if [ -e /dev/vm_bms ]; then + chown -h root.system /sys/class/power_supply/bms/current_now + chown -h root.system /sys/class/power_supply/bms/voltage_ocv + chmod -h 0664 /sys/class/power_supply/bms/current_now + chmod -h 0664 /sys/class/power_supply/bms/voltage_ocv + start vm_bms + fi +} + baseband=`getprop ro.baseband` # # Suppress default route installation during RA for IPV6; user space will take @@ -164,4 +175,7 @@ case "$target" in "msm8610") start_charger_monitor ;; + "msm8916") + start_vm_bms + ;; esac diff --git a/rootdir/etc/ueventd.qcom.rc b/rootdir/etc/ueventd.qcom.rc index 8046af1e..52161705 100644 --- a/rootdir/etc/ueventd.qcom.rc +++ b/rootdir/etc/ueventd.qcom.rc @@ -1,4 +1,4 @@ -# Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. +# Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -171,6 +171,10 @@ /sys/devices/virtual/input/input* poll 0660 input system /sys/devices/virtual/input/input* pollrate_ms 0660 input system +# vm_bms +/dev/vm_bms 0660 system system +/dev/battery_data 0660 system system + # wlan /dev/wcnss_wlan 0660 system system #nfc permissions