diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2015-07-23 21:34:05 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2015-07-23 21:34:05 +0900 |
commit | e14a74aa895993ba76c02f4c23c02ec0a74f9583 (patch) | |
tree | b00c0aeeb7d80128e1d871291d269c4ef9b667cc | |
parent | e866798d02aa696ac131ca4a965c7ac23087aecf (diff) | |
download | deviced-e14a74aa895993ba76c02f4c23c02ec0a74f9583.tar.gz deviced-e14a74aa895993ba76c02f4c23c02ec0a74f9583.tar.bz2 deviced-e14a74aa895993ba76c02f4c23c02ec0a74f9583.zip |
deviced: Do not enter the low battery and auto brightness state on emul.submit/tizen/20150727.065505
The initial value of battery capacity gets from device node on the first boot.
Do not change an auto brightness mode when sim is inserted.
It's a specific mobile product concept.
Change-Id: I731d8a1ca3c4daf3bd8b282e1bd476ed721010e7
Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
-rw-r--r-- | src/battery/power-supply.c | 28 | ||||
-rw-r--r-- | src/display/display-dbus.c | 7 |
2 files changed, 25 insertions, 10 deletions
diff --git a/src/battery/power-supply.c b/src/battery/power-supply.c index f7c937ce..d816fe68 100644 --- a/src/battery/power-supply.c +++ b/src/battery/power-supply.c @@ -562,11 +562,6 @@ static void process_power_supply(void *data) power_supply_broadcast(CHARGE_NOW_SIGNAL, battery.charge_now); } - if (!(old.online == battery.online && - old.charge_now == battery.charge_now && - old.charge_full == battery.charge_full)) - return; - lowbat_execute(data); check_online(); if (old.charge_full != battery.charge_full) @@ -633,12 +628,35 @@ static void uevent_power_handler(struct udev_device *dev) process_power_supply(&battery.capacity); } +static int lowbat_read(int *val) +{ + int r; + + if (!val) + return -EINVAL; + + r = sys_get_int("/sys/class/power_supply/battery/capacity", val); + if (r < 0) + return r; + + return 0; +} + static void power_supply_status_init(void) { static int charge_now = -1; static int charge_full = -1; static int capacity = -1; + int pct; + int r; + + r = lowbat_read(&pct); + if (r < 0) { + _E("fail to read capacity data : %d", r); + return; + } + battery.capacity = pct; battery.health = HEALTH_GOOD; battery.ovp = OVP_NORMAL; battery.present = PRESENT_NORMAL; diff --git a/src/display/display-dbus.c b/src/display/display-dbus.c index 180acb5e..c5e8f522 100644 --- a/src/display/display-dbus.c +++ b/src/display/display-dbus.c @@ -413,8 +413,8 @@ static DBusMessage *edbus_setbrightness(E_DBus_Object *obj, DBusMessage *msg) } if (autobrt == SETTING_BRIGHTNESS_AUTOMATIC_ON) { - _D("auto_brightness state is ON, can not change the brightness value"); - ret = 0; + _E("auto_brightness state is ON, can not change the brightness value"); + ret = -EPERM; goto error; } @@ -1006,10 +1006,7 @@ static void sim_signal_handler(void *data, DBusMessage *msg) } if (val != SIM_CARD_NOT_PRESENT) { - /* change setting : autobrightness on */ state = true; - vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, - SETTING_BRIGHTNESS_AUTOMATIC_ON); vconf_set_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, PM_DEFAULT_BRIGHTNESS); _I("SIM card is inserted at first!"); |