battery : read fails /sys/class/power_supply/battery/capacity at the first access... 66/135366/2 accepted/tizen_4.0_unified tizen_4.0 accepted/tizen/4.0/unified/20170816.012212 accepted/tizen/4.0/unified/20170828.224128 accepted/tizen/unified/20170626.011735 submit/tizen/20170623.065932 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170828.110001 tizen_4.0.IoT.p1_release tizen_4.0.IoT.p2_release tizen_4.0.m2_release
authorINSUN PYO <insun.pyo@samsung.com>
Thu, 22 Jun 2017 05:24:58 +0000 (14:24 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Thu, 22 Jun 2017 05:53:20 +0000 (14:53 +0900)
commit524dbbbf313bda840ca8d6e02abe8674536d605f
treeff28b50369ab6960d1e799e956fdf68dabd6319b
parentaf1e5a6073c0fc0e1eb556492a5c80c2b8082c66
battery : read fails /sys/class/power_supply/battery/capacity at the first access time.

When the TW emulator first accesses /sys/class/power_supply/battery/capacity,
it sometimes returns an empty string.

So, lowbat_monitor() is called with 0 parameter.
"0" means that battery level is 0.
When deviced detects battery level 0, it creates a 30 second power off timer.
So the emulator automatically powers off intermittently after 35 seconds.

If an empty string is returned, we modify it to read /sys/clas/power_supply/battery/capacity again.

Signed-off-by: INSUN PYO <insun.pyo@samsung.com>
Change-Id: Ieefd950fe175ef138814624f6a3957ac7432cc74
hw/battery/battery.c