From e90745d6fd796021788c947a52818d2dad41f799 Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Tue, 24 Feb 2015 19:25:35 +0900 Subject: [PATCH] runtime-info: Battery keys regard as disconnected in no battery model Below keys depend on battery module. If there is no battery in target, runtime-info regards battery keys as disconnected. RUNTIME_INFO_KEY_CHARGER_CONNECTED RUNTIME_INFO_KEY_BATTERY_IS_CHARGING Change-Id: I6138f1ffe03d3d0821f66e713947205712e55bae Signed-off-by: Jiyoung Yun --- src/runtime_info.c | 8 +++++--- src/runtime_info_system.c | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/runtime_info.c b/src/runtime_info.c index f423341..d90bf94 100644 --- a/src/runtime_info.c +++ b/src/runtime_info.c @@ -324,6 +324,7 @@ int runtime_info_get_value(runtime_info_key_e key, runtime_info_data_type_e data { runtime_info_item_h runtime_info_item; runtime_info_func_get_value get_value; + int ret; if (runtime_info_get_item(key, &runtime_info_item)) { LOGE("INVALID_PARAMETER(0x%08x) : invalid key", RUNTIME_INFO_ERROR_INVALID_PARAMETER); @@ -342,9 +343,10 @@ int runtime_info_get_value(runtime_info_key_e key, runtime_info_data_type_e data return RUNTIME_INFO_ERROR_IO_ERROR; } - if (get_value(value) != RUNTIME_INFO_ERROR_NONE) { - LOGE("IO_ERROR(0x%08x) : failed to get the runtime informaion / key(%d)", RUNTIME_INFO_ERROR_IO_ERROR, key); - return RUNTIME_INFO_ERROR_IO_ERROR; + ret = get_value(value); + if (ret != RUNTIME_INFO_ERROR_NONE) { + LOGE("ERROR(0x%08x) : fail to get the runtime information / key(%d)", ret, key); + return ret; } return RUNTIME_INFO_ERROR_NONE; diff --git a/src/runtime_info_system.c b/src/runtime_info_system.c index 322f5a8..90b31fd 100644 --- a/src/runtime_info_system.c +++ b/src/runtime_info_system.c @@ -186,6 +186,10 @@ int runtime_info_battery_charging_get_value(runtime_info_value_h value) if (runtime_info_vconf_get_value_int(VCONF_BATTERY_CHARGING, &vconf_value)) return RUNTIME_INFO_ERROR_IO_ERROR; + /* regard not supported as disconnected */ + if (vconf_value == -ENOTSUP) + vconf_value = false; + value->b = vconf_value; return RUNTIME_INFO_ERROR_NONE; @@ -352,6 +356,8 @@ int runtime_info_charger_connected_get_value(runtime_info_value_h value) switch (vconf_value) { case VCONFKEY_SYSMAN_CHARGER_DISCONNECTED: + /* regard not supported as disconnected */ + case -ENOTSUP: value->b = false; break; -- 2.7.4