runtime-info: Battery keys regard as disconnected in no battery model 64/35764/2 accepted/tizen/common/20150226.084921 accepted/tizen/mobile/20150226.100215 accepted/tizen/tv/20150226.094312 accepted/tizen/wearable/20150226.095247 submit/tizen/20150226.021228
authorJiyoung Yun <jy910.yun@samsung.com>
Tue, 24 Feb 2015 10:25:35 +0000 (19:25 +0900)
committerJiyoung Yun <jy910.yun@samsung.com>
Wed, 25 Feb 2015 10:20:52 +0000 (19:20 +0900)
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 <jy910.yun@samsung.com>
src/runtime_info.c
src/runtime_info_system.c

index f423341..d90bf94 100644 (file)
@@ -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;
index 322f5a8..90b31fd 100644 (file)
@@ -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;