Merge "init: Add ro.alarm_boot property support"

This commit is contained in:
Linux Build Service Account 2014-05-04 19:33:11 -07:00 committed by Gerrit - the friendly Code Review server
commit de68173812
1 changed files with 30 additions and 0 deletions

View File

@ -129,6 +129,35 @@ void setOwners(char *path, int owner, int group)
}
}
void init_alarm_boot_properties()
{
char *alarm_file = "/proc/sys/kernel/boot_reason";
char buf[BUF_SIZE];
if(read_file2(alarm_file, buf, sizeof(buf))) {
/*
* Setup ro.alarm_boot value to true when it is RTC triggered boot up
* For existing PMIC chips, the following mapping applies
* for the value of boot_reason:
*
* 0 -> unknown
* 1 -> hard reset
* 2 -> sudden momentary power loss (SMPL)
* 3 -> real time clock (RTC)
* 4 -> DC charger inserted
* 5 -> USB charger insertd
* 6 -> PON1 pin toggled (for secondary PMICs)
* 7 -> CBLPWR_N pin toggled (for external power supply)
* 8 -> KPDPWR_N pin toggled (power key pressed)
*/
if(buf[0] == '3')
property_set("ro.alarm_boot", "true");
else
property_set("ro.alarm_boot", "false");
}
}
/*
* Setup Display related nodes & permissions. For HDMI, it can be fb1 or fb2
* Loop through the sysfs nodes and determine the HDMI(dtv panel)
@ -232,6 +261,7 @@ void vendor_load_properties()
/* Define MSM family properties */
init_msm_properties(msm_id, msm_ver, board_type);
init_alarm_boot_properties();
/*check for coredump*/
check_rlim_action();