From: Jiyoung Yun Date: Tue, 24 Feb 2015 10:25:35 +0000 (+0900) Subject: runtime-info: Battery keys regard as disconnected in no battery model X-Git-Tag: submit/tizen/20150226.021228^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e90745d6fd796021788c947a52818d2dad41f799;p=platform%2Fcore%2Fapi%2Fruntime-info.git 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 --- 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;