land: Enable power-on alarm feature

Signed-off-by: karthick111 <karthickrko61@gmail.com>
This commit is contained in:
karthick111 2017-03-18 06:26:18 +01:00
parent 7a4676e0e4
commit de4c50b88c

View file

@ -29,6 +29,8 @@
#include <cstdlib>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include "vendor_init.h"
@ -36,6 +38,37 @@
#include "log.h"
#include "util.h"
static void init_alarm_boot_properties()
{
int boot_reason;
FILE *fp;
fp = fopen("/proc/sys/kernel/boot_reason", "r");
fscanf(fp, "%d", &boot_reason);
fclose(fp);
/*
* 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 inserted
* 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 (boot_reason == 3) {
property_set("ro.alarm_boot", "true");
} else {
property_set("ro.alarm_boot", "false");
}
}
void vendor_load_properties()
{
std::ifstream fin;
@ -51,6 +84,8 @@ void vendor_load_properties()
break;
fin.close();
init_alarm_boot_properties();
if (buf.find("S88537AA1") != std::string::npos) {
property_set("ro.build.display.wtid", "SW_S88537AA1_V071_M20_MP_XM");
} else if (buf.find("S88537AB1") != std::string::npos) {